四,创建Elasticsearch集群
在另外两台服务器上安装elasticsearch-7.2.0-x86_64.rpm
软件包,将master节点上的/etc/elasticsearch/elastic-certificates.p12
文件拷贝到另外两个节点的相同目录
master-node3配置:
cluster.name: test #集群名称
node.name: node3 #节点名称
path.data: /var/lib/elasticsearch #数据目录
path.logs: /var/log/elasticsearch #日志目录
path.repo: /var/log/elasticsearch
network.host: 192.168.1.223 #ip地址
http.port: 9200 #监听端口
discovery.seed_hosts: ["node3", "node4", "node5"] #集群节点发现名称
cluster.initial_master_nodes: ["node3"] #master节点
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
node4、node5配置参考:
cluster.name: test #集群名称
node.name: node4 #节点名称
path.data: /var/lib/elasticsearch #数据目录
path.logs: /var/log/elasticsearch #日志目录
path.repo: /var/log/elasticsearch
network.host: 192.168.1.224 #ip地址
http.port: 9200 #监听端口
discovery.seed_hosts: ["node3", "node4", "node5"] #集群节点发现名称
cluster.initial_master_nodes: ["node3"] #master节点
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
查询集群状态
curl -u elastic:密码@2019 http://192.168.1.223:9200/_cluster/health?pretty
{
"cluster_name" : "test",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 3, #节点数量3个
"number_of_data_nodes" : 3, #存储数据节点3个
"active_primary_shards" : 118,
"active_shards" : 236,
"relocating_shards" : 0,
"initializing_shards" : 0,
"unassigned_shards" : 0,
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0,
"task_max_waiting_in_queue_millis" : 0,
"active_shards_percent_as_number" : 100.0
}