1、搭建
- 创建文件挂载目录并开启777权限
mkdir -p /data/es/data1
mkdir -p /data/es/data2
mkdir -p /data/es/data3
chmod -R 777 /data/es/data1
chmod -R 777 /data/es/data2
chmod -R 777 /data/es/data3
- 创建es配置文件
mkdir -p /data/es/config
#vim /data/es/config/es1.ymlcluster.name: elasticsearch-cluster
node.name: es-node1
network.bind_host: 0.0.0.0
network.publish_host: *.*.*.*
http.port: 9200
transport.tcp.port: 9300
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["*.*.*.*:9300","*.*.*.*:9301","*.*.*.*:9302"]
discovery.zen.minimum_master_nodes: 2
PS:network.publish_host: *.*.*.*替换为宿主机IP
#vim /data/es/config/es2.ymlcluster.name: elasticsearch-cluster
node.name: es-node2
network.bind_host: 0.0.0.0
network.publish_host: *.*.*.*
http.port: 9201
transport.tcp.port: 9301
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["*.*.*.*:9300","*.*.*.*:9301","*.*.*.*:9302"]
discovery.zen.minimum_master_nodes: 2
【ElasticSearch之docker集群搭建】
#vim /data/es/config/es3.ymlcluster.name: elasticsearch-cluster
node.name: es-node3
network.bind_host: 0.0.0.0
network.publish_host: *.*.*.*
http.port: 9202
transport.tcp.port: 9302
http.cors.enabled: true
http.cors.allow-origin: "*"
node.master: true
node.data: true
discovery.zen.ping.unicast.hosts: ["*.*.*.*:9300","*.*.*.*:9301","*.*.*.*:9302"]
discovery.zen.minimum_master_nodes: 2
- 启动es集群
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -v /data/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/data1:/usr/share/elasticsearch/data --name ES01 elasticsearch:6.8.5
docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9201 -p 9301:9301 -v /data/es/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/data2:/usr/share/elasticsearch/data --name ES02 elasticsearch:6.8.5 docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9202:9202 -p 9302:9302 -v /data/es/config/es3.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /data/es/data3:/usr/share/elasticsearch/data --name ES03 elasticsearch:6.8.5
2、问题记录
- bootstrap checks failed max virtual memory areas vm.max_map_count [65530] likely too low, increase to at least [262144]
vim /etc/sysctl.confvm.max_map_count=262144 sysctl -p
推荐阅读
- Elasticsearch|Elasticsearch 简介
- elastic-search 部署和应用「详细」
- ElasticSearch-Logstash6.0.0安装以及mysql数据导入ES
- ElasticSearche导入样本数据官网链接
- ElasticSearch笔记01
- SpringBoot集成ElasticSearch使用
- ElasticStack|黑马Elastic stack学习笔记
- JAVA开发|java调用go、js、python、groovy和Caffeine缓存
- Elastcsearch 常用搜索命令