天天看點

ElasticSearch 啟動時異常及其解決方案

ElasticSearch 啟動時異常及其解決方案

問題一:max file descriptors [4096] for elasticsearch process is too low, increase to at least [65536]

問題詳情

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

解決方案

# 每個程序最大同時打開檔案數太小,可通過下面2個指令檢視目前數量
ulimit -Hn
ulimit -Sn
# 修改/etc/security/limits.conf檔案,增加配置,使用者退出後重新登入生效
*               soft    nofile          65536
*               hard    nofile          65536      

如圖

ElasticSearch 啟動時異常及其解決方案

問題二:max number of threads [3818] for user [es] is too low, increase to at least [4096]

max number of threads [3818] for user [es] is too low, increase to at least [4096]      
# 最大線程個數太低。可通過指令檢視
ulimit -Hu
ulimit -Su
# 修改/etc/security/limits.conf檔案,增加配置,使用者退出後重新登入生效
*               soft    nproc           4096
*               hard    nproc           4096      
ElasticSearch 啟動時異常及其解決方案

問題三:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]      
# 修改/etc/sysctl.conf檔案,增加配置vm.max_map_count=262144
# 編輯
vim /etc/sysctl.conf
# 配置
vm.max_map_count=262144
# 生效
sysctl -p      
ElasticSearch 啟動時異常及其解決方案

問題四:[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured

[1]: the default discovery settings are unsuitable for production use; at least one of [discovery.seed_hosts, discovery.seed_providers, cluster.initial_master_nodes] must be configured      
# 修改 config/elasticsearch.yml 取消注釋保留一個節點即可
cluster.initial_master_nodes: ["node-1"]      
ElasticSearch 啟動時異常及其解決方案

問題五:Exception in thread “main” java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-6.2.2-1/config/jvm.options

Exception in thread "main" java.nio.file.AccessDeniedException: /usr/local/elasticsearch/elasticsearch-6.2.2-1/config/jvm.options      
# ElasticSearch 不支援使用 root 權限運作,需要建立一個使用者并授權 ES 目錄給這個使用者
# 添加使用者
useradd elk
# 給使用者設定密碼
passwd elk
# 更改目錄所有者
chown -R elk /usr/local/apps/es/
# 目錄下檔案權限配置
chmod -R 755 /usr/local/apps/es/
# 切換 elk 使用者
su elk
# 執行 bin/elasticsearch 即可
./bin/elasticsearch      

問題六:本地通過 ip:9200 通路不到 elasticsearch 服務

本地通過ip:9200通路不到elasticsearch服務      
# 修改 config/elasticsearch.yml 
network.host: 0.0.0.0      
ElasticSearch 啟動時異常及其解決方案

繼續閱讀