參考博客:html
http://www.javashuo.com/article/p-eqcgzqyk-br.htmldocker
感謝這位老哥讓我解決了坑點shell
docker pull kibana:7.6.1
這裏的版本號選擇本身要用的,通常與es的相同express
docker run --name mykibana -e ELASTICSEARCH_URL = http://x.x.x.x:9200 -p 5601:5601 -d kibana:7.6.1
說明:cookie
x.x.x.x是你的ip地址網絡
坑點session
巨坑!!!dom
被坑了很久。elasticsearch
網絡搜索的docker安裝kibana的版本可能較低,按照上述命令run以後,容器可以正常運行,可是日誌會一直報錯!訪問頁面也會連不上。ui
報錯:
{"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins-system"],"pid":6,"message":"Setting up [15] plugins: [timelion,features,security,licensing,spaces,code,uiActions,newsfeed,translations,inspector,embeddable,advancedUiActions,data,expressions,eui_utils]"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","timelion"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","features"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","security"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["warning","plugins","security","config"],"pid":6,"message":"Generating a random key for xpack.security.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.security.encryptionKey in kibana.yml"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["warning","plugins","security","config"],"pid":6,"message":"Session cookies will be transmitted over insecure connections. This is not recommended."} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","licensing"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","spaces"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","code"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","translations"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:15Z","tags":["info","plugins","data"],"pid":6,"message":"Setting up plugin"} {"type":"log","@timestamp":"2019-12-13T07:33:40Z","tags":["error","elasticsearch","data"],"pid":6,"message":"Request error, retrying\nGET http://elasticsearch:9200/_xpack => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200"} {"type":"log","@timestamp":"2019-12-13T07:33:41Z","tags":["warning","elasticsearch","data"],"pid":6,"message":"Unable to revive connection: http://elasticsearch:9200/"} {"type":"log","@timestamp":"2019-12-13T07:33:41Z","tags":["warning","elasticsearch","data"],"pid":6,"message":"No living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:41Z","tags":["warning","plugins","licensing"],"pid":6,"message":"License information could not be obtained from Elasticsearch for the [data] cluster. Error: No Living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:41Z","tags":["warning","legacy-plugins"],"pid":6,"path":"/usr/share/kibana/src/legacy/core_plugins/visualizations","message":"Skipping non-plugin directory at /usr/share/kibana/src/legacy/core_plugins/visualizations"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["info","plugins-system"],"pid":6,"message":"Starting [8] plugins: [timelion,features,security,licensing,spaces,code,translations,data]"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["error","elasticsearch","admin"],"pid":6,"message":"Request error, retrying\nGET http://elasticsearch:9200/.kibana_task_manager => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["error","elasticsearch","admin"],"pid":6,"message":"Request error, retrying\nGET http://elasticsearch:9200/.kibana => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"Unable to revive connection: http://elasticsearch:9200/"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"No living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["warning","migrations"],"pid":6,"message":"Unable to connect to Elasticsearch. Error: No Living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"Unable to revive connection: http://elasticsearch:9200/"} {"type":"log","@timestamp":"2019-12-13T07:33:42Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"No living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:44Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"Unable to revive connection: http://elasticsearch:9200/"} {"type":"log","@timestamp":"2019-12-13T07:33:44Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"No living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:44Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"Unable to revive connection: http://elasticsearch:9200/"} {"type":"log","@timestamp":"2019-12-13T07:33:44Z","tags":["warning","elasticsearch","admin"],"pid":6,"message":"No living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:46Z","tags":["warning","elasticsearch","data"],"pid":6,"message":"Unable to revive connection: http://elasticsearch:9200/"} {"type":"log","@timestamp":"2019-12-13T07:33:46Z","tags":["warning","elasticsearch","data"],"pid":6,"message":"No living connections"} {"type":"log","@timestamp":"2019-12-13T07:33:46Z","tags":["warning","plugins","licensing"],"pid":6,"message":"License information could not be obtained from Elasticsearch for the [data]
["error","elasticsearch","data"],"pid":6,"message":"Request error, retrying\nGET http://elasticsearch:9200/_xpack => getaddrinfo ENOTFOUND elasticsearch elasticsearch:9200"}
核心就是這一句話,es根本就沒有訪問到。這是由於裏面的配置文件有問題,須要進行修正。
修改/usr/share/kibana/config/kibana.yml
這是修改後的內容,要將elasticsearch.hosts中的內容改成容器的ip地址(本來是elasticsearch)
docker inspect 容器id(或容器名字) |grep IPAddress
查找容器ip
[root@iZ1ejkkkxu2looZ ~]# docker inspect myes01 |grep IPAddress "SecondaryIPAddresses": null, "IPAddress": "172.17.0.2", "IPAddress": "172.17.0.2",
而後xpack.monitoring.ui.container.elasticsearch.enabled改成true
# # ** THIS IS AN AUTO-GENERATED FILE ** # # Default Kibana configuration for docker target server.name: kibana server.host: "0" elasticsearch.hosts: [ "http://172.17.0.2:9200" ] xpack.monitoring.ui.container.elasticsearch.enabled: false
而後在宿主機將容器restart便可
docker restart 容器id
訪問http://101.37.173.195:5601 完成撒花~