首先docker log <container-id>查看日志是什么问题(以下是我的最后一条日志报错):
{"type":"log","@timestamp":"2024-09-23T12:27:07+00:00","tags":["error","elasticsearch-service"],"pid":6,"message":"This version of Kibana (v7.17.18) is incompatible with the following Elasticsearch nodes in your cluster: v7.3.0 @ 192.168.137.21:9200 (192.168.137.21), v7.3.0 @ 192.168.137.23:9200 (192.168.137.23), v7.3.0 @ 192.168.137.22:9200 (192.168.137.22)"}
这条日志记录表明 Kibana 版本 v7.17.18
与 Elasticsearch 节点的版本 v7.3.0
不兼容。为了解决这个问题,你需要确保 Kibana 和 Elasticsearch 的版本兼容
将kibana的镜像版本号改成拉取和elasticsearch的版本一致的,再运行容器
docker run -d --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.137.21:9200 -p 5601:5601 kibana:7.3.0
使用浏览器查看
如果要在其他服务器使用kibana,也要使用一样的版本镜像就行了:
[root@kibana kibana]# docker run -d --name kibana -e ELASTICSEARCH_HOSTS=http://192.168.137.21:9200 -p 5601:5601 kibana:7.3.0
Unable to find image 'kibana:7.3.0' locally
7.3.0: Pulling from library/kibana
8ba884070f61: Pull complete
a478b925ba7f: Pull complete
6176acd34014: Pull complete
688de6cf5534: Pull complete
c6f2a48cdd9d: Pull complete
3352d5f682df: Pull complete
cc3d34436dcb: Pull complete
80e42f69189c: Pull complete
Digest: sha256:67cb368cbebc552880ac31dd8e662a7888dfed3e71b5e6c9be4c8c39450b5531
Status: Downloaded newer image for kibana:7.3.0
9d642bed8b0cfd7943fa988d5a1aa49ace68f9dee92367dbd3fe5f702d2ab2a6
[root@kibana kibana]# docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
9d642bed8b0c kibana:7.3.0 "/usr/local/bin/kiba..." 2 minutes ago Up 2 minutes 0.0.0.0:5601->5601/tcp, :::5601->5601/tcp kibana