1.修改配置文件elasticsearch.yml
es为我的个人容器名称请按需修改
xpack.security.enabled: true
重启es
docker restart es
2.进入容器内部
docker exec -it es bash
#此处设置可关闭https
xpack.security.http.ssl:
enabled: false
进入容器后执行此命令
elasticsearch-reset-password -u username -i --url https://localhost:9200
下面是更改密过程中的交互
elasticsearch@3549332a5380:~/bin$ elasticsearch-reset-password -u elastic -i --url https://localhost:9200This tool will reset the password of the [elastic] user.
You will be prompted to enter the password.
Please confirm that you would like to continue [y/N]y
Enter password for [elastic]:
Re-enter password for [elastic]:
Passwords do not match.
Try again.
Enter password for [elastic]:
Re-enter password for [elastic]:
Password for the [elastic] user successfully reset
个人完整的文件如下
cluster.name: "docker-cluster"
network.host: 0.0.0.0
#----------------------- BEGIN SECURITY AUTO CONFIGURATION -----------------------
#
# The following settings, TLS certificates, and keys have been automatically
# generated to configure Elasticsearch security features on 22-02-2024 13:23:21
#
# --------------------------------------------------------------------------------
# Enable security features
xpack.security.enabled: true
xpack.security.enrollment.enabled: true
# Enable encryption for HTTP API client connections, such as Kibana, Logstash, and Agents
xpack.security.http.ssl:
enabled: false #关闭https
keystore.path: certs/http.p12
# Enable encryption and mutual authentication between cluster nodes
xpack.security.transport.ssl:
enabled: false
verification_mode: certificate
keystore.path: certs/transport.p12
truststore.path: certs/transport.p12
#----------------------- END SECURITY AUTO CONFIGURATION -------------------------
3. 访问es
访问地址 http://ip:port
按照账号密码输入即可访问
4.kibana配置如下
https://blog.csdn.net/qq_52594679/article/details/136257664?spm=1001.2014.3001.5501