三臺機器分別為node1 node2 node3 此為同一個局域網(wǎng)的hostname
系統(tǒng)為centos7
1.修改/etc/security/limits.conf
切換到root用戶修改
vim /etc/security/limits.conf
在最后面追加下面內(nèi)容
user hard nofile 65536
user soft nofile 65536
修改完生效的方法:
這個配置是在重啟后才生效的谎砾,那我們一般不可以重啟電腦,那怎么辦呢工三?
弄個臨時生效的方法鳞滨,
臨時修改:
ulimit -SHn 65535
(n代表修改值多少,S指soft,H指hard) 重啟失效;
然后重新開個會話才會生效。
2.修改 /etc/sysctl.conf
切換到root用戶修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=262144
并執(zhí)行命令:
sysctl -p
然后枣察,重新啟動elasticsearch蹬蚁,即可啟動成功打月。
sysctl -p 從指定的文件加載系統(tǒng)參數(shù)趁怔,如不指定即從/etc/sysctl.conf中加載
3.下載安裝包
上官網(wǎng)下載湿硝,此教程使用版本為6.5.4
4.進行配置
cd ~/elasticsearch-6.5.4/config
vim jvm.options
-Xms1g
-Xmx1g
此處根據(jù)機器配置優(yōu)化
cd ~/elasticsearch-6.5.4/
mkdir data
此處存儲es數(shù)據(jù)到data文件夾下
修改elasticsearch.yml
vim ~/elasticsearch-6.5.4/config/elasticsearch.yml
cluster.name: my-es-application
node.name: node1
path.data: ~/elasticsearch-6.5.4/data
path.logs: ~/elasticsearch-6.5.4/logs
network.host: 0.0.0.0
http.port: 9200
discovery.zen.ping.unicast.hosts: ["node1", "node2","node3"]
gateway.recover_after_nodes: 1
bootstrap.system_call_filter: false #centos6專屬配置
http.cors.enabled: true
http.cors.allow-origin: "*"
5.啟動
~/elasticsearch-6.5.4/bin/elasticsearch -d
cd ../logs
tail -f my-es-application.log
然后復(fù)制到node2 node3 機器上
分別查看各個機器的日志