elasticsearch7.10版配置X-PACK
·
在非root用户下进入/home/es/elasticsearch-7.10.0目录
1、为集群创建认证机构
文件根目录下执行
bin/elasticsearch-certutil ca
依次输入回车(文件使用默认名),密码
2、为节点颁发证书
之后执行
bin/elasticsearch-certutil cert --ca elastic-stack-ca.p12
依次输入上一个步骤的密码。回车(文件使用默认名),密码(建议与上一步密码相同)
执行
bin/elasticsearch-keystore add xpack.security.transport.ssl.keystore.secure_password
并输入第一步输入的密码
执行
bin/elasticsearch-keystore add xpack.security.transport.ssl.truststore.secure_password
并输入第一步输入的密码
3、多节点配置
将生成的elastic-certificates.p12、elastic-stack-ca.p12文件mv到config目录下,并连同elasticsearch.keystore 文件 scp到其他节点(ip/hosts映射)的config目录中。
scp elastic-certificates.p12 elasticsearch.keystore elastic-stack-ca.p12 root@node1:/opt/es/elasticsearch-7.10.0/config/
4、修改配置
在elasticsearch-7.10.0/config/elasticsearch.yml中增加一下配置,启用x-pack安全组件,启用ssl加密通信,并且配置认证证书:
#---------------------security------------------
#
xpack.security.enabled: true
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
#
配置修改完成后,重启es服务,重启成功后
http://localhost:9200/ 访问Es服务要输入用户名和密码
5、 密码设置
通过设置访问密码,这是elastic用户和其他一些系统内置用户的密码
bin/elasticsearch-setup-passwords interactive
设置成功后,可以通过用户名密码访问es服务:
http://localhost:9200/ 访问Es服务,输入配置的用户名和密码
{
"name" : "node1",
"cluster_name" : "elk",
"cluster_uuid" : "0uVfS_JpSGa4nTuEFN0RHg",
"version" : {
"number" : "7.10.0",
"build_flavor" : "default",
"build_type" : "tar",
"build_hash" : "51e9d6f22758d0374a0f3f5c6e8f3a7997850f96",
"build_date" : "2020-11-09T21:30:33.964949Z",
"build_snapshot" : false,
"lucene_version" : "8.7.0",
"minimum_wire_compatibility_version" : "6.8.0",
"minimum_index_compatibility_version" : "6.0.0-beta1"
},
"tagline" : "You Know, for Search"
}
6、配置kibana访问密码
注意:8.0版本之后,设置kibana.yml访问es的用户名 不能使用"elastic"账户名
不要在kibana.yml配置文件里面配置es访问的用户密码明文,需要通过keystore配置加密的用户名密码信息,具体如下:
kibana-7.10.0-linux-x86_64/bin
#创建keystore
./kibana-keystore create
#设置kibana访问es的用户名
./kibana-keystore add elasticsearch.username
#设置kibana访问es的密码
./kibana-keystore add elasticsearch.password
更多推荐
所有评论(0)