[root@localhost ~]# docker pull elasticsearch:7.8.0 安装elasticsearch:7.8.0
[root@localhost ~]# docker pull kibana:7.8.0 安装安装elasticsearch:7.8.0版本对应的可视化工具
创建文档
[root@localhost ~]# mkdir -p /mydata/elasticsearch/data
[root@localhost ~]# mkdir -p /mydata/elasticsearch/config
进入mydata/elasticsearch/config下,这里的host后面必须要有空格,因为是yml文件,否则无法识别
[root@localhost config]# echo "http.host: 0.0.0.0">>/mydata/elasticsearch/config/elasticsearch.yml
进行挂载
[root@localhost config]# 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:/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.8.0
进入elasticsearch目录,开放/mydata/elasticsearch/权限
[root@localhost elasticsearch]# chmod -R 777 /mydata/elasticsearch/
查看id号后启动:
[root@localhost elasticsearch]# docker ps -a
[root@localhost elasticsearch]# docker start e19
成功界面: