update
This commit is contained in:
18
elasticsearch7/Demo/MultiRoles/README.md
Normal file
18
elasticsearch7/Demo/MultiRoles/README.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# 部署多角色 es 集群
|
||||
|
||||
- 部署集群,有两个 master 节点和三个 data 节点
|
||||
- 每个节点的 127.0.1.x 用于 http 请求
|
||||
- 每个节点的 127.0.3.x 用于节点间通信
|
||||
- 根据实际环境修改
|
||||
- docker-compose.yml
|
||||
|
||||
- 创建目录
|
||||
```
|
||||
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
|
||||
```
|
||||
|
||||
- 启动
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
229
elasticsearch7/Demo/MultiRoles/docker-compose.yml
Normal file
229
elasticsearch7/Demo/MultiRoles/docker-compose.yml
Normal file
@@ -0,0 +1,229 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
es-master1:
|
||||
image: harbor.colben.cn/general/elasticsearch:7
|
||||
container_name: es-master1
|
||||
restart: "on-failure"
|
||||
stop_grace_period: 5m
|
||||
privileged: true
|
||||
environment:
|
||||
ES_JAVA_OPTS: "-Xms8g -Xmx8g"
|
||||
ELASTIC_PASSWORD: Pass_1234
|
||||
_CONF_cluster.name: myes
|
||||
_CONF_node.name: es-master1
|
||||
_CONF_node.roles: '[master]'
|
||||
_CONF_http.host: 127.0.1.1
|
||||
_CONF_http.port: 9200
|
||||
_CONF_transport.host: 127.0.3.1
|
||||
_CONF_transport.port: 9300
|
||||
_CONF_discovery.seed_hosts: '[127.0.3.1,127.0.3.2]'
|
||||
_CONF_cluster.initial_master_nodes: '[127.0.3.1,127.0.3.2]'
|
||||
_CONF_xpack.security.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.verification_mode: certificate
|
||||
_CONF_xpack.security.transport.ssl.client_authentication: required
|
||||
_CONF_xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
|
||||
_CONF_xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
|
||||
_CONF_gateway.expected_master_nodes: 2
|
||||
_CONF_gateway.expected_data_nodes: 3
|
||||
_CONF_gateway.recover_after_master_nodes: 2
|
||||
_CONF_gateway.recover_after_data_nodes: 3
|
||||
network_mode: host
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./es-master1/config
|
||||
target: /opt/es/config
|
||||
- type: bind
|
||||
source: ./es-master1/data
|
||||
target: /opt/es/data
|
||||
- type: bind
|
||||
source: ./es-master1/logs
|
||||
target: /opt/es/logs
|
||||
- type: bind
|
||||
source: ./es-master1/plugins
|
||||
target: /opt/es/plugins
|
||||
- type: bind
|
||||
source: ./es-master1/offline-plugins
|
||||
target: /opt/es/offline-plugins
|
||||
|
||||
es-master2:
|
||||
image: harbor.colben.cn/general/elasticsearch:7
|
||||
container_name: es-master2
|
||||
restart: "on-failure"
|
||||
stop_grace_period: 5m
|
||||
privileged: true
|
||||
environment:
|
||||
ES_JAVA_OPTS: "-Xms8g -Xmx8g"
|
||||
ELASTIC_PASSWORD: Pass_1234
|
||||
_CONF_cluster.name: myes
|
||||
_CONF_node.name: es-master2
|
||||
_CONF_node.roles: '[master]'
|
||||
_CONF_http.host: 127.0.1.2
|
||||
_CONF_http.port: 9200
|
||||
_CONF_transport.host: 127.0.3.2
|
||||
_CONF_transport.port: 9300
|
||||
_CONF_discovery.seed_hosts: '[127.0.3.1,127.0.3.2]'
|
||||
_CONF_xpack.security.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.verification_mode: certificate
|
||||
_CONF_xpack.security.transport.ssl.client_authentication: required
|
||||
_CONF_xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
|
||||
_CONF_xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
|
||||
_CONF_gateway.expected_master_nodes: 2
|
||||
_CONF_gateway.expected_data_nodes: 3
|
||||
_CONF_gateway.recover_after_master_nodes: 2
|
||||
_CONF_gateway.recover_after_data_nodes: 3
|
||||
network_mode: host
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./es-master2/config
|
||||
target: /opt/es/config
|
||||
- type: bind
|
||||
source: ./es-master2/data
|
||||
target: /opt/es/data
|
||||
- type: bind
|
||||
source: ./es-master2/logs
|
||||
target: /opt/es/logs
|
||||
- type: bind
|
||||
source: ./es-master2/plugins
|
||||
target: /opt/es/plugins
|
||||
- type: bind
|
||||
source: ./es-master2/offline-plugins
|
||||
target: /opt/es/offline-plugins
|
||||
|
||||
es-data1:
|
||||
image: harbor.colben.cn/general/elasticsearch:7
|
||||
container_name: es-data1
|
||||
restart: "on-failure"
|
||||
stop_grace_period: 5m
|
||||
privileged: true
|
||||
environment:
|
||||
ES_JAVA_OPTS: "-Xms8g -Xmx8g"
|
||||
ELASTIC_PASSWORD: Pass_1234
|
||||
_CONF_cluster.name: myes
|
||||
_CONF_node.name: es-data1
|
||||
_CONF_node.roles: '[data]'
|
||||
_CONF_http.host: 127.0.1.3
|
||||
_CONF_http.port: 9200
|
||||
_CONF_transport.host: 127.0.3.3
|
||||
_CONF_transport.port: 9300
|
||||
_CONF_discovery.seed_hosts: '[127.0.3.1,127.0.3.2]'
|
||||
_CONF_xpack.security.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.verification_mode: certificate
|
||||
_CONF_xpack.security.transport.ssl.client_authentication: required
|
||||
_CONF_xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
|
||||
_CONF_xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
|
||||
_CONF_gateway.expected_master_nodes: 2
|
||||
_CONF_gateway.expected_data_nodes: 3
|
||||
_CONF_gateway.recover_after_master_nodes: 2
|
||||
_CONF_gateway.recover_after_data_nodes: 3
|
||||
network_mode: host
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./es-data1/config
|
||||
target: /opt/es/config
|
||||
- type: bind
|
||||
source: ./es-data1/data
|
||||
target: /opt/es/data
|
||||
- type: bind
|
||||
source: ./es-data1/logs
|
||||
target: /opt/es/logs
|
||||
- type: bind
|
||||
source: ./es-data1/plugins
|
||||
target: /opt/es/plugins
|
||||
- type: bind
|
||||
source: ./es-data1/offline-plugins
|
||||
target: /opt/es/offline-plugins
|
||||
|
||||
es-data2:
|
||||
image: harbor.colben.cn/general/elasticsearch:7
|
||||
container_name: es-data2
|
||||
restart: "on-failure"
|
||||
stop_grace_period: 5m
|
||||
privileged: true
|
||||
environment:
|
||||
ES_JAVA_OPTS: "-Xms8g -Xmx8g"
|
||||
ELASTIC_PASSWORD: Pass_1234
|
||||
_CONF_cluster.name: myes
|
||||
_CONF_node.name: es-data2
|
||||
_CONF_node.roles: '[data]'
|
||||
_CONF_http.host: 127.0.1.4
|
||||
_CONF_http.port: 9200
|
||||
_CONF_transport.host: 127.0.3.4
|
||||
_CONF_transport.port: 9300
|
||||
_CONF_discovery.seed_hosts: '[127.0.3.1,127.0.3.2]'
|
||||
_CONF_xpack.security.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.verification_mode: certificate
|
||||
_CONF_xpack.security.transport.ssl.client_authentication: required
|
||||
_CONF_xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
|
||||
_CONF_xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
|
||||
_CONF_gateway.expected_master_nodes: 2
|
||||
_CONF_gateway.expected_data_nodes: 3
|
||||
_CONF_gateway.recover_after_master_nodes: 2
|
||||
_CONF_gateway.recover_after_data_nodes: 3
|
||||
network_mode: host
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./es-data2/config
|
||||
target: /opt/es/config
|
||||
- type: bind
|
||||
source: ./es-data2/data
|
||||
target: /opt/es/data
|
||||
- type: bind
|
||||
source: ./es-data2/logs
|
||||
target: /opt/es/logs
|
||||
- type: bind
|
||||
source: ./es-data2/plugins
|
||||
target: /opt/es/plugins
|
||||
- type: bind
|
||||
source: ./es-data2/offline-plugins
|
||||
target: /opt/es/offline-plugins
|
||||
|
||||
es-data3:
|
||||
image: harbor.colben.cn/general/elasticsearch:7
|
||||
container_name: es-data3
|
||||
restart: "on-failure"
|
||||
stop_grace_period: 5m
|
||||
privileged: true
|
||||
environment:
|
||||
ES_JAVA_OPTS: "-Xms8g -Xmx8g"
|
||||
ELASTIC_PASSWORD: Pass_1234
|
||||
_CONF_cluster.name: myes
|
||||
_CONF_node.name: es-data3
|
||||
_CONF_node.roles: '[data]'
|
||||
_CONF_http.host: 127.0.1.5
|
||||
_CONF_http.port: 9200
|
||||
_CONF_transport.host: 127.0.3.5
|
||||
_CONF_transport.port: 9300
|
||||
_CONF_discovery.seed_hosts: '[127.0.3.1,127.0.3.2]'
|
||||
_CONF_xpack.security.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.enabled: "true"
|
||||
_CONF_xpack.security.transport.ssl.verification_mode: certificate
|
||||
_CONF_xpack.security.transport.ssl.client_authentication: required
|
||||
_CONF_xpack.security.transport.ssl.keystore.path: elastic-certificates.p12
|
||||
_CONF_xpack.security.transport.ssl.truststore.path: elastic-certificates.p12
|
||||
_CONF_gateway.expected_master_nodes: 2
|
||||
_CONF_gateway.expected_data_nodes: 3
|
||||
_CONF_gateway.recover_after_master_nodes: 2
|
||||
_CONF_gateway.recover_after_data_nodes: 3
|
||||
network_mode: host
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./es-data3/config
|
||||
target: /opt/es/config
|
||||
- type: bind
|
||||
source: ./es-data3/data
|
||||
target: /opt/es/data
|
||||
- type: bind
|
||||
source: ./es-data3/logs
|
||||
target: /opt/es/logs
|
||||
- type: bind
|
||||
source: ./es-data3/plugins
|
||||
target: /opt/es/plugins
|
||||
- type: bind
|
||||
source: ./es-data3/offline-plugins
|
||||
target: /opt/es/offline-plugins
|
||||
|
Reference in New Issue
Block a user