部署es集群架构

服务器规划

elk1:
	IP:192.168.121.21
	system:Ubuntu22.04
elk2:
	IP:192.168.121.22
	system:Ubuntu22.04
elk3:
	IP:192.168.121.23
	system:Ubuntu22.04

获取es安装包

使用deb包进行安装

root@elk1:~# wget https://artifacts.elastic.co/downloads/elasticsearch/elasticsearch-7.17.28-amd64.deb

# 在三台机器山安装es
root@elk1:~# dpkg -i elasticsearch-7.17.28-amd64.deb 
root@elk2:~# dpkg -i elasticsearch-7.17.28-amd64.deb 
root@elk3:~# dpkg -i elasticsearch-7.17.28-amd64.deb 

配置es

# 三台机器一样的配置
[root@elk1 ~]# grep -E "^(cluster|path|network|discovery|http)" /etc/elasticsearch/elasticsearch.yml 
cluster.name: es-cluster
path.data: /var/lib/elasticsearch
path.logs: /var/log/elasticsearch
network.host: 0.0.0.0
http.port: 9200
discovery.seed_hosts: ["192.168.121.91", "192.168.121.92", "192.168.121.93"]
cluster.initial_master_nodes: ["192.168.121.91", "192.168.121.92", "192.168.121.93"]

# 启动服务
root@elk1:~# systemctl enable elasticsearch.service --now
root@elk2:~# systemctl enable elasticsearch.service --now
root@elk3:~# systemctl enable elasticsearch.service --now
[root@elk1 ~]# netstat -tunlp | grep -E "9[2|3]00"
tcp6       0      0 :::9200                 :::*                    LISTEN      3241/java           
tcp6       0      0 :::9300                 :::*                    LISTEN      3241/java 

# 测试访问
[root@elk3 ~]# curl http://192.168.121.91:9200
{
  "name" : "elk1",
  "cluster_name" : "es-cluster",
  "cluster_uuid" : "VuOsYh3bRwSMoJA5yiobYQ",
  "version" : {
    "number" : "7.17.28",
    "build_flavor" : "default",
    "build_type" : "deb",
    "build_hash" : "139cb5a961d8de68b8e02c45cc47f5289a3623af",
    "build_date" : "2025-02-20T09:05:31.349013687Z",
    "build_snapshot" : false,
    "lucene_version" : "8.11.3",
    "minimum_wire_compatibility_version" : "6.8.0",
    "minimum_index_compatibility_version" : "6.0.0-beta1"
  },
  "tagline" : "You Know, for Search"
}
[root@elk3 ~]# curl http://192.168.121.91:9200/_cat/nodes
192.168.121.92 13 96 67 1.50 0.62 0.45 cdfhilmrstw - elk2
192.168.121.93 10 96 66 1.63 0.67 0.47 cdfhilmrstw - elk3
192.168.121.91 24 97 66 1.62 0.67 0.43 cdfhilmrstw * elk1
[root@elk3 ~]# curl http://192.168.121.91:9200/_cat/nodes?v
ip             heap.percent ram.percent cpu load_1m load_5m load_15m node.role   master name
192.168.121.92           21          97  43    1.49    0.65     0.47 cdfhilmrstw -      elk2
192.168.121.93           10          97  42    1.50    0.66     0.47 cdfhilmrstw -      elk3
192.168.121.91           31          97  32    1.65    0.69     0.44 cdfhilmrstw *      elk1
posted @ 2025-03-21 13:35  Linux小菜鸟  阅读(47)  评论(0)    收藏  举报