1.安裝java1.8環(huán)境(略)
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用戶無法啟動,需要創(chuàng)建一個單獨的用戶用來運行ElasticSearch
groupadd elsearch
useradd elsearch -g elsearch -p elasticsearch
4.更改elasticsearch文件夾及內(nèi)部文件的所屬用戶及組為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
添加如下內(nèi)容:
* 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.訪問網(wǎng)站地址