天天看点

Docker启动Elasticsearch+可视化页面

win10目前(2020年12月23日17:47:22)已经能支持Docker和VMware一起运行了

要求:使用wsl2的docker+VMware16+

启动docker

win10直接运行

Linux systemctl start docker

下载es镜像

https://www.elastic.co/guide/en/elasticsearch/reference/current/docker.html

docker pull docker.elastic.co/elasticsearch/elasticsearch:7.10.1
           

(有:7.1xxx就是制定版本,没有就是最新版本)

下载ElasticHD镜像

docker pull containerize/elastichd
           

启动Elasticsearch,最好要用个名字参数,要不然会很麻烦

docker run --name es -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" -d docker.elastic.co/elasticsearch/elasticsearch:7.10.1
           

参数解释:

–name es 制定名称为es

-p:9200:9200 端口映射到本地端口9200

-e “discovery.type=single-node” 单机模式,一定要写,否则不能正常启动

-d 后台运行,默认就是后台的

启动ElasticHD

docker run -p 9800:9800 -d --link es:esp containerize/elastichd
           

参数解释:

-p:9800:9800 端口映射到本地端口9800

-d 后台运行

–link es:esp 关联容器es:别名为esp,es容器的地址使用esp动态解析(很关键)

访问localhost:9800

Docker启动Elasticsearch+可视化页面

上方地址栏要改成刚刚指定的别名:9200

继续阅读