Elasticsearch 7.17.7开启x-pack
1、ES配置文件 elasticsearch.yml
cluster.name: elasticsearch node.name: node-1 network.host: 0.0.0.0 discovery.type: single-node xpack.security.enabled: true xpack.security.authc.api_key.enabled: true
设置密码
/usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto
会自动生成如下用户和密码
root@elasticsearch-697f4c8c45-krt7k:/usr/share/elasticsearch# /usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,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]y Changed password for user apm_system PASSWORD apm_system = OB6f54oQZTAd74ubeUxv Changed password for user kibana_system PASSWORD kibana_system = hMH0FJAY7k9gM0s7bBMo Changed password for user kibana PASSWORD kibana = hMH0FJAY7k9gM0s7bBMo Changed password for user logstash_system PASSWORD logstash_system = GNjqezeT1hHMyw48Su9A Changed password for user beats_system PASSWORD beats_system = x7BGxM1gEDrykk2ta2VC Changed password for user remote_monitoring_user PASSWORD remote_monitoring_user = UphcqzU1fwhrfmozs4C8 Changed password for user elastic PASSWORD elastic = nMfGsArWmSNMCsFlXwRE
其中
kibana用户:配置为kibana配置文件
elastic用户:做登录认证
2、kibana.yml
elasticsearch.hosts: http://elasticsearch:9200 elasticsearch.username: "kibana" elasticsearch.password: "YdL4LTq8xrLKA9yp5VuG" i18n.locale: zh-CN server.host: "0" server.name: kibana