docke安装elasticsearch(ES)

docke安装elasticsearch(ES)

1.安装一个不带数据卷映射的ES

docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.6.2

在这里插入图片描述

2.创建es数据卷映射目录

mkdir -p data/elasticsearch

3.将创建docker中ES服务的配置文件数据拷贝到本地宿主机中

docker cp elasticsearch:/usr/share/elasticsearch/config /data/elasticsearch/config
docker cp elasticsearch:/usr/share/elasticsearch/data /data/elasticsearch/data
docker cp elasticsearch:/usr/share/elasticsearch/plugins /data/elasticsearch/plugins
docker cp elasticsearch:/usr/share/elasticsearch/logs /data/elasticsearch/logs

docke安装elasticsearch(ES)_第1张图片

4.创建带数据卷映射的 完成ES服务

docker run --name elasticsearch \
-p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" -e ES_JAVA_OPTS="-Xms512m -Xmx512m" \
-v /data/elasticsearch/config:/usr/share/elasticsearch/config \
-v /data/elasticsearch/data:/usr/share/elasticsearch/data \
-v /data/elasticsearch/plugins:/usr/share/elasticsearch/plugins \
-v /data/elasticsearch/logs:/usr/share/elasticsearch/logs \
--restart=always \
--privileged=true -d elasticsearch:7.6.2

docke安装elasticsearch(ES)_第2张图片
输入服务器地址+9200访问成功
docke安装elasticsearch(ES)_第3张图片

你可能感兴趣的:(elasticsearch,jenkins,大数据)