centos7安装elastic search6

1.下载es

2.上传至centos7,解压

# tar -zxvf elasticsearch-6.8.9.tar.gz
# elasticsearch-6.8.9/bin/elasticsearch

报错,原因:不能用root用户启动。

[2020-06-01T16:21:48,614][WARN ][o.e.b.ElasticsearchUncaughtExceptionHandler] [unknown] 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.8.9.jar:6.8.9]
	at org.elasticsearch.bootstrap.Elasticsearch.execute(Elasticsearch.java:150) ~[elasticsearch-6.8.9.jar:6.8.9]
	at org.elasticsearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:86) ~[elasticsearch-6.8.9.jar:6.8.9]
	at org.elasticsearch.cli.Command.mainWithoutErrorHandling(Command.java:124) ~[elasticsearch-cli-6.8.9.jar:6.8.9]
	at org.elasticsearch.cli.Command.main(Command.java:90) ~[elasticsearch-cli-6.8.9.jar:6.8.9]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:116) ~[elasticsearch-6.8.9.jar:6.8.9]
	at org.elasticsearch.bootstrap.Elasticsearch.main(Elasticsearch.java:93) ~[elasticsearch-6.8.9.jar:6.8.9]
Caused by: java.lang.RuntimeException: can not run elasticsearch as root
	at org.elasticsearch.bootstrap.Bootstrap.initializeNatives(Bootstrap.java:103) ~[elasticsearch-6.8.9.jar:6.8.9]
	at org.elasticsearch.bootstrap.Bootstrap.setup(Bootstrap.java:170) ~[elasticsearch-6.8.9.jar:6.8.9]
	at org.elasticsearch.bootstrap.Bootstrap.init(Bootstrap.java:333) ~[elasticsearch-6.8.9.jar:6.8.9]
	at org.elasticsearch.bootstrap.Elasticsearch.init(Elasticsearch.java:159) ~[elasticsearch-6.8.9.jar:6.8.9]
	... 6 more

新增es用户,添加用户组

#groupadd esgroup

添加用户

#useradd es -g esgroup-p esuser

授予es用户、用户组权限

#chown es:esgroup -R /home/elasticsearch-6.8.9/

切换至es用户

#su es

再启动elastic search

$elasticsearch-6.8.9/bin/elasticsearch

本机执行以下命令,返回数据则说明启动成功:

curl localhost:9200

centos7安装elastic search6_第1张图片

你可能感兴趣的:(环境配置,elasticsearch)