1 root使用者啟動elasticsearch報錯
Elasticsearch為了安全考慮,不讓使用root啟動,解決方法建立一個使用者,用此使用者進行相關的操作。如果你用root啟動,會出現“java.lang.RuntimeException: can not runelasticsearch as root”錯誤,具體如下所示:
2、max file descriptors過小
錯誤“max file descriptors [65535] for elasticsearchprocess is too low, increase to at least [65536]”,maxfile descriptors為最大檔案描述符,設定其大于65536即可。解決方法是修改/etc/security/limits.conf檔案,添加“* - nofile65536 * - memlock unlimited”,“*”表示給所有使用者起作用,修改後的配置如下圖所示:
3、max number of threads [1024] for user [sp_ctpsp] is too low, increase to at least [4096]
vim /etc/security/limits.conf 修改或添加 * hard nproc 4096
vim /etc/security/limits.d/90-nproc.conf 将内容改為:* soft nproc 4096
4、max virtual memory areas vm.max_map_count [65530]is too low, increase to at least [262144]
root 使用者 vim /etc/sysctl.conf 添加配置:vm.max_map_count=262144
然後執行 sysctl -p
5、elasticsearch liuix 啟動服務後ctrl+c 不退出服務
./elasticsearch -d