先启动 docker
systemctl start docker
确定启动起来后执行
docker pull elasticsearch:7.4.2
执行
docker pull kibana:7.4.2
安装完kibana之后
执行
mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
echo "http:host:0.0.0.0">>/mydata/elasticsearch/config/elasticsearch.yml
启动es并且挂载配置文件
9200端口是服务通讯端口,9300是集群通讯端口
docker run --restart=unless-stopped --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx256m" \
-v /mydata/elasticsearch/config/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml \
-v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \
-v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-d elasticsearch:7.4.2
加上了镜像自启动 --restart=unless-stopped
启动 kibana
docker run --restart=unless-stopped --link elasticsearch(es的名字或者id):elasticsearch -d --name kibana -p 5601:5601 kibana:7.4.2
成功