错误详情
错误原因
root用户启动es7.4.0被拒绝,其他版本类似.
es 因为安全问题拒绝使用root用户启动
解决方案
添加用户组es,及用户es 密码password
给用户es:es添加指定目录拥有权限
groupadd es
useradd es -g es -p password # -g 指定组 -p 指定密码
chown -R es:es elasticsearch-7.4.0/ # -R : 处理指定目录下的所有文件
切换到用户,并执行elasticsearch
su es
cd elasticsearch-7.4.0/bin
./elasticsearch
./elasticsearch -d # 后台方式启动
成功运行
[es@localhost ~]$ lsof -i:9200
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
java 59772 es 208u IPv6 5185436 0t0 TCP localhost:wap-wsp (LISTEN)
java 59772 es 209u IPv6 5185437 0t0 TCP localhost:wap-wsp (LISTEN)
[es@localhost ~]$ curl 127.0.0.1:9200
{
"name" : "localhost.localdomain",
"cluster_name" : "elasticsearch",
"cluster_uuid" : "i0JcrWyeT6WMqw-VV_SzjQ",
"version" : {
"number" : "7.4.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "22e1767283e61a198cb4db791ea66e3f11ab9910",
"build_date" : "2019-09-27T08:36:48.569419Z",
"build_snapshot" : false,
"lucene_version" : "8.2.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}