一、镜像安装
1、安装ES镜像
docker pull elasticsearch:7.4.2
2、安装ES可视化镜像
docker pull kibana:7.4.2
image.png
二、创建实例
1、ES
将配置文件等文件挂载到外部文件夹
mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
允许外部访问ES
echo "http.host:0.0.0.0">> /mydata/elasticsearch/config/elasticsearch.yml
1、安装ES镜像
docker pull elasticsearch:7.4.2
2、安装ES可视化镜像
docker pull kibana:7.4.2
image.png
二、创建实例
1、查看镜像安装的路径
find / -name elasticsearch.yml
2、ES
将配置文件等文件挂载到外部文件夹
mkdir -p /mydata/elasticsearch/config
mkdir -p /mydata/elasticsearch/data
允许外部访问ES
echo "http.host:0.0.0.0">> /mydata/elasticsearch/config/elasticsearch.yml
docker run --name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-e ES_JAVA_OPTS="-Xms64m -Xmx128m" \
-v /mydata/elasticsearch/config/elasticsearch.yml:/var/lib/docker/overlay2/49d55119c1f7c4af6b6ea54d7108b93c92335c6de5728184ceb0abb0f3493eac/diff/usr/share/elasticsearch/config/elasticsearch.yml \
-v /mydata/elasticsearch/data:/var/lib/docker/overlay2/49d55119c1f7c4af6b6ea54d7108b93c92335c6de5728184ceb0abb0f3493eac/diff/usr/share/data \
-v /mydata/elasticsearch/plugins:/var/lib/docker/overlay2/49d55119c1f7c4af6b6ea54d7108b93c92335c6de5728184ceb0abb0f3493eac/diff/usr/share/elasticsearch/plugins \
-d elasticsearch:7.4.2
image.png--name为容器起名elasticsearch
-p 9200:9200 外部访问端口(http请求或restful服务)
-p 9300:9300 内部访问端口(服务、节点之间通信)
-e discovery.type单节点模式
-e ES_JAVA_OPTS分配内存空间
-v 将/mydata/elasticsearch/plugins:/var/lib/docker/overlay2/49d55119c1f7c4af6b6ea54d7108b93c92335c6de5728184ceb0abb0f3493eac/diff/usr/share/elasticsearch下相关的文件挂载到/mydata/elasticsearch中
-d 使用的镜像版本
image.png
如果访问报错看看/mydata/elasticsearch文件夹权限及登录人的权限
chmod -R 777 /mydata/elasticsearch/
开机启动设置
docker update elasticsearch --restart=always
3、kibana
docker run --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.64.128:9200 -p 5601:5601 -d kibana:7.4.2
设置开机启动
docker update kibana --restart=always
http://192.168.64.128:9200为ES外部访问地址
网友评论