1.建3个目录
- /home/es/node1
- /home/es/node2
- /home/es/node3
2.每个目录再建三个目录和一个文件
- 三个目录:data,logs,plugins
- 一个文件:elasticsearch.yml
3、分别创建elasticsearch.yml
> cluster.name: my-search-cluster
> node.name: node-1
> path.data: /usr/share/elasticsearch/data
> path.logs: /usr/share/elasticsearch/logs
> network.host: 0.0.0.0
> http.port: 9200
> cluster.name: my-search-cluster
> node.name: node-2
> path.data: /usr/share/elasticsearch/data
> path.logs: /usr/share/elasticsearch/logs
> network.host: 0.0.0.0
> http.port: 9200
> cluster.name: my-search-cluster
> node.name: node-3
> path.data: /usr/share/elasticsearch/data
> path.logs: /usr/share/elasticsearch/logs
> network.host: 0.0.0.0
> http.port: 9200
4、修改文件夹权限
chmod a+rw -R ./node1
chmod a+rw -R ./node2
chmod a+rw -R ./node3
5、运行docker
docker run -d -p 9200:9200 -p 9300:9300 --name es1 -h es1 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e xpack.security.enabled=false -v /home/es/node1/data:/usr/share/elasticsearch/data -v /home/es/node1/logs:/usr/share/elasticsearch/logs -v /home/es/node1/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml docker.elastic.co/elasticsearch/elasticsearch:5.5.2
docker run -d -p 9201:9200 -p 9301:9300 --link es1 --name es2 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e xpack.security.enabled=false -e discovery.zen.ping.unicast.hosts=es1 -v /home/es/node2/data:/usr/share/elasticsearch/data -v /home/es/node2/logs:/usr/share/elasticsearch/logs -v /home/es/node2/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml docker.elastic.co/elasticsearch/elasticsearch:5.5.2
docker run -d -p 9202:9200 -p 9302:9300 --link es1 --name es3 -e ES_JAVA_OPTS="-Xms512m -Xmx512m" -e xpack.security.enabled=false -e discovery.zen.ping.unicast.hosts=es1 -v /home/es/node3/data:/usr/share/elasticsearch/data -v /home/es/node3/logs:/usr/share/elasticsearch/logs -v /home/es/node3/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml docker.elastic.co/elasticsearch/elasticsearch:5.5.2
当 -v /home/es/node3/plugins:/usr/share/elasticsearch/plugins 的时候
使用 -e xpack.security.enabled=false 会报错
还不知道原因求解释。。。。