我已按照本指南安装了 Elasticsearch、Logstash、Kibana 和 Nginx,但我使用了所有产品的最新版本。
问题是,当访问网络服务器时,它会显示:
Kibana 正在加载。请稍等片刻。我正在加载一大堆代码。别担心,所有这些好东西都会被缓存起来以供下次使用!
但它从未加载 Kibana 开始页面。
当我尝试http://服务器ip:5601我得到一个
连接被拒绝
但它似乎用 curl 加载:
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>
Elasticsearch 似乎有效。
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
答案1
我感觉你的问题出在 Nginx 配置上。
尝试注释掉 kibana.yml 中的主机:“localhost”,重新启动 Kibana 服务,然后再次尝试 server-ip:5601。
如果可行,那么您将需要解决 Nginx 部分。
将该行更改proxy_pass http://localhost:5601
为proxy_pass http://<serverip>:5601
应该可以修复无法连接到上游服务器的错误。
答案2
您应该连接到端口http://服务器ip:80因为你的 NGinx 配置为服务端口 80 和 proxy_pass 从端口 0.0.0.0:80 到 localhost:5601