elasticsearch
1、安装JDK
https://www.oracle.com/technetwork/java/javase/downloads/java-archive-javase8-2177648.html
2、下载安装elasticsearch
wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.6.3.zip
unzip elasticsearch-5.6.3.zip
mv elasticsearch-5.6.3 /usr/local/
3、配置
useradd elk
echo '123456' > passwd --stdin elk
chown -R elk. /usr/local/elasticsearch-5.6.3
echo '* soft nofile 65536' >> /etc/security/limits.conf
echo '* hard nofile 65536' >> /etc/security/limits.conf
echo '* soft noproc 65536' >> /etc/security/limits.conf
echo '* hard noproc 65536' >> /etc/security/limits.conf
echo "vm.max_map_count = 262144" >> /etc/sysctl.conf
echo "elk soft nproc 4096" >> /etc/security/limits.d/20-nproc.conf
sysctl -p
vi config/elasticsearch.yml
cluster.name: es_cluster #这里是你的el集群的名称
node.name: node0 # elseach集群中的节点
path.data: /tmp/elasticseach/data #设置 data 目录
path.logs: /tmp/elasticseach/logs #设置 logs 目录
network.host:192.168.10.101 #这里配置本机的 ip 地址
http.port: 9200 #默认的端口
4、启动
su - elk -c '/usr/local/elasticsearch-5.6.3/bin/elasticsearch -d'
FQA:
问题1:
修改log日志文件的所属权
否则启动ES时会报错:
ERROR RollingFileManager (/myes/elasticsearch-6.0.0/logs/elasticsearch.log) java.io.FileNotFoundException: /elasticsearch-6.0.0/logs/elasticsearch.log (权限不够) java.io.FileNotFoundException: /elasticsearch-6.0.0/logs/elasticsearch.log (权限不够)
ERROR Could not create plugin of type class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: ManagerFactory [org.apache.logging.log4j.core.appender.rolling.RollingFileManager$RollingFileManagerFactory@????????] unable to create manager for [/myes/elasticsearch-6.0.0/logs/elasticsearch.log] with data ......
ERROR Unable to invoke factory method in class org.apache.logging.log4j.core.appender.RollingFileAppender for element RollingFile: java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender java.lang.IllegalStateException: No factory method found for class org.apache.logging.log4j.core.appender.RollingFileAppender
ERROR Null object returned for RollingFile in Appenders.
ERROR Unable to locate appender "rolling" for logger config "root"
问题2:
Java HotSpot(TM) 64-Bit Server VM warning: INFO: os::commit_memory(0x0000000085330000, 2060255232, 0) failed; error='Cannot allocate memory' (errno=12)
解决方法:
# 由于elasticsearch5.0默认分配jvm空间大小为2g,修改jvm空间分配
# 如果使用虚拟机安装,内存最好不小于2G
vim config/jvm.options
-Xms512m
-Xmx512m
问题3:
main ERROR Null object returned for RollingFile in Appenders.
main ERROR Unable to locate appender "rolling" for logger config "root"
main ERROR Unable to locate appender "index_indexing_slowlog_rolling" for logger config "index.indexing.slowlog.index"
main ERROR Unable to locate appender "index_search_slowlog_rolling" for logger config "index.search.slowlog"
main ERROR Unable to locate appender "deprecation_rolling" for logger config "org.elasticsearch.deprecation"
# 修改配置文件log4j2.properties
vim config/log4j2.properties
logger.deprecation.level = warn
修改为
logger.deprecation.level = error