安装 elasticsearch & kibana (docker )

1.elasticsearch

docker run -e "ES_JAVA_OPTS=-Xms256m -Xmx256m" \
--name elasticsearch -p 9200:9200 -p 9300:9300 \
-e "discovery.type=single-node" \
-v /usr/share/elasticsearch/config:/usr/share/elasticsearch/config \
-v /etc/localtime:/etc/localtime \
-d elasticsearch:7.8.0

 

报错示例: 

docker启动elasticsearch异常Exception in thread "main" java.nio.file.NoSuchFileException: /usr/share/elasticsearch/config/jvm.options

1.将容器中文件拷出到宿主机挂载卷文件夹下

docker cp [容器ID]:容器文件路径  要拷贝的宿主机路径

例如我的:

docker cp 2a202fa:/usr/share/elasticsearch/plugins/ ./es/es-with-ik-plugins/

 

2.开启挂载卷配置,重新启动elasticsearch

 

 

浏览器输入 http://localhost:9200/ 或者终端输入 curl http://localhost:9200/ 来检查es是否安装成功

2.kibana

docker run -d --name kibana -v /etc/localtime:/etc/localtime --link elasticsearch:elasticsearch -p 5601:5601 kibana:7.8.0

浏览器输入地址 http://localhost:5601/, 启动成功

posted @ 2024-05-13 15:00  AlamZ  阅读(23)  评论(0编辑  收藏  举报