1.啥是X-Pack?
X-Pack是Elastic Stack扩大性能,提供安全性,警报,监督,报告,机器学习和许多其余性能。 ES7.0+之后,默认状况下,当装置Elasticsearch时,会装置X-Pack,无需独自再装置。
- 1、5.X版本之前:没有x-pack,是独立的:security平安,watch查看,alert正告等独立单元。
- 2、5.X版本:对本来的平安,正告,监督,图形和报告做了一个封装,造成了x-pack。
- 3、6.3 版本之前:须要额定装置。
- 4、6.3版本及之后:曾经集成在一起公布,无需额定装置,根底平安属于付费黄金版内容。 7 .1版本:根底平安收费。
自6.8以及7.1+版本之后,根底级平安永恒收费。
根底版本平安性能列表如下:
2.ES配置
2.1集群化配置(docker环境)
1.进入ES docker容器,生成节点证书
借助elasticsearch-certutil命令生成证书
(在elasticsearch目录下执行/usr/share/elasticsearch)
/usr/share/elasticsearch/bin/elasticsearch-certutil.bat ca -out config/elastic-certificates.p12 -pass ""
//-out 指定证书生成门路,-pass 默认无明码
注:只须要应用由同一CA签名的证书,即可主动容许该节点退出集群
2.配置加密通信
启用平安性能后,必须应用TLS来确保节点之间的通信已加密。
在elasticsearch.yml核心新增配置如下:
xpack.security.transport.ssl.enabled: truexpack.security.transport.ssl.verification_mode: certificate xpack.security.transport.ssl.keystore.path: elastic-certificates.p12 xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
具体配置如下:
cluster.name: es-dockernode.name: es-nodenamenetwork.bind_host: 0.0.0.0network.publish_host: ***.***.***.*** ##本机ip地址http.port: 9200 ## 凋谢端口transport.tcp.port: 9300 ##凋谢tcp端口http.cors.enabled: truehttp.cors.allow-origin: "*"xpack.security.enabled: truexpack.security.transport.ssl.enabled: truexpack.security.transport.ssl.verification_mode: certificate xpack.security.transport.ssl.keystore.path: elastic-certificates.p12xpack.security.transport.ssl.truststore.path: elastic-certificates.p12node.master: true node.data: truediscovery.seed_hosts: ["***.***.***.***:9300","elasticsearch2:10293","elasticsearch1:10193"]cluster.initial_master_nodes: ["es-nodename1","es-nodename2","es-nodename3"]
留神:
1.最好将证书与配置文件放在同一目录下
2.生成的这书最好手动赋一下权 chmod 644 *.ca
3.设置集群明码
ES中内置了几个治理其余集成组件的账号即:apm_system
, beats_system
, elastic
, kibana
, logstash_system
, remote_monitoring_user
,应用之前,首先须要增加一下明码:
/bin/elasticsearch-setup-passwords interactive
- interactive:给用户一一设置明码。
- auto:主动生成明码。
留神:必须配置好xpack之后,能力设置明码。否则会报错。
如果这个中央报如下谬误:
Failed to determine the health of the cluster running at http://192.168.3.42:9200Unexpected response code [503] from calling GET http://192.168.3.42:9200/_cluster/health?prettyCause: master_not_discovered_exceptionIt is recommended that you resolve the issues with your cluster before running elasticsearch-setup-passwords.It is very likely that the password changes will fail when run against an unhealthy cluster.Do you want to continue with the password setup process [y/N]y
可能是有脏数据导致,此时能够停掉es,删除 data 数据目录,而后重新启动在进行操作。
4.配置其余节点
- 将配置好的带证书的文件copy到另外的其余节点下,放在同样目录下
- elasticsearch.yml 复制新增配置和配置好的节点一样
- 除了node.name应用各自主机名之外,其余配置都一样。
5.配置实现,重启各个节点
配置结束之后,能够通过如下形式拜访es服务:
curl -XGET -u elastic 'localhost:9200/_xpack/security/user?pretty'curl 127.0.0.1:9200 -u elastic
附录:
https://blog.csdn.net/laoyang...
http://www.eryajf.net/3500.html