Elasticsearch 시작 실패: 루트로 elasticsearch를 실행할 수 없습니다.

상황을 잘못 보고하다


Linux 환경에서 Elasticsearch를 시작하면 오류가 발생합니다.
[root@dev-es bin]# ./elasticsearch
[2020-08-07T12:11:07,538][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [xmgl-dev-es-3-90] uncaught exception in thread [main]
org.elasticsearch.bootstrap.StartupException: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:163) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.6.2.jar:6.6.2]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.6.2.jar:6.6.2]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.6.2.jar:6.6.2]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.6.2.jar:6.6.2]
        ... 6 more

왜냐하면 Elasticsearch 5.X 이후 보안을 위해 루트 사용자로 시작할 수 없습니다. 루트 사용자가 아닌 사용자로 시작해야 합니다.

해결 방법

  • 새 사용자를 만듭니다useradd es
  • 새 사용자에게 권한을 부여합니다chown -R es.es elasticsearch-6.6.0
  • bin 디렉터리에 들어가서 명령을 사용합니다./elasticsearch -d 시작
  • 좋은 웹페이지 즐겨찾기