一.首先去elastic官網下載(http://www.elastic.co/downloads/elasticsearch)對應版本的elasticsearch,選擇tar包下載
二.將下載的elasticsearch-5.5.0.tar.gz檔案分成兩份拷貝到不同節點的伺服器上,解壓。
三.修改elasticsearch設定檔
1.例如我這邊的兩個台節點伺服器ip分別是"10.224.2.15"和"10.224.2.25"
2.分別修改兩個elasticsearch檔案下/config下的elasticsearch.yml設定檔
3.在10.224.2.15下配置如下:
cluster.name: elasticsearch node.name: es-node1path.data: /opt/elasticsearch-path/datapath.logs: /opt/elasticsearch-path/lognetwork.host: 10.224.2.15http.port: 9200node.master: truenode.data: truehttp.enabled: truehttp.cors.enabled: truehttp.cors.allow-origin: "*"discovery.zen.ping.unicast.hosts: ["10.224.2.15","10.224.2.25"]discovery.zen.minimum_master_nodes: 1
在10.224.2.25下配置如下:
cluster.name: elasticsearchnode.name: es-node2path.data: /export/es/datapath.logs: /export/es/logsnetwork.host: 10.224.2.25http.port: 9200node.master: falsenode.data: truehttp.enabled: truehttp.cors.enabled: truehttp.cors.allow-origin: "*"discovery.zen.ping.unicast.hosts: ["10.224.2.15","10.224.2.25"]discovery.zen.minimum_master_nodes: 1
cluster.name:cluster.name為叢集的名稱,多個節點的cluster.name名稱必須是一樣。
node.name:node-name為節點名稱,不同節點取不同名稱。
path.data:資料檔案位置。
path.logs:記錄檔位置。3
network.host:當前節點ip地址。
http.port:elasticsearch服務連接埠 預設填9200。
discovery.zen.ping.unicast.hosts:所有節點的ip地址,這裡我裝到兩個節點上,所以我填了2個節點的ip,有3個就3個節點ip。
四.啟動
進入到bin目錄,執行命令./elasticsearch -d
(-d表示在後台啟動)
六.報錯:
[1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
解決辦法:
1、在root使用者修改配置sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
並執行命令:
sysctl -p
然後,重新啟動elasticsearch,即可啟動成功。
報錯:
[2]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
原因:
這是在因為Centos6不支援SecComp,而ES5.2.0預設bootstrap.system_call_filter為true進行檢測,所以導致檢測失敗,失敗後直接導致ES不能啟動。
解決:
在elasticsearch.yml中配置bootstrap.system_call_filter為false,
注意要在Memory下面:
bootstrap.memory_lock: false
bootstrap.system_call_filter: false
[3]:Elasticsearch requires at least Java 8 but your Java version from /root/jdk1.7.0_79/bin/java does not meet this requirement
如果你的系統裝的是jdk1.8的,java -vesion 出來的也是1.8的,那麼執行一下source /etc/profile 這個命令再重新啟動就可以了。
成功啟動訪問頁面:
運行命令ps -ef|grep elasticsearch,看服務啟動沒有。