美文网首页ES
Mac上最简单明了的利用Docker搭建ElasticSearc

Mac上最简单明了的利用Docker搭建ElasticSearc

作者: Crespo_Curry | 来源:发表于2019-08-06 09:00 被阅读0次

1.获取镜像

  docker pull elasticsearch:6.4.0

2.查询当前镜像

  docker images

3.查看镜像的信息

  docker image inspect imageId

4.创建es 集群的文件夹

mkdir -p es/config

cd es

mkdir data1

mkdir data2

mkdir data3

firewall-cmd --add-port=9300/tcp(mac 不需要)

firewall-cmd --add-port=9301/tcp (mac 不需要)

mkdir  plugins1

mkdir  plugins2

.在es/config分别放入es1.yml、es2.yml

Es1:

cluster.name: elasticsearch-cluster

node.name: es-node1

network.bind_host: 0.0.0.0

network.publish_host: localhost

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: ["localhost:9300","localhost:9301"]

discovery.zen.minimum_master_nodes: 1

Es2:

cluster.name: elasticsearch-cluster

node.name: es-node2

network.bind_host: 0.0.0.0

network.publish_host: localhost

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: ["localhost:9300","localhost:9301"]

discovery.zen.minimum_master_nodes: 1

5. 启动容器

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9200:9200 -p 9300:9300 -p 5601:5601 -v /Users/wangjie/es/config/es1.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /Users/wangjie/es/plugins1:/usr/share/elasticsearch/plugins -v /Users/wangjie/es/data1:/usr/share/elasticsearch/data --name ES01 elasticsearch:6.4.0

docker run -e ES_JAVA_OPTS="-Xms256m -Xmx256m" -d -p 9201:9200 -p 9301:9300 -v /Users/wangjie/es/config/es2.yml:/usr/share/elasticsearch/config/elasticsearch.yml  -v /Users/wangjie/es/plugins2:/usr/share/elasticsearch/plugins    -v /Users/wangjie/es/data2:/usr/share/elasticsearch/data --name ES02 elasticsearch:6.4.0

访问地址

http://localhost:9200/_cat/nodes?pretty

6.使用elasticsearch-head前端框架

docker pull mobz/elasticsearch-head:5

docker run -d -p 9100:9100 --name es-manager  mobz/elasticsearch-head:5

相关文章

网友评论

    本文标题:Mac上最简单明了的利用Docker搭建ElasticSearc

    本文链接:https://www.haomeiwen.com/subject/deibdctx.html