1.安装java1.8环境(略)
2.在/usr/local/src下解压elasticsearch到/usr/local目录,并添加软链接
tar -zxvf elasticsearch-5.1.2.tar.gz -C /usr/local/
ln -s /usr/local/elasticsearch-2.2.1 /usr/local/elasticsearch
3.root用户无法启动,需要创建一个单独的用户用来运行ElasticSearch
groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
4.更改elasticsearch文件夹及内部文件的所属用户及组为elsearch:elsearch
cd /usr/local/
chown -R elsearch:elsearch elasticsearch-5.1.2
5.切换到elsearch用户启动
su elsearch
cd /usr/local/elasticsearch
./bin/elasticsearch
6.处理启动中的报错
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
vi /etc/security/limits.conf
添加如下内容:
* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096
max number of threads [1024] for user [elsearch] is too low, increase to at least [2048]
vi /etc/security/limits.d/90-nproc.conf
* soft nproc 1024
#修改为
* soft nproc 2048
7.ElasticSearch后端启动命令
./bin/elasticsearch -d
8.编辑配置文件vi config/elasticsearch.yml,修改以下配置
network.host:0.0.0.0
http.port: 9200
9.访问网站地址