设置ElasticSearch的用户名和密码,禁止非法用户访问。
elasticsearch-6.5.1
kibana-6.5.1-linux-x86_64
curl -H “Content-Type:application/json” -XPOST ${ip}:9200/_xpack/license/start_trial?acknowledge=true
abled: true
abled: true
s.allow-origin: “*”
s.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
执行./elasticsearch-setup-passwords auto,出现以下内容:
Your cluster health is currently RED.
This means that some cluster data is unavailable and your cluster is not fully functional.It is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords.
It is very likely that the password changes will fail when run against an unhealthy cluster.Do you want to continue with the password setup process [y/N]yInitiating the setup of passwords for reserved users elastic,apm_system,kibana,logstash_system,beats_system,remote_monitoring_user.
The passwords will be randomly generated and printed to the console.
Please confirm that you would like to continue [y/N]yChanged password for user apm_system
PASSWORD apm_system = sBDDWGcsyU0TBAU06XfCChanged password for user kibana
PASSWORD kibana = oR9c9ukI4PxEU96G3wALChanged password for user logstash_system
PASSWORD logstash_system = yEWme53Vus5161arv2IUChanged password for user beats_system
PASSWORD beats_system = f9tz8kr1wUWdxkTV3JlAChanged password for user remote_monitoring_user
PASSWORD remote_monitoring_user = AuImHAVfsqnqptCv7L7xChanged password for user elastic
PASSWORD elastic = hE2ZIl3DP8T5ZBU9o4u7
执行 curl -XPOST ${ip}:9200/_xpack/security/user/elastic/_password?pretty -H “Content-Type:application/json” -d ‘{ “password” : “your password”}’ -u elastic
输入上边生成的密码:hE2ZIl3DP8T5ZBU9o4u7
执行完后出现以下结果代表修改成功
Enter host password for user ‘elastic’:
{ }
elasticsearch.username: “elastic”
elasticsearch.password: “your password”
登录kibana,输入es的用户名和密码,可以查看当前用户和添加/修改用户信息。
stop.sh脚本
#!/bin/bash
ps -ef |grep Elasticsearch |grep -v grep
pid=`ps -ef |grep Elasticsearch |grep -v grep |awk '{print $2}'`
if [ -z $pid ]; then
echo
else
kill -9 $pid
fi
start.sh脚本
#!/bin/bash
su elk -l -c "cd /{dir}/elasticsearch-6.5.1/bin && ./elasticsearch -d"
es的验证信息是保存到本地文件的,和数据目录一样。所以,如果需要重新部署环境,把数据目录删除,然后按照上述步骤重新设置验证信息即可。
本文发布于:2024-01-29 00:48:25,感谢您对本站的认可!
本文链接:https://www.4u4v.net/it/170646050811509.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
留言与评论(共有 0 条评论) |