Elasticsearch集群容器化部署

基本配置示例

节点ip: 10.160.76.10,10.160.76.11,10.160.76.12
节点配置: 内存64GB,硬盘200G,CPU16核
Elasticsearch版本: 7.5.1

部署Elasticsearch节点

# esnode1: 10.160.76.10
docker run -d --name esnode01 \
    -v /disk01/es/data:/usr/share/elasticsearch/data \
    --ulimit memlock=-1:-1 \
    --ulimit nofile=65535:65535 \
    --ulimit nproc=4096:4096 \
    -p 9200:9200 \
    -p 9300:9300 \
    -e node.name=esnode01 \
    -e node.data=true \
    -e node.master=true \
    -e transport.port=9300 \
    -e network.publish_host=10.160.76.10:9300 \
    -e discovery.seed_hosts=10.160.76.10:9300,10.160.76.11:9300,10.160.76.12:9300 \
    -e cluster.initial_master_nodes=esnode01,esnode02,esnode03 \
    -e cluster.name=es-docker-cluster \
    -e bootstrap.memory_lock=true \
    -e "ES_JAVA_OPTS=-Xms31g -Xmx31g" \
    -e http.cors.enabled=true \
    -e http.cors.allow-origin=* \
    --restart=always \
    dockerhub.nie.netease.com/zhangbin05/elasticsearch:7.5.1
# esnode2: 10.160.76.11
docker run -d --name esnode02 \
    -v /disk01/es/data:/usr/share/elasticsearch/data \
    --ulimit memlock=-1:-1 \
    --ulimit nofile=65535:65535 \
    --ulimit nproc=4096:4096 \
    -p 9200:9200 \
    -p 9300:9300 \
    -e node.name=esnode02 \
    -e node.data=true \
    -e node.master=true \
    -e transport.port=9300 \
    -e network.publish_host=10.160.76.11:9300 \
    -e discovery.seed_hosts=10.160.76.10:9300,10.160.76.11:9300,10.160.76.12:9300 \
    -e cluster.initial_master_nodes=esnode01,esnode02,esnode03 \
    -e cluster.name=es-docker-cluster \
    -e bootstrap.memory_lock=true \
    -e "ES_JAVA_OPTS=-Xms31g -Xmx31g" \
    -e http.cors.enabled=true \
    -e http.cors.allow-origin=* \
    --restart=always \
    dockerhub.nie.netease.com/zhangbin05/elasticsearch:7.5.1
# esnode3: 10.160.76.12
docker run -d --name esnode03 \
    -v /disk01/es/data:/usr/share/elasticsearch/data \
    --ulimit memlock=-1:-1 \
    --ulimit nofile=65535:65535 \
    --ulimit nproc=4096:4096 \
    -p 9200:9200 \
    -p 9300:9300 \
    -e node.name=esnode03 \
    -e node.data=true \
    -e node.master=true \
    -e transport.port=9300 \
    -e network.publish_host=10.160.76.12:9300 \
    -e discovery.seed_hosts=10.160.76.10:9300,10.160.76.11:9300,10.160.76.12:9300 \
    -e cluster.initial_master_nodes=esnode01,esnode02,esnode03 \
    -e cluster.name=es-docker-cluster \
    -e bootstrap.memory_lock=true \
    -e "ES_JAVA_OPTS=-Xms31g -Xmx31g" \
    -e http.cors.enabled=true \
    -e http.cors.allow-origin=* \
    --restart=always \
    dockerhub.nie.netease.com/zhangbin05/elasticsearch:7.5.1

部署Kibana

# run kibana 在服务器10.160.76.10
docker run -d --name kibana \
    -p 5601:5601 \
    -v /disk01/kibana/kibana.yml:/usr/share/kibana/config/kibana.yml \
    --restart=always \
    dockerhub.nie.netease.com/zhangbin05/kibana:7.5.1
# kibana.yml
server.host: "0.0.0.0"
elasticsearch.hosts: [ "http://10.160.76.10:9200","http://10.160.76.11:9200","http://10.160.76.12:9200"]

Kibana访问地址: http://10.160.76.10:5601

Elasticsearch restful api: https://www.elastic.co/guide/en/elasticsearch/reference/current/rest-apis.html

上一篇:内网机器之间出现非22端口不通的情况,可以使用iptables -I INPUT -p -tcp --dport 8889 -jACCEPT


下一篇:SPRINGBOOT01_概述、入门案例、父项目依赖管理特性、@Configuration、@Import、@Conditional、@ConfigurationProperties配置绑定(四)