elasticsearch部署

ElasticSearch 部署

  • 每个节点可部署到不同的服务器
  • 镜像:elasticsearch:7.6.2
  • 可以配置单机模式 “discovery.type=single-node”
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
version: "3"
services:
es_n0:
image: elasticsearch:7.6.2
container_name: es_n0
privileged: true
environment:
- cluster.name=elasticsearch-cluster
- node.name=node0
- node.master=true
- node.data=true
- bootstrap.memory_lock=true
- search.max_buckets=100000000
- http.cors.enabled=true
- http.cors.allow-origin=*
- cluster.initial_master_nodes=node0
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- "discovery.zen.ping.unicast.hosts=es_n0,es_n1,es_n2"
- "discovery.zen.minimum_master_nodes=2"
- client.transport.ping_timeout=60s
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /etc/localtime:/etc/localtime
- /data/base/es/data/node0:/usr/share/elasticsearch/data
- ./logs/node0:/usr/share/elasticsearch/logs
ports:
- 9200:9200
- 9300:9300
es_n1:
image: elasticsearch:7.6.2
container_name: es_n1
privileged: true
environment:
- cluster.name=elasticsearch-cluster
- node.name=node0
- node.master=true
- node.data=true
- bootstrap.memory_lock=true
- search.max_buckets=100000000
- http.cors.enabled=true
- http.cors.allow-origin=*
- cluster.initial_master_nodes=node0
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- "discovery.zen.ping.unicast.hosts=es_n0,es_n1,es_n2"
- "discovery.zen.minimum_master_nodes=2"
- client.transport.ping_timeout=60s
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /etc/localtime:/etc/localtime
- /data/base/es/data/node1:/usr/share/elasticsearch/data
- ./logs/node1:/usr/share/elasticsearch/logs
ports:
- 9201:9200
- 9301:9300
es_n2:
image: elasticsearch:7.6.2
container_name: es_n2
privileged: true
environment:
- cluster.name=elasticsearch-cluster
- node.name=node0
- node.master=true
- node.data=true
- bootstrap.memory_lock=true
- search.max_buckets=100000000
- http.cors.enabled=true
- http.cors.allow-origin=*
- cluster.initial_master_nodes=node0
- "ES_JAVA_OPTS=-Xms1024m -Xmx1024m"
- "discovery.zen.ping.unicast.hosts=es_n0,es_n1,es_n2"
- "discovery.zen.minimum_master_nodes=2"
- client.transport.ping_timeout=60s
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- /etc/localtime:/etc/localtime
- /data/base/es/data/node2:/usr/share/elasticsearch/data
- ./logs/node2:/usr/share/elasticsearch/logs
ports:
- 9202:9200
- 9302:9300

启动前给logs文件夹和数据文件夹赋权

1
2
3
4
5
6
7
chmod 777 logs/node0/
chmod 777 logs/node1/
chmod 777 logs/node2/

chmod 777 /data/base/es/data/node0
chmod 777 /data/base/es/data/node1
chmod 777 /data/base/es/data/node2

单机模式

要把cluster.initial_master_nodes "discovery.zen.ping.unicast.hosts=es_n0,es_n1,es_n2" "discovery.zen.minimum_master_nodes=2" 注释掉


elasticsearch部署
https://zhaops-hub.github.io/2021/11/10/elasticsearch/elasticsearch部署/
作者
赵培胜
发布于
2021年11月10日
许可协议