安裝elasticsearch碰到的坑
阿新 • • 發佈:2019-01-06
centos環境,下載就不說了,跑起來的時候報下面的錯
bin/elasticsearch
Exception in thread "main" java.lang.RuntimeException: don't run elasticsearch as root.
at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:93)
at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:144)
at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:285)
at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:35)
Refer to the log for complete error details.
這是禁止以root賬戶啟動,然後建立其他賬號,su切換賬號,就報另一個錯
bin/elasticsearch: line 78: cd: bin/..: Not a directory
Error: Could not find or load main class org.elasticsearch.bootstrap.Elasticsearch
原因是該賬號不是root許可權,無法cd到指定目錄,多半是你把程式解壓在了/root/目錄下,隨便移動到其他位置即可,我移動到了/opt/下面一切正常,有人說使用如下命令解決,自己玩可以,但是生產環境千萬別這麼做,安全問題可想而知啊
bin/elasticsearch -Des.insecure.allow.root=true (強制執行root執行)