赞
踩
docker pull elasticsearch:7.2.0
docker pull kibana:7.2.0
mkdir -pv /opt/elasticsearch/{config,data,plugins}
sudo tee /opt/elasticsearch/config/elasticsearch.yml <<-'EOF'
http.host: 0.0.0.0
http.cors.enabled: true
http.cors.allow-origin: "*"
EOF
#在/opt/elasticsearch/plugins目录下下载ik插件 或者进入容器直接执行,本次直接在挂在目录之外配置,配置之后请删除压缩包
wget https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v7.2.0/elasticsearch-analysis-ik-7.2.0.zip
unzip elasticsearch-analysis-ik-7.2.0.zip -d ik
[root@localhost elasticsearch]# docker run --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xmx1024m -Xmx1024m" -v /opt/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml -v /opt/elasticsearch/data:/usr/share/elasticsearch/data -v /opt/elasticsearch/plugins:/usr/share/elasticsearch/plugins -d elasticsearch:7.2.0
c6e1e3fa61cd84f0123ce56453cf5350feda9edd7dc60434db3868f74a47059a
[root@localhost elasticsearch]#
[root@localhost config]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
c6e1e3fa61cd elasticsearch:7.2.0 "/usr/local/bin/dock…" 13 minutes ago Up 13 minutes 0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp elasticsearch
[root@localhost config]#
[root@localhost config]# curl http://localhost:9200/ { "name" : "c6e1e3fa61cd", "cluster_name" : "elasticsearch", "cluster_uuid" : "hwZBRInqQDyqSILw3kCN4Q", "version" : { "number" : "7.2.0", "build_flavor" : "default", "build_type" : "docker", "build_hash" : "508c38a", "build_date" : "2019-06-20T15:54:18.811730Z", "build_snapshot" : false, "lucene_version" : "8.0.0", "minimum_wire_compatibility_version" : "6.8.0", "minimum_index_compatibility_version" : "6.0.0-beta1" }, "tagline" : "You Know, for Search" } [root@localhost config]#
docker update --restart=always elasticsearch
[root@localhost config]# docker inspect elasticsearch | grep IPAddress
"SecondaryIPAddresses": null,
"IPAddress": "172.17.0.2",
"IPAddress": "172.17.0.2",
[root@localhost config]#
docker run -di --name=kibana -e ELASTICSEARCH_URL=http://172.17.0.2:9200 --restart=always -p 5601:5601 kibana:7.2.0
[root@localhost config]# docker run -di --name=kibana -e ELASTICSEARCH_URL=http://172.17.0.2:9200 --restart=always -p 5601:5601 kibana:7.2.0
ea9ede48dc3c6201c30b9c9803dd7b9360c538f30caf1ef952360520d3be004a
[root@localhost config]#
这个时候需要稍等一会儿,容器还在启动中,稍安勿躁
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。