CentOS 7 使用Docker方式搭建ElasticSearch 7.7.0 三节点集群,并配置elasticsearch-head插件,ik分词器,以及Kibana可视化平台
以下是搭建Elasticsearch 7.7.0三节点集群的基本步骤,使用Docker方式:
- 准备Elasticsearch Docker配置文件
elasticsearch.yml
和docker-compose.yml
。
elasticsearch.yml
示例配置:
cluster.name: my-es-cluster
node.name: node-1
network.host: 0.0.0.0
discovery.seed_hosts:
- node-1
- node-2
- node-3
cluster.initial_master_nodes:
- node-1
- node-2
- node-3
http.cors.enabled: true
http.cors.allow-origin: "*"
docker-compose.yml
示例配置(三个节点):
version: '2.2'
services:
es01:
image: docker.elastic.co/elasticsearch/elasticsearch:7.7.0
container_name: es01
environment:
- node.name=node-1
- cluster.name=my-es-cluster
- discovery.seed_hosts=es02,es03
- cluster.initial_master_nodes=node-1
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata01:/usr/share/elasticsearch/data
ports:
- 9200:9200
networks:
- esnet
es02:
image: docker.elastic.co/elasticsearch/elasticsearch:7.7.0
container_name: es02
environment:
- node.name=node-2
- cluster.name=my-es-cluster
- discovery.seed_hosts=es01,es03
- cluster.initial_master_nodes=node-1
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata02:/usr/share/elasticsearch/data
networks:
- esnet
es03:
image: docker.elastic.co/elasticsearch/elasticsearch:7.7.0
container_name: es03
environment:
- node.name=node-3
- cluster.name=my-es-cluster
- discovery.seed_hosts=es01,es02
- cluster.initial_master_nodes=node-1
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- esdata03:/usr/share/elasticsearch/data
networks:
- esnet
volumes:
esdata01:
driver: local
esdata02:
driver: local
esdata03:
driver: local
networks:
esnet:
driver:
评论已关闭