elasticsearch集群安裝

環(huán)境:centos6.5,三個節(jié)點,master,slaver1,slaver2
安裝包下載:https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-5.4.1.tar.gz
jdk版本要求:1.8.0_131
</br>
<h3>配置文件修改</h3>

$ES_HOME/conf/elasticsearch.yml
<li>cluster.name: wpchao_first :集群名稱,相同名稱的節(jié)點會組成一個集群
<li>node.name: wpchao_first_node1:節(jié)點名稱,每個節(jié)點名稱都不相同
<li>path.data: /data/es/wpchao_first : es數(shù)據(jù)目錄
<li>path.logs: /data/es/wpchao_first/logs :es日志目錄
<li>network.host: 192.168.2.3 :服務綁定和與其他節(jié)點通信的ip
<li>discovery.zen.ping.unicast.hosts: ["master", "slaver1", "slaver2"],能夠發(fā)現(xiàn)集群中新加入節(jié)點的節(jié)點
<li>discovery.zen.minimum_master_nodes:3 集群中有資格成為master節(jié)點個數(shù)

默認情況下修改這些配置就夠了,其他的參數(shù)修改參考:http://blog.csdn.net/an74520/article/details/8219814
</br>
</br>
<h3>集群啟動及問題處理</h3>
將es安裝文件scp到其他的節(jié)點,并修改對應的配置文件,分別啟動每個節(jié)點,此時es會自動選舉某個節(jié)點為master節(jié)點,注意es不允許root用戶啟動
啟動腳本:$ES_HOME/bin/elasticsearch

<li>啟動時異常及處理方法

[2017-06-04T14:57:52,826][ERROR][o.e.b.Bootstrap          ] [wpchao_first_node] node validation exception
[4] bootstrap checks failed
[1]: max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
[2]: max number of threads [1024] for user [biligeci] is too low, increase to at least [2048]
[3]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
[4]: system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk

問題一:

  max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]
  原因:無法創(chuàng)建本地文件問題,用戶最大可創(chuàng)建文件數(shù)太小
  解決方法:切換到root用戶,編輯limits.conf配置文件, 添加類似如下內(nèi)容:
  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 [biligeci] is too low, increase to at least [2048]
原因:無法創(chuàng)建本地線程問題,用戶最大可創(chuàng)建線程數(shù)太小
解決方法:切換到root用戶,進入limits.d目錄下,修改90-nproc.conf 配置文件。
vi /etc/security/limits.d/90-nproc.conf
找到如下內(nèi)容:
* soft nproc 1024
修改為
* soft nproc 2048

問題三:

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
原因:最大虛擬內(nèi)存太小
解決方法:切換到root用戶下,修改配置文件sysctl.conf
vi /etc/sysctl.conf
添加下面配置:
vm.max_map_count=655360
并執(zhí)行命令:
sysctl -p

問題四:

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.4.1默認bootstrap.system_call_filter為true進行檢測,所以導致檢測失敗,失敗后直接導致ES不能啟動
解決辦法:在es的配置文件elasticsearch.yml將bootstrap.system_call_filter 設置為false

到此,分別啟動各個節(jié)點,集群進入可以用狀態(tài)

<li>查看集群狀態(tài)

單節(jié)點檢測,可以分別檢測每個節(jié)點是否啟動成功

集群檢測

一般的集群檢測中就可以看出整體集群的狀態(tài),不必要去檢測單節(jié)點的狀態(tài),當然看下總是好的
</br>
</br>
<h3>kibana</h3>
Kibana是一個基于瀏覽器頁面的Elasticsearch前端展示工具,使用kibana可以比較方便的在圖形界面的執(zhí)行es的curd操作

安裝:https://artifacts.elastic.co/downloads/kibana/kibana-5.4.1-linux-x86_64.tar.gz,下載完后解壓安裝即可
默認是解壓即用,默認會監(jiān)聽本機的9200端口,也就是默認的elasticsearch綁定的端口,如果elasticsearch綁定的端口不是9200,那么kibanan中也要對應的額更改,在集群中任何一個節(jié)點啟動kibana都可以

[root@master config]# kibana
log   [14:16:01.000] [info][status][plugin:kibana@5.4.1] Status changed from uninitialized to green - Ready
log   [14:16:01.141] [info][status][plugin:elasticsearch@5.4.1] Status changed from uninitialized to yellow -   Waiting for Elasticsearch
log   [14:16:01.190] [info][status][plugin:console@5.4.1] Status changed from uninitialized to green - Ready
log   [14:16:01.241] [info][status][plugin:metrics@5.4.1] Status changed from uninitialized to green - Ready
log   [14:16:01.254] [info][status][plugin:elasticsearch@5.4.1] Status changed from yellow to green - Kibana index ready
log   [14:16:01.457] [info][status][plugin:timelion@5.4.1] Status changed from uninitialized to green - Ready
log   [14:16:01.462] [info][listening] Server running at http://master:5601
log   [14:16:01.464] [info][status][ui settings] Status changed from uninitialized to green - Ready

出現(xiàn)上的log表示kibanna啟動并連接elasticsearch成功,可以通過http://master:5601來訪問kibanan

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

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

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