Elasticsearch 7.12 启用 x-pack 组件
阅读原文时间:2023年07月09日阅读:1

文章目录

首先,你要有一套es,关于es的部署,可以看我的另一篇博客
ELK-EFK-v7.12.0日志平台部署

$ ./bin/elasticsearch-plugin install x-pack
-> Installing x-pack
-> Failed installing x-pack
ERROR: this distribution of Elasticsearch contains X-Pack by default

这里可以看到,es 7.12版本默认是包含x-pack了,不需要像之前的版本安装了

$ cp config/elasticsearch.yml{,.bak}     '良好的备份习惯,可以有效减少跑路的次数'
$ vim config/elasticsearch.yml           '加入下面的参数,然后重启es'
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate

auto 随机生成一个密码

interactive 自定义密码

$ ./bin/elasticsearch-setup-passwords interactive


Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm that you would like to continue [y/N]y

Enter password for [elastic]:                     # 输入 elastic 用户的密码
Reenter password for [elastic]:                   # 确认 elastic 用户的密码
Enter password for [apm_system]:                  # 输入 apm_system 用户的密码
Reenter password for [apm_system]:                # 确认 apm_system 用户的密码
Enter password for [kibana_system]:               # 输入 kibana_system 用户的密码
Reenter password for [kibana_system]:             # 确认 kibana_system 用户的密码
Enter password for [logstash_system]:             # 输入 logstash_system 用户的密码
Reenter password for [logstash_system]:           # 确认 logstash_system 用户的密码
Enter password for [beats_system]:                # 输入 beats_system 用户的密码
Reenter password for [beats_system]:              # 确认 beats_system 用户的密码
Enter password for [remote_monitoring_user]:      # 输入 remote_monitoring_user 用户的密码
Reenter password for [remote_monitoring_user]:    # 确认 remote_monitoring_user 用户的密码
Changed password for user [apm_system]
Changed password for user [kibana_system]
Changed password for user [kibana]
Changed password for user [logstash_system]
Changed password for user [beats_system]
Changed password for user [remote_monitoring_user]
Changed password for user [elastic]

-u 表示使用的用户

$ curl -XGET -u elastic "http://192.168.145.154:9200/_cat/nodes"
Enter host password for user 'elastic':   # 这里输入之前设定的密码,密码不是明文显示的
192.168.145.154 52 67 3 0.00 0.15 0.23 cdfhilmrstw * node-1