ElasticSearch安裝與集群詳細(xì)教程

三臺機器分別為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.進(jìn)行配置
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 機器上
分別查看各個機器的日志

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容