参考官方文档
https://www.elastic.co/cn/blog/getting-started-with-elasticsearch-security
步骤 1:在 Elasticsearch 主节点上配置 TLS
cd /usr/local/es-m-80/elasticsearch-7.6.2/
bin/elasticsearch-certutil cert -out config/elastic-certificates.p12 -pass ""
执行完成之后
vim config/elasticsearch.yaml
xpack.security.enabled: truexpack.security.transport.ssl.enabled: truexpack.security.transport.ssl.verification_mode: certificatexpack.security.transport.ssl.keystore.path: elastic-certificates.p12xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
步骤 2:将生成的config/elastic-certificates.p12复制到其他ES节点上
将config/elastic-certificates.p12复制到所有的es节点上,并在elasticsearch.yaml添加好xpack的配置
步骤 3:启动所有的ES节点(重要)
下一步应该是到了配置密码的部分,根据官方的文档,我只启动了主节点,es的集群状态为RED,无法使用 bin/elasticsearch-setup-passwords auto ,连接超时
启动所有的es节点
bin/elasticsearch -d #非root用户
然后在主节点执行
bin/elasticsearch-setup-passwords auto #系统自动设置密码bin/elasticsearch-setup-passwords interactive #用户自行设置密码