Kibana 3无法连接到elasticsearch

时间:2016-01-28 13:29:09

标签: elasticsearch kibana

我尝试使用elasticsearch和logstash设置kibana 3.

当我去127.0.0.1/kibana时,我收到以下错误: Error Could not contact Elasticsearch at http://127.0.0.1:9200. Please ensure that Elasticsearch is reachable from your system.

当我检查控制台日志时,我得到以下内容: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:9200/_nodes. (Reason: CORS header 'Access-Control-Allow-Origin' missing).

当我转到网址http://127.0.0.1:9200时,我会收到以下JSON文字

{
  "name" : "Meteor Man",
  "cluster_name" : "elasticsearch",
  "version" : {
    "number" : "2.1.1",
    "build_hash" : "40e2c53a6b6c2972b3d13846e450e66f4375bd71",
    "build_timestamp" : "2015-12-15T13:05:55Z",
    "build_snapshot" : false,
    "lucene_version" : "5.3.1"
  },
  "tagline" : "You Know, for Search"
}

http://127.0.0.1:9200/_nodes我得到以下内容:

{"cluster_name":"elasticsearch","nodes":{"BKXqqrymQw6lShg5P7_-eA":{"name":"Meteor Man","transport_address":"127.0.0.1:9300","host":"127.0.0.1","ip":"127.0.0.1","version":"2.1.1","build":"40e2c53","http_address":"127.0.0.1:9200","settings":{"client":{"type":"node"},"name":"Meteor Man","pidfile":"/var/run/elasticsearch/elasticsearch.pid","path":{"data":"/var/lib/elasticsearch","home":"/usr/share/elasticsearch","conf":"/etc/elasticsearch","logs":"/var/log/elasticsearch"},"config":{"ignore_system_properties":"true"},"cluster":{"name":"elasticsearch"},"foreground":"false"},"os":{"refresh_interval_in_millis":1000,"name":"Linux","arch":"amd64","version":"3.19.0-25-generic","available_processors":4,"allocated_processors":4},"process":{"refresh_interval_in_millis":1000,"id":10545,"mlockall":false},"jvm":{"pid":10545,"version":"1.7.0_91","vm_name":"OpenJDK 64-Bit Server VM","vm_version":"24.91-b01","vm_vendor":"Oracle Corporation","start_time_in_millis":1453983811248,"mem":{"heap_init_in_bytes":268435456,"heap_max_in_bytes":1038876672,"non_heap_init_in_bytes":24313856,"non_heap_max_in_bytes":224395264,"direct_max_in_bytes":1038876672},"gc_collectors":["ParNew","ConcurrentMarkSweep"],"memory_pools":["Code Cache","Par Eden Space","Par Survivor Space","CMS Old Gen","CMS Perm Gen"]},"thread_pool":{"generic":{"type":"cached","keep_alive":"30s","queue_size":-1},"index":{"type":"fixed","min":4,"max":4,"queue_size":200},"fetch_shard_store":{"type":"scaling","min":1,"max":8,"keep_alive":"5m","queue_size":-1},"get":{"type":"fixed","min":4,"max":4,"queue_size":1000},"snapshot":{"type":"scaling","min":1,"max":2,"keep_alive":"5m","queue_size":-1},"force_merge":{"type":"fixed","min":1,"max":1,"queue_size":-1},"suggest":{"type":"fixed","min":4,"max":4,"queue_size":1000},"bulk":{"type":"fixed","min":4,"max":4,"queue_size":50},"warmer":{"type":"scaling","min":1,"max":2,"keep_alive":"5m","queue_size":-1},"flush":{"type":"scaling","min":1,"max":2,"keep_alive":"5m","queue_size":-1},"search":{"type":"fixed","min":7,"max":7,"queue_size":1000},"fetch_shard_started":{"type":"scaling","min":1,"max":8,"keep_alive":"5m","queue_size":-1},"listener":{"type":"fixed","min":2,"max":2,"queue_size":-1},"percolate":{"type":"fixed","min":4,"max":4,"queue_size":1000},"refresh":{"type":"scaling","min":1,"max":2,"keep_alive":"5m","queue_size":-1},"management":{"type":"scaling","min":1,"max":5,"keep_alive":"5m","queue_size":-1}},"transport":{"bound_address":["127.0.0.1:9300","[::1]:9300"],"publish_address":"127.0.0.1:9300","profiles":{}},"http":{"bound_address":["127.0.0.1:9200","[::1]:9200"],"publish_address":"127.0.0.1:9200","max_content_length_in_bytes":104857600},"plugins":[]}}}

1 个答案:

答案 0 :(得分:0)

您只需要在elasticsearch.yml配置文件中enable CORS并重新启动ES,默认情况下该设置已被禁用。

http.cors.enabled: true

但是,我不确定Kibana 3是否适用于ES 2.1.1。您可能需要升级Kibana才能完成这项工作。尝试更改上述设置,看看它有帮助。如果没有,请将Kibana升级到最新版本。