②.ES集群搭建
192.168.1.246 node1
192.168.1.247 node2
192.168.1.248 node3
搭建集群
所有节点安装elasticsearch
[root@es2 ~]# rpm -ivh elasticsearch-7.4.0-x86_64.rpm
warning: elasticsearch-7.4.0-x86_64.rpm: Header V4 RSA/SHA512 Signature, key ID d88e42b4: NOKEY
Preparing... ################################# [100%]
Creating elasticsearch group... OK
Creating elasticsearch user... OK
Updating / installing...
1:elasticsearch-0:7.4.0-1 ################################# [100%]
### NOT starting on installation, please execute the following statements to configure elasticsearch service to start automatically using systemd
sudo systemctl daemon-reload
sudo systemctl enable elasticsearch.service
### You can start elasticsearch service by executing
sudo systemctl start elasticsearch.service
Created elasticsearch keystore in /etc/elasticsearch
node1
[root@java ~]# grep ^[a-Z] /etc/elasticsearch/elasticsearch.yml
cluster.name: rstx_es
node.name: node1
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.1.247", "192.168.1.248","192.168.1.246"]
cluster.initial_master_nodes: ["192.168.1.246", "192.168.1.247","192.168.1.248"]
node2
[root@es2 ~]# grep ^[a-Z] /etc/elasticsearch/elasticsearch.yml
cluster.name: rstx_es
node.name: node2
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.1.247", "192.168.1.248","192.168.1.246"]
cluster.initial_master_nodes: ["192.168.1.246", "192.168.1.247","192.168.1.248"]
node3
[root@es3 ~]# grep ^[a-Z] /etc/elasticsearch/elasticsearch.yml
cluster.name: rstx_es
node.name: node3
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.1.247", "192.168.1.248","192.168.1.246"]
cluster.initial_master_nodes: ["192.168.1.246", "192.168.1.247","192.168.1.248"]
所有节点启动服务
[root@es2 ~]# systemctl enable elasticsearch.service
Created symlink from /etc/systemd/system/multi-user.target.wants/elasticsearch.service to /usr/lib/systemd/system/elasticsearch.service.
[root@es2 ~]# systemctl start elasticsearch.service
检查节点
curl
[root@es2 ~]# curl http://192.168.1.247:9200/_cluster/health?pretty
{
"cluster_name" : "rstx_es",
"status" : "green",
"timed_out" : false,
"number_of_nodes" : 2,
"number_of_data_nodes" : 2,
"active_primary_shards" : 0,
"active_shards" : 0,
"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
}
kibana
GET /_cluster/health
elasticsearch 检查es集群状态
cerebro 插件检查es集群状态
1.安装cerebro
wget https://github.com/lmenezes/cerebro/releases/download/v0.9.4/cerebro-0.9.4-1.noarch.rpm
[root@rstx-53 ~]# vim /etc/cerebro/application.conf
data.path = "/tmp/cerebro.db"
[root@rstx-53 ~]# systemctl enable cerebro
[root@rstx-53 ~]# systemctl start cerebro
2.访问
http://192.168.1.53:9000