코린이의 기록

[Elasticsearch] java.lang.RuntimeException: can not run elasticsearch as root 본문

ELK

[Elasticsearch] java.lang.RuntimeException: can not run elasticsearch as root

코린이예요 2019. 4. 26. 18:25
반응형

root로 elasticsearch를 실행했을때 다음과 같은 error 발생함.

[root@rusdev bin]# ./elasticsearch
[2019-04-26T18:19:52,697][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [rusdev] 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-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-7.0.0.jar:7.0.0]
        at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:115) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:92) ~[elasticsearch-7.0.0.jar:7.0.0]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
        at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:102) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:169) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:325) ~[elasticsearch-7.0.0.jar:7.0.0]
        at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-7.0.0.jar:7.0.0]
        ... 6 more

 

해결방법? 

root가 아닌 다른 계정으로 권한을 주어 elasticsearch 를 실행한다. 

$ chown -R [user]:[user] [elasticsearch path]

 

잘됨

...더보기

[sy.yoon@rusdev elasticsearch-7.0.0]$ bin/elasticsearch
[2019-04-26T18:28:36,732][INFO ][o.e.e.NodeEnvironment    ] [rusdev] using [1] data paths, mounts [[/ (rootfs)]], net usable_space [980.6gb], net total_space [990.5gb], types [rootfs]
[2019-04-26T18:28:36,735][INFO ][o.e.e.NodeEnvironment    ] [rusdev] heap size [990.7mb], compressed ordinary object pointers [true]
[2019-04-26T18:28:36,737][INFO ][o.e.n.Node               ] [rusdev] node name [rusdev], node ID [_qgN1Wq6Tpq5ZPVm-5ISaw]
[2019-04-26T18:28:36,738][INFO ][o.e.n.Node               ] [rusdev] version[7.0.0], pid[207570], build[default/tar/b7e28a7/2019-04-05T22:55:32.697037Z], OS[Linux/3.10.0-957.10.1.el7.x86_64/amd64], JVM[Oracle Corporation/Java HotSpot(TM) 64-Bit Server VM/1.8.0_191/25.191-b12]
[2019-04-26T18:28:36,738][INFO ][o.e.n.Node               ] [rusdev] JVM home [/usr/lib/jvm/jdk1.8.0_191/jre]
[2019-04-26T18:28:36,739][INFO ][o.e.n.Node               ] [rusdev] JVM arguments [-Xms1g, -Xmx1g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -Des.networkaddress.cache.ttl=60, -Des.networkaddress.cache.negative.ttl=10, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -XX:-OmitStackTraceInFastThrow, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Djava.io.tmpdir=/tmp/elasticsearch-3146149207010839875, -XX:+HeapDumpOnOutOfMemoryError, -XX:HeapDumpPath=data, -XX:ErrorFile=logs/hs_err_pid%p.log, -XX:+PrintGCDetails, -XX:+PrintGCDateStamps, -XX:+PrintTenuringDistribution, -XX:+PrintGCApplicationStoppedTime, -Xloggc:logs/gc.log, -XX:+UseGCLogFileRotation, -XX:NumberOfGCLogFiles=32, -XX:GCLogFileSize=64m, -Dio.netty.allocator.type=unpooled, -Des.path.home=/root/ota/elasticsearch-7.0.0, -Des.path.conf=/root/ota/elasticsearch-7.0.0/config, -Des.distribution.flavor=default, -Des.distribution.type=tar, -Des.bundled_jdk=true]
[2019-04-26T18:28:38,538][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [aggs-matrix-stats]
[2019-04-26T18:28:38,539][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [analysis-common]
[2019-04-26T18:28:38,539][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [ingest-common]
[2019-04-26T18:28:38,540][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [ingest-geoip]
[2019-04-26T18:28:38,540][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [ingest-user-agent]
[2019-04-26T18:28:38,540][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [lang-expression]
[2019-04-26T18:28:38,541][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [lang-mustache]
[2019-04-26T18:28:38,541][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [lang-painless]
[2019-04-26T18:28:38,541][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [mapper-extras]
[2019-04-26T18:28:38,541][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [parent-join]
[2019-04-26T18:28:38,542][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [percolator]
[2019-04-26T18:28:38,542][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [rank-eval]
[2019-04-26T18:28:38,542][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [reindex]
[2019-04-26T18:28:38,543][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [repository-url]
[2019-04-26T18:28:38,543][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [transport-netty4]
[2019-04-26T18:28:38,543][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-ccr]
[2019-04-26T18:28:38,544][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-core]
[2019-04-26T18:28:38,544][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-deprecation]
[2019-04-26T18:28:38,544][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-graph]
[2019-04-26T18:28:38,545][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-ilm]
[2019-04-26T18:28:38,545][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-logstash]
[2019-04-26T18:28:38,545][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-ml]
[2019-04-26T18:28:38,546][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-monitoring]
[2019-04-26T18:28:38,546][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-rollup]
[2019-04-26T18:28:38,546][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-security]
[2019-04-26T18:28:38,546][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-sql]
[2019-04-26T18:28:38,547][INFO ][o.e.p.PluginsService     ] [rusdev] loaded module [x-pack-watcher]
[2019-04-26T18:28:38,547][INFO ][o.e.p.PluginsService     ] [rusdev] no plugins loaded
[2019-04-26T18:28:42,515][INFO ][o.e.x.s.a.s.FileRolesStore] [rusdev] parsed [0] roles from file [/root/ota/elasticsearch-7.0.0/config/roles.yml]
[2019-04-26T18:28:43,088][INFO ][o.e.x.m.p.l.CppLogMessageHandler] [rusdev] [controller/207646] [Main.cc@109] controller (64 bit): Version 7.0.0 (Build cdaa022645f38d) Copyright (c) 2019 Elasticsearch BV
[2019-04-26T18:28:43,526][DEBUG][o.e.a.ActionModule       ] [rusdev] Using REST wrapper from plugin org.elasticsearch.xpack.security.Security
[2019-04-26T18:28:43,862][INFO ][o.e.d.DiscoveryModule    ] [rusdev] using discovery type [zen] and seed hosts providers [settings]
[2019-04-26T18:28:44,806][INFO ][o.e.n.Node               ] [rusdev] initialized
[2019-04-26T18:28:44,807][INFO ][o.e.n.Node               ] [rusdev] starting ...
[2019-04-26T18:28:44,968][INFO ][o.e.t.TransportService   ] [rusdev] publish_address {127.0.0.1:9300}, bound_addresses {[::1]:9300}, {127.0.0.1:9300}
[2019-04-26T18:28:44,980][WARN ][o.e.b.BootstrapChecks    ] [rusdev] max file descriptors [4096] for elasticsearch process is too low, increase to at least [65535]
[2019-04-26T18:28:44,981][WARN ][o.e.b.BootstrapChecks    ] [rusdev] 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
[2019-04-26T18:28:44,998][INFO ][o.e.c.c.ClusterBootstrapService] [rusdev] no discovery configuration found, will perform best-effort cluster bootstrapping after [3s] unless existing master is discovered
[2019-04-26T18:28:48,005][INFO ][o.e.c.c.Coordinator      ] [rusdev] setting initial configuration to VotingConfiguration{_qgN1Wq6Tpq5ZPVm-5ISaw}
[2019-04-26T18:28:48,184][INFO ][o.e.c.s.MasterService    ] [rusdev] elected-as-master ([1] nodes joined)[{rusdev}{_qgN1Wq6Tpq5ZPVm-5ISaw}{RmQLKhjtTKSRVx86wUq-SQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=8164311040, xpack.installed=true, ml.max_open_jobs=20} elect leader, _BECOME_MASTER_TASK_, _FINISH_ELECTION_], term: 1, version: 1, reason: master node changed {previous [], current [{rusdev}{_qgN1Wq6Tpq5ZPVm-5ISaw}{RmQLKhjtTKSRVx86wUq-SQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=8164311040, xpack.installed=true, ml.max_open_jobs=20}]}
[2019-04-26T18:28:48,245][INFO ][o.e.c.s.ClusterApplierService] [rusdev] master node changed {previous [], current [{rusdev}{_qgN1Wq6Tpq5ZPVm-5ISaw}{RmQLKhjtTKSRVx86wUq-SQ}{127.0.0.1}{127.0.0.1:9300}{ml.machine_memory=8164311040, xpack.installed=true, ml.max_open_jobs=20}]}, term: 1, version: 1, reason: Publication{term=1, version=1}
[2019-04-26T18:28:48,284][INFO ][o.e.h.AbstractHttpServerTransport] [rusdev] publish_address {127.0.0.1:9200}, bound_addresses {[::1]:9200}, {127.0.0.1:9200}
[2019-04-26T18:28:48,285][INFO ][o.e.n.Node               ] [rusdev] started
[2019-04-26T18:28:48,297][WARN ][o.e.x.s.a.s.m.NativeRoleMappingStore] [rusdev] Failed to clear cache for realms [[]]
[2019-04-26T18:28:48,339][INFO ][o.e.g.GatewayService     ] [rusdev] recovered [0] indices into cluster_state
[2019-04-26T18:28:48,489][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.triggered_watches] for index patterns [.triggered_watches*]
[2019-04-26T18:28:48,523][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.watches] for index patterns [.watches*]
[2019-04-26T18:28:48,570][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.watch-history-9] for index patterns [.watcher-history-9*]
[2019-04-26T18:28:48,612][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.monitoring-logstash] for index patterns [.monitoring-logstash-7-*]
[2019-04-26T18:28:48,653][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.monitoring-es] for index patterns [.monitoring-es-7-*]
[2019-04-26T18:28:48,705][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.monitoring-beats] for index patterns [.monitoring-beats-7-*]
[2019-04-26T18:28:48,731][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.monitoring-alerts-7] for index patterns [.monitoring-alerts-7]
[2019-04-26T18:28:48,758][INFO ][o.e.c.m.MetaDataIndexTemplateService] [rusdev] adding template [.monitoring-kibana] for index patterns [.monitoring-kibana-7-*]
[2019-04-26T18:28:48,877][INFO ][o.e.l.LicenseService     ] [rusdev] license [f018de76-afdd-4f73-b022-81ad0f4208a8] mode [basic] - valid
[2019-04-26T18:28:48,883][INFO ][o.e.x.i.a.TransportPutLifecycleAction] [rusdev] adding index lifecycle policy [watch-history-ilm-policy]
^C[2019-04-26T18:37:35,210][INFO ][o.e.x.m.p.NativeController] [rusdev] Native controller process has stopped - no new native processes can be started

반응형
Comments