赞
踩
- #进入es容器
- docker exec -it es /bin/bash
- # 生成ca
- ./bin/elasticsearch-certutil ca
注:两个红方框位置直接回车
- # 再生成cert
- ./bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
注:前两个红框直接回车,第三个红框可以直接回车,也可以输入证书密码
- # 查看两个证书
- ls
exit
- # 进入es的config文件夹
- mkdir -p /data/es/single/config && cd /data/es/single/config
-
- # 拷贝容器证书
- docker cp es:/usr/share/elasticsearch/elastic-certificates.p12 ./
-
- # 授权证书
- chmod 777 elastic-certificates.p12
vi elasticsearch.yml
- network.host: 0.0.0.0
- xpack.security.enabled: true
- xpack.security.transport.ssl.enabled: true
- xpack.security.transport.ssl.keystore.type: PKCS12
- xpack.security.transport.ssl.verification_mode: certificate
- xpack.security.transport.ssl.keystore.path: /usr/share/elasticsearch/config/elastic-certificates.p12
- xpack.security.transport.ssl.truststore.path: /usr/share/elasticsearch/config/elastic-certificates.p12
- xpack.security.transport.ssl.truststore.type: PKCS12
-
- xpack.security.audit.enabled: true
- # 进入文件目录
- cd /data/es/single
-
- # 添加两行
- - /data/es/single/config/elastic-certificates.p12:/usr/share/elasticsearch/config/elastic-certificates.p12
- - /data/es/single/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
- # docker-compose关闭es容器
- docker-compose down
-
- # docker-compose开启es容器
- docker-compose up -d
- # 进入es容器
- docker exec -it es /bin/bash
-
- # 设置密码(账号默认为 elastic)
- ./bin/elasticsearch-setup-passwords interactive
注:密码可设置为同一个密码,容易记住
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。