ELK 堆棧:無法載入 Kibana 4
我已經按照本指南安裝了 Elasticsearch、Logstash、Kibana 和 Nginx,但我使用了所有內容的最新版本。
問題是在訪問網路伺服器時它說:
Kibana 正在載入。在這裡給我一點時間。我正在載入一大堆程式碼。不用擔心,這些好東西都會被記憶體起來,以備下次使用!
但它從不載入 Kibana 起始頁。
當我嘗試http://server-ip:5601我得到一個
ERR_CONNECTION_REFUSED
但它似乎載入了捲曲:
elk-stack:/opt/kibana/bin$ curl -i 0:5601 HTTP/1.1 200 OK X-App-Name: kibana Accept-Ranges: bytes Cache-Control: public, max-age=0 Last-Modified: Tue, 21 Jul 2015 09:46:14 GMT ETag: W/"6f9-14eb001a270" Content-Type: text/html; charset=UTF-8 Content-Length: 1785 Vary: Accept-Encoding Date: Wed, 22 Jul 2015 16:07:09 GMT Connection: keep-alive <!DOCTYPE html> <!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]--> <!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]--> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width"> <link rel="shortcut icon" href="styles/theme/elk.ico"> <title>Kibana 4</title> <link rel="stylesheet" href="styles/main.css?_b=7489"> </head> <body kibana ng-class="'application-' + activeApp.id"> <div class="col-md-offset-4 col-md-4 page-header initial-load"> <center> <img width="128" alt="Loading Kibana" src="images/initial_load.gif"> <h1> <strong>Kibana</strong> <small id="cache-message">is loading. Give me a moment here. I'm loading a whole bunch of code. Don't worry, all this good stuff will be cached up for next time!</small> </h1> </center> </div> <script> window.KIBANA_VERSION='4.1.1'; window.KIBANA_BUILD_NUM='7489'; window.KIBANA_COMMIT_SHA='bd4fcb654a2fa062c9a99853ac5f776965ab7637'; </script> <script src="bower_components/requirejs/require.js?_b=7489"></script> <script src="require.config.js?_b=7489"></script> <script> var showCacheMessage = location.href.indexOf('?embed') < 0 && location.href.indexOf('&embed') < 0; if (!showCacheMessage) document.getElementById('cache-message').style.display = 'none'; if (window.KIBANA_BUILD_NUM.substr(0, 2) !== '@@') { // only cache bust if this is really the build number require.config({ urlArgs: '_b=' + window.KIBANA_BUILD_NUM }); } require(['kibana'], function (kibana) { kibana.init(); }); </script> </body> </html>
彈性搜尋似乎工作。
curl http://localhost:9200 { "status" : 200, "name" : "Martinex", "cluster_name" : "elasticsearch", "version" : { "number" : "1.7.0", "build_hash" : "929b9739cae115e73c346cb5f9a6f24ba735a743", "build_timestamp" : "2015-07-16T14:31:07Z", "build_snapshot" : false, "lucene_version" : "4.10.4" }, "tagline" : "You Know, for Search" }
Kibana 作為服務執行(參見指南中的腳本)。如果我停止它並手動啟動 Kibana,我會得到:
elk-stack:/opt/kibana/bin$ sudo ./kibana {"name":"Kibana","hostname":"elk-stack","pid":1414,"level":30,"msg":"Found kibana index","time":"2015-07-22T16:10:31.805Z","v":0} {"name":"Kibana","hostname":"elk-stack","pid":1414,"level":30,"msg":"Listening on 127.0.0.1:5601","time":"2015-07-22T16:10:31.823Z","v":0} {"name":"Kibana","hostname":"elk-stack","pid":1414,"level":30,"req":{"method":"GET","url":"/","headers":{"connection":"upgrade","host":"X.X.X.X","accept":"text/html, application/xhtml+xml, */*","accept-language":"sv-SE,sv;q=0.8,en-GB;q=0.5,en;q=0.3","user-agent":"Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; rv:11.0) like Gecko","accept-encoding":"gzip, deflate","if-modified-since":"Tue, 21 Jul 2015 09:46:14 GMT","if-none-match":"W/\"6f9-14eb001a270\"","authorization":"Basic YXRlYW9wOncwcms0bWU="},"remoteAddress":"127.0.0.1","remotePort":40809},"res":{"statusCode":304,"responseTime":8,"contentLength":0},"msg":"GET / 304 - 8ms","time":"2015-07-22T16:11:04.362Z","v":0}
我不確定 Ngnix 配置是否正確,現在看起來像這樣:
server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; server_name elk-stack; auth_basic "Restricted Access"; auth_basic_user_file /etc/nginx/htpasswd.users; location / { proxy_pass http://localhost:5601; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; try_files $uri $uri/ =404;
有任何想法嗎?我想某處有一些日誌,但我不確定要檢查哪一個。更多安裝資訊:
Ubuntu 14.04.2
Kibana 4.1.1
Elasticsearch 1.7.0
編輯: GregL 詢問 netstat 輸出:
$ netstat -lnp (No info could be read for "-p": geteuid()=1000 but you should be root.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:5601 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp6 0 0 127.0.0.1:9200 :::* LISTEN - tcp6 0 0 :::80 :::* LISTEN - tcp6 0 0 127.0.0.1:9300 :::* LISTEN - tcp6 0 0 :::22 :::* LISTEN - udp6 0 0 :::54328 :::* - Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 9748 - /var/run/acpid.socket unix 2 [ ACC ] STREAM LISTENING 7546 - @/com/ubuntu/upstart unix 2 [ ACC ] SEQPACKET LISTENING 1667 - /run/udev/control unix 2 [ ACC ] STREAM LISTENING 7921 - /var/run/dbus/system_bus_socket
這是 kibana.yml 配置:
port: 5601 host: "localhost" elasticsearch_url: "http://localhost:9200" elasticsearch_preserve_host: true kibana_index: ".kibana" default_app_id: "discover" request_timeout: 300000 shard_timeout: 0 verify_ssl: true bundled_plugin_ids: - plugins/dashboard/index - plugins/discover/index - plugins/doc/index - plugins/kibana/index - plugins/markdown_vis/index - plugins/metric_vis/index - plugins/settings/index - plugins/table_vis/index - plugins/vis_types/index - plugins/visualize/index
在 elasticsearch.yml 中,它綁定到 localhost:
network.host: localhost
EDIT2:所有更改後的 Netstat。
$ netstat -lnp (No info could be read for "-p": geteuid()=1000 but you should be root.) Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 127.0.0.1:9300 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:5601 0.0.0.0:* LISTEN - tcp 0 0 127.0.0.1:9200 0.0.0.0:* LISTEN - tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN - tcp6 0 0 :::22 :::* LISTEN - udp 0 0 0.0.0.0:54328 0.0.0.0:* - Active UNIX domain sockets (only servers) Proto RefCnt Flags Type State I-Node PID/Program name Path unix 2 [ ACC ] STREAM LISTENING 8764 - /var/run/acpid.socket unix 2 [ ACC ] STREAM LISTENING 8013 - /var/run/dbus/system_bus_socket unix 2 [ ACC ] STREAM LISTENING 1417 - @/com/ubuntu/upstart unix 2 [ ACC ] SEQPACKET LISTENING 7856 - /run/udev/control
我感覺您的問題與 Nginx 配置有關。
嘗試在 kibana.yml 中註釋掉 host:“localhost”,重新啟動 Kibana 服務,然後再次嘗試 server-ip:5601。
如果可行,那麼您需要解決 Nginx 部分。
將線路更改
proxy_pass http://localhost:5601
為proxy_pass http://<serverip>:5601
應該修復有關無法連接到上游伺服器的錯誤。
你應該連接到埠http://server-ip:80因為你的 NGinx 被配置為服務埠 80 和 proxy_pass 從埠 0.0.0.0:80 到 localhost:5601