How to Install docker elasticsearch (on)

A environment

VMware® Workstation 15 Pro   

centos7 (1810)     

docker19.03.1

Two entered centos7 start dcoker

systemctl start docker

Three open docker official repository search elasticsearch to see when you need to download version, pull the mirror, the official recommended to specify the version number, the latest 7.3.0

https://hub.docker.com

After searching elasticsearch, click the tags to see an updated version of the list, now I downloaded the 7.3.0 format: Mirror Name: tag

 

Two pull elasticsearch mirror, the official latest version 7.3.0

 Due to the wall, download more slowly, need to modify the docker's image as a mirror image of Ali cloud storage, please search

When pulling the mirror, the official recommended to specify the version number, if not specified, the default is: image name: latest to download the latest version, which is not the recommended way to avoid such use

The following began to take the mirror pulled from Ali cloud

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

Use a mirror to create three containers, start the service elasticsearch

Divided in two ways, developers and production patterns, developers do not need too much configuration, direct line of command to get the production mode requires more configuration

1. Developer mode

1.1 Create Network

If you need to install kibana other, you need to create a network, the name taken arbitrarily, let them on the same network so that communications es and kibana

docker network create esnet

1.2 Create and start elasticsearch container

1.2.1 View Mirror

docker images

1.2.2 Creating running

docker run --name es  -p 9200:9200 -p 9300:9300  --network esnet -e "discovery.type=single-node" bdaab402b220

--name 名称                                                  给容器起个名字

-p 外部访问端口:容器端口                            9200是供htpp访问端口,9300是供tcp访问的端口,如果不做端口映射,浏览器就不能访问elasticsearch的服务

--network 网络名                                          用于多个服务通信与隔离,例如用kibana连接elasticsearch就需要他们在同一个网络下

bdaab402b220                                            通过docker images命令查看到需要创建的容器id,此处用镜像名也可以


 

tips:run怎么使用?那么长怎么记,大概记一下,万能命令是

docker run --help

1.2.3 查看正在运行的容器,以确认elasticsearch容器是否创建成功

docker ps

可以看到status状态是up,说明已经在docker中成功运行了elasticseach

打开浏览器访问http://192.168.61.128:9200/  可以看到如下结果

ip地址换成你的linux主机的ip

 

Guess you like

Origin www.cnblogs.com/powerbear/p/11298135.html