前提是安装了jdk我安装的jdk是1.8版本的
下载elasticsearch https://www.elastic.co/downloads/past-releases/elasticsearch-5-3-0
上传到 /opt/install文件夹中
创建 Elasticsearch 用户
为了运行 Elasticsearch,最好以非 root 用户身份运行。创建一个新的用户和组:
sudo groupadd es
sudo useradd es -g es
创建如果有报错-bash: cd: home: No such file or directory
执行 cd /home 然后mkdir es
配置 Elasticsearch
首先配置vi /opt/install/elasticsearch/config/elasticsearch.yml
network.host: 0.0.0.0
http.port: 9200
ra切换到新用户并配置 Elasticsearch:
sudo chown -R es:es /opt/install/elasticsearch
sudo su - es
cd /opt/install/elasticsearch/bin
启动 Elasticsearch
./elasticsearch
elasticsearch启动报错 bootstrap checks failed
ERROR: [1] bootstrap checks failed
1、关于报错:[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
解决办法:
vim /etc/security/limits.conf
添加
* soft nofile 65536
* hard nofile 65536
来回切换下用户,使之生效;
2、关于报错:[2]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解决办法:
vim /etc/sysctl.conf
添加:
vm.max_map_count=262144
保存后,执行:
sysctl -p
重新启动,成功。
3、针对第三个问题:system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
出现错误的原因:是因为centos6.x操作系统不支持SecComp,而elasticsearch 5.5.2默认bootstrap.system_call_filter为true进行检测,所以导致检测失败,失败后直接导致ES不能启动。
在elasticsearch.yml中添加配置项:bootstrap.system_call_filter为false:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
4、针对第四个问题:max number of threads [1024] for user [wh] likely too low, increase to at least [2048]
vi /etc/security/limits.d/90-nproc.conf
修改如下内容:
* soft nproc 1024
#修改为
* soft nproc 2048