简体   繁体   中英

Kibana 3 can't connect to elasticsearch

I have tried to setup a kibana 3 with elasticsearch and logstash.

When i go to 127.0.0.1/kibana i get following error: Error Could not contact Elasticsearch at http://127.0.0.1:9200. Please ensure that Elasticsearch is reachable from your system. Error Could not contact Elasticsearch at http://127.0.0.1:9200. Please ensure that Elasticsearch is reachable from your system.

And when I check the console log i get the following: 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). 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).

When I go to the url http://127.0.0.1:9200 i get the following JSON text

{
  "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"
}

and in http://127.0.0.1:9200/_nodes I get the following:

{"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":[]}}}

You simply need to enable CORS in your elasticsearch.yml configuration file and restart ES, that setting is disabled by default.

http.cors.enabled: true

However, I'm not certain that Kibana 3 will work with ES 2.1.1. You might need to upgrade your Kibana in order for this work. Try to change the above settings and see it it helps. If not, upgrade Kibana to the latest release.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM