Elasticsearch集羣安裝部署過程中遇到的問題

一、問題:

[2019-01-12T15:55:55,433][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

臨時提高了vm.max_map_count的大小,此操作需要root權限:

sudo  sysctl -w vm.max_map_count=262144
sysctl -a|grep vm.max_map_count

永久修改vm.max_map_count:
解決:切換到root用戶修改配置sysctl.conf

vim /etc/sysctl.conf 

添加下面配置:
vm.max_map_count=655360
並執行命令:
sysctl -p
然後,重新啓動elasticsearch,即可啓動成功。

二、問題:

2019-01-12T16:12:22,404][INFO ][o.e.b.BootstrapCheck     ] [SfD5sIh] bound or publishing to a non-loopback or non-link-local address, enforcing bootstrap checks
ERROR: bootstrap checks failed
initial heap size [536870912] not equal to maximum heap size [1073741824]; this can cause resize pauses and prevents mlockall from locking the entire heap

解決方法:

vim config/jvm.options

-Xms 和 -Xmx需要配置的相等,不然無法啓動成功。
-Xms1024m -Xmx1024m

max file descriptors [65535] for elasticsearch process is too low, increase to at least [65536]

編輯/etc/security/limits.conf配置文件

* soft nofile 65536
* hard nofile 131072
* soft nproc 2048
* hard nproc 4096

三、問題:

max number of threads [1024] for user [elasticsearch] is too low, increase to at least [2048]

修改 /etc/security/limits.d/90-nproc.conf

*          soft    nproc     1024

*          soft    nproc     2048

四、問題:

system call filters failed to install; check the logs and fix your configuration or disable system call filters at your own risk
Your kernel does not support seccomp. 
Elasticsearch attempts to utilize seccomp by default (via the setting bootstrap.system_call_filter).
Starting in 5.2.0, if you’re in production mode, bootstrap.system_call_filter is enabled, and initializing seccomp fails, then Elasticsearch will refuse to bootstrap. 
You either have to migrate to a kernel that supports seccomp, or disable bootstrap.system_call_filter.

Centos6不支持SecComp,而ES5.2.0默認bootstrap.system_call_filter爲true
禁用:在elasticsearch.yml中配置bootstrap.system_call_filter爲false,注意要在Memory下面:

bootstrap.memory_lock: false 
bootstrap.system_call_filter: false

五、部署

1、解壓已打包文件,解壓出節點文件夾
2、根據需求複製索引節點,一般包含:

195 數據節點:修改config/elasticsearch.yml配置文件內參數爲 ( node.master:false)( node.data:true )

194 主節點:修改config/elasticsearch.yml配置文件內參數爲 ( node.master:true)( node.data:false )

193 負載節點:修改config/elasticsearch.yml配置文件內參數爲 ( node.master:false)( node.data:false )

3、修改配置文件config/elasticsearch.yml

索引名稱:cluster.name(自定義,默認不用修改)

節點名稱:node.name(自定義,各節點名稱請勿重複,一般格式爲:note-端口)

數據目錄:path.data (自定義路徑)

日誌目錄:path.logs (默認)

鎖定物理內存:bootstrap.memory_lock、bootstrap.systems_call_fiter(系統是否支持,默認關閉)
網關IP:network.host(默認0.0.0.0,可根據需求自定義修改)

HTTP端口:http.port (自定義,每個節點端口請勿重複)

TCP節點內部交互端口:transport.tcp.port(自定義,每個節點端口請勿重複)

集羣TCP地址:discovery.zen.ping.unicast.hosts(每個節點IP:TCP端口)

4、修改內存文件jvm.options ,最大最小內存設置數值一樣,內存分配一般爲服務器內存一半,如果服務器內存超大,可多部署節點,分配內存最好不超過32g。

-Xms32g
-Xms32g

六、創建用戶啓動

創建elsearch用戶組及elsearch用戶

groupadd es
useradd es -g es -p es

更改elasticsearch-10006文件夾及內部文件的所屬用戶及組爲elsearch:elsearch

chown -R es:es   elasticsearch-10006

切換es用戶
進入bin目錄啓動,執行以下命令啓動

./elasticsearch -d

七、通過索引url查看機器狀態。

1、查看各節點使用狀態:

curl -XGET http://IP:端口/_cat/nodes?v&h=host,heap.current,heap.percent,heap.max,ram.max,disk.avail,node.role,*

2、查詢各索引使用狀態:

curl -XGET http://IP:端口/_cat/indices?v
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章