1.修改主站点的elasticsearch.yml添加一下行:
xpack.security.enabled: true
2.生成安全秘钥
切到ES安装目录,执行bin/elasticsearch-certutil ca -out config/elastic-certificates.p12 -pass ""
会在/home/elasticsearch-7.9.3/config目录生成elastic-certificates.p12
3.继续修改ES yml文件
添加以下四行:
xpack.security.transport.ssl.enabled: true
xpack.security.transport.ssl.verification_mode: certificate
xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
4.更新集群节点的配置
把elastic-certificates.p12复制到其他节点的config下,同时修改其他节点的yml。
5.重启ES
6.执行./elasticsearch-setup-passwords interactive,进行密码设置.
7.过程中的问题处理:
7.1 最开始执行完第三步直接执行./elasticsearch-setup-passwords interactive。总是提示“ERROR: Failed to set password for user [apm_system]”