当前位置: 首页 > 知识库问答 >
问题:

当kibana尝试连接时,Elasticsearch连接被拒绝

陶高峯
2023-03-14

我正在尝试使用docker容器运行ELK stack。但我得到的错误是,kibana无法与elasticsearch建立联系。

kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["error","elasticsearch","admin"],"pid":12,"message":"Request error, retrying\nHEAD http://elasticsearch:9200/ => connect ECONNREFUSED 172.18.0.2:9200"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["status","plugin:console@5.6.9","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"No living connections"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["status","plugin:elasticsearch@5.6.9","error"],"pid":12,"state":"red","message":"Status changed from yellow to red - Unable to connect to Elasticsearch at http://elasticsearch:9200.","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["status","plugin:metrics@5.6.9","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
elasticsearch_1  | [2018-06-22T19:31:38,182][INFO ][o.e.d.DiscoveryModule    ] [g8HPieb] using discovery type [zen]
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["status","plugin:timelion@5.6.9","info"],"pid":12,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["listening","info"],"pid":12,"message":"Server running at http://0.0.0.0:5601"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:38Z","tags":["status","ui settings","error"],"pid":12,"state":"red","message":"Status changed from uninitialized to red - Elasticsearch plugin is red","prevState":"uninitialized","prevMsg":"uninitialized"}
elasticsearch_1  | [2018-06-22T19:31:38,634][INFO ][o.e.n.Node               ] initialized
elasticsearch_1  | [2018-06-22T19:31:38,634][INFO ][o.e.n.Node               ] [g8HPieb] starting ...
elasticsearch_1  | [2018-06-22T19:31:38,767][INFO ][o.e.t.TransportService   ] [g8HPieb] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
elasticsearch_1  | [2018-06-22T19:31:38,776][WARN ][o.e.b.BootstrapChecks    ] [g8HPieb] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]
logstash_1       | log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
logstash_1       | log4j:WARN Please initialize the log4j system properly.
logstash_1       | log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
**logstash_1       | {:timestamp=>"2018-06-22T19:31:40.555000+0000", :message=>"Connection refused (Connection refused)", :class=>"Manticore::SocketException", :level=>:error}**
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:40Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana_1         | {"type":"log","@timestamp":"2018-06-22T19:31:40Z","tags":["warning","elasticsearch","admin"],"pid":12,"message":"No living connections"}

这是我的docker comp的内容

version: "2.0"

services:

  logstash:
    image: logstash:2
    ports:
      - "5044:5044"
    volumes:
      - ./:/config
    command: logstash -f /config/logstash.conf
    links:
      - elasticsearch
    depends_on:
      - elasticsearch

   elasticsearch:
     image: elasticsearch:5.6.9
     ports:
       - "9200:9200"
     volumes:
       - "./es_data/es_data:/usr/share/elasticsearch/data/"

   kibana:
     image: kibana:5
     ports:
       - "5601:5601"
     links:
       - elasticsearch
     environment:
       ELASTICSEARCH_URL: http://elasticsearch:9200
     depends_on:
       - elasticsearch

我日志的内容。形态

input { beats {      port => 5044    }  }

output {
  elasticsearch {
    hosts => ["localhost:9200"]
    index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
    document_type => "%{[@metadata][type]}"
  }
  stdout {
    codec => rubydebug
  }
}

我有elasticsearch容器和kibana容器上的卷曲,对我来说很好

{
  "name" : "g8HPieb",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "XxH0TcAmQcGqprf6s7TJEQ",
  "version" : {
    "number" : "5.6.9",
    "build_hash" : "877a590",
    "build_date" : "2018-04-12T16:25:14.838Z",
    "build_snapshot" : false,
    "lucene_version" : "6.6.1"
  },
  "tagline" : "You Know, for Search"
}

curl localhost:9200/_cat/index?漂亮的

yellow open .kibana GIBmXdlRQJmI67oq5r4oCg 1 1 1 0 3.2kb 3.2kb

增加虚拟内存大小后

root@sfbp19:~/docking jenkins#sysctl-p vm。最大映射计数=262144root@sfbp19:~/docker jenkins#docker compose-f docker compose麋鹿。加油

Creating network "dockerizingjenkins_default" with the default driver
Creating dockerizingjenkins_elasticsearch_1
Creating dockerizingjenkins_logstash_1
Creating dockerizingjenkins_kibana_1
Attaching to dockerizingjenkins_elasticsearch_1, dockerizingjenkins_kibana_1, dockerizingjenkins_logstash_1
elasticsearch_1  | [2018-06-26T19:08:19,294][INFO ][o.e.n.Node               ] [] initializing ...
elasticsearch_1  | [2018-06-26T19:08:19,363][INFO ][o.e.e.NodeEnvironment    ] [PVmTsqv] using [1] data paths, mounts [[/usr/share/elasticsearch/data (/dev/mapper/sfbp19--vg-root)]], net usable_space [671.9gb], net total_space [789.2gb], spins? [possibly], types [ext4]
elasticsearch_1  | [2018-06-26T19:08:19,364][INFO ][o.e.e.NodeEnvironment    ] [PVmTsqv] heap size [1.9gb], compressed ordinary object pointers [true]
elasticsearch_1  | [2018-06-26T19:08:19,369][INFO ][o.e.n.Node               ] node name [PVmTsqv] derived from node ID [PVmTsqv3QnyS3sQarPcJ-A]; set [node.name] to override
elasticsearch_1  | [2018-06-26T19:08:19,369][INFO ][o.e.n.Node               ] version[5.6.9], pid[1], build[877a590/2018-04-12T16:25:14.838Z], OS[Linux/4.4.0-31-generic/amd64], JVM[Oracle Corporation/OpenJDK 64-Bit Server VM/1.8.0_171/25.171-b11]
elasticsearch_1  | [2018-06-26T19:08:19,369][INFO ][o.e.n.Node               ] JVM arguments [-Xms2g, -Xmx2g, -XX:+UseConcMarkSweepGC, -XX:CMSInitiatingOccupancyFraction=75, -XX:+UseCMSInitiatingOccupancyOnly, -XX:+AlwaysPreTouch, -Xss1m, -Djava.awt.headless=true, -Dfile.encoding=UTF-8, -Djna.nosys=true, -Djdk.io.permissionsUseCanonicalPath=true, -Dio.netty.noUnsafe=true, -Dio.netty.noKeySetOptimization=true, -Dio.netty.recycler.maxCapacityPerThread=0, -Dlog4j.shutdownHookEnabled=false, -Dlog4j2.disable.jmx=true, -Dlog4j.skipJansi=true, -XX:+HeapDumpOnOutOfMemoryError, -Des.path.home=/usr/share/elasticsearch]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [aggs-matrix-stats]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [ingest-common]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [lang-expression]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [lang-groovy]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [lang-mustache]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [lang-painless]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [parent-join]
elasticsearch_1  | [2018-06-26T19:08:20,040][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [percolator]
elasticsearch_1  | [2018-06-26T19:08:20,041][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [reindex]
elasticsearch_1  | [2018-06-26T19:08:20,041][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [transport-netty3]
elasticsearch_1  | [2018-06-26T19:08:20,041][INFO ][o.e.p.PluginsService     ] [PVmTsqv] loaded module [transport-netty4]
elasticsearch_1  | [2018-06-26T19:08:20,041][INFO ][o.e.p.PluginsService     ] [PVmTsqv] no plugins loaded
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["status","plugin:kibana@5.6.9","info"],"pid":13,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["status","plugin:elasticsearch@5.6.9","info"],"pid":13,"state":"yellow","message":"Status changed from uninitialized to yellow - Waiting for Elasticsearch","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["error","elasticsearch","admin"],"pid":13,"message":"Request error, retrying\nHEAD http://elasticsearch:9200/ => connect ECONNREFUSED 172.18.0.2:9200"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["warning","elasticsearch","admin"],"pid":13,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["warning","elasticsearch","admin"],"pid":13,"message":"No living connections"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["status","plugin:console@5.6.9","info"],"pid":13,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["status","plugin:elasticsearch@5.6.9","error"],"pid":13,"state":"red","message":"Status changed from yellow to red - Unable to connect to Elasticsearch at http://elasticsearch:9200.","prevState":"yellow","prevMsg":"Waiting for Elasticsearch"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:20Z","tags":["status","plugin:metrics@5.6.9","info"],"pid":13,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:21Z","tags":["status","plugin:timelion@5.6.9","info"],"pid":13,"state":"green","message":"Status changed from uninitialized to green - Ready","prevState":"uninitialized","prevMsg":"uninitialized"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:21Z","tags":["listening","info"],"pid":13,"message":"Server running at http://0.0.0.0:5601"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:21Z","tags":["status","ui settings","error"],"pid":13,"state":"red","message":"Status changed from uninitialized to red - Elasticsearch plugin is red","prevState":"uninitialized","prevMsg":"uninitialized"}
elasticsearch_1  | [2018-06-26T19:08:21,190][INFO ][o.e.d.DiscoveryModule    ] [PVmTsqv] using discovery type [zen]
elasticsearch_1  | [2018-06-26T19:08:21,654][INFO ][o.e.n.Node               ] initialized
elasticsearch_1  | [2018-06-26T19:08:21,654][INFO ][o.e.n.Node               ] [PVmTsqv] starting ...
elasticsearch_1  | [2018-06-26T19:08:21,780][INFO ][o.e.t.TransportService   ] [PVmTsqv] publish_address {127.0.0.1:9300}, bound_addresses {127.0.0.1:9300}
logstash_1       | log4j:WARN No appenders could be found for logger (io.netty.util.internal.logging.InternalLoggerFactory).
logstash_1       | log4j:WARN Please initialize the log4j system properly.
logstash_1       | log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:23Z","tags":["warning","elasticsearch","admin"],"pid":13,"message":"Unable to revive connection: http://elasticsearch:9200/"}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:23Z","tags":["warning","elasticsearch","admin"],"pid":13,"message":"No living connections"}
logstash_1       | {:timestamp=>"2018-06-26T19:08:23.572000+0000", :message=>"Connection refused (Connection refused)", :class=>"Manticore::SocketException", :level=>:error}
logstash_1       | {:timestamp=>"2018-06-26T19:08:23.790000+0000", :message=>"Pipeline main started"}
elasticsearch_1  | [2018-06-26T19:08:24,837][INFO ][o.e.c.s.ClusterService   ] [PVmTsqv] new_master {PVmTsqv}{PVmTsqv3QnyS3sQarPcJ-A}{coD5A4HyR7-1MedSq8dFUQ}{127.0.0.1}{127.0.0.1:9300}, reason: zen-disco-elected-as-master ([0] nodes joined)[, ]
elasticsearch_1  | [2018-06-26T19:08:24,869][INFO ][o.e.h.n.Netty4HttpServerTransport] [PVmTsqv] publish_address {172.18.0.2:9200}, bound_addresses {0.0.0.0:9200}
elasticsearch_1  | [2018-06-26T19:08:24,870][INFO ][o.e.n.Node               ] [PVmTsqv] started
elasticsearch_1  | [2018-06-26T19:08:24,989][INFO ][o.e.g.GatewayService     ] [PVmTsqv] recovered [1] indices into cluster_state
elasticsearch_1  | [2018-06-26T19:08:25,148][INFO ][o.e.c.r.a.AllocationService] [PVmTsqv] Cluster health status changed from [RED] to [YELLOW] (reason: [shards started [[.kibana][0]] ...]).
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:26Z","tags":["status","plugin:elasticsearch@5.6.9","info"],"pid":13,"state":"green","message":"Status changed from red to green - Kibana index ready","prevState":"red","prevMsg":"Unable to connect to Elasticsearch at http://elasticsearch:9200."}
kibana_1         | {"type":"log","@timestamp":"2018-06-26T19:08:26Z","tags":["status","ui settings","info"],"pid":13,"state":"green","message":"Status changed from red to green - Ready","prevState":"red","prevMsg":"Elasticsearch plugin is red"}

=================================================filebeat。yml==============================

filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /jenkins/gerrit_volume/logs/*_log
#============================= Filebeat modules ===============================
filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false
#==================== Elasticsearch template setting ==========================
setup.template.settings:
  index.number_of_shards: 3
#============================== Kibana =====================================
setup.kibana:
  #host: "localhost:5601"
#----------------------------- Logstash output --------------------------------
output.logstash:
  # The Logstash hosts
  hosts: ["10.1.9.69:5044"]

logging.level: debug

共有1个答案

姚高韵
2023-03-14

这似乎是日志记录中的elasticsearch问题,导致ES无法初始化。这一行:

elasticsearch_1  | [2018-06-22T19:31:38,776][WARN ][o.e.b.BootstrapChecks    ] [g8HPieb] max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144]

可以使用以下命令临时将其启动:

sysctl -w vm.max_map_count=262144

或者通过在/etc/sysctl中添加以下行来永久设置它。conf并运行sysctl-p以获取配置(如果您在一个活动实例上):

vm.max_map_count=262144

因为这是在Docker容器中进行的,所以可能需要在/etc/sysctl中使用后一个选项。形态。

参考:https://www.elastic.co/guide/en/elasticsearch/reference/current/vm-max-map-count.html

 类似资料:
  • 我已经在Google VM实例(Ubuntu-16.04)中安装了elasticsearch和kibana,并分别进行了配置。我已经检查了elasticsearch和kibana的状态。两者都处于活动(运行状态)。 我已经使用curl-XGET“{ip addr}:9200”命令查看了elasticsearch。输出是 当我试图用curl-XGET“{ip addr}:5601”查看kibana时

  • 试图在localhost中建立从app容器到mysql容器的连接,出现连接拒绝异常 我们正在采取一种docker的方法来调用rest api服务来采用微服务的方法。我们正在建立应用程序容器和mysql容器之间的连接,同时我们编写了一个docker-compose文件,创建了mysql容器和应用程序容器,为这两个容器公开了端口。下面是运行docker-compose文件docker-compose

  • 我试图连接到mysql数据库使用hibernate从cfg文件作为 虽然我的连接字符串、用户名、密码是正确的,并且在其他具有基本jdbc连接的项目中运行良好,但当我使用hibernate尝试它时,我在控制台上遇到了这个错误 是的,数据库服务器已启动并运行,但来自此Hibernate应用程序的连接被拒绝

  • 我已经确认Alpine/Socat正在http://127.0.0.1:2376上运行/可能是守护进程未连接的问题,请提供帮助。使用OSX的TIA 连接被拒绝:/127.0.0.1:2376 java.net.connectException:连接被拒绝导致:io.netty.channel.abstractChannel$annotatedConnectException:连接被拒绝:/127.

  • 我试图通过Jedis客户端连接到redis服务器,但在连接时我得到了以下异常和堆栈跟踪- redisconnectionFailureException:无法获得Jedis连接;嵌套异常是redis.clients.jedis.exceptions.jedisconnectionException:无法从位于org.springframework.data.redis.connection.jed

  • 开始使用 Kibana 前,需要告诉 Kibana 您想要探索的 Elasticsearch 索引。第一次访问 Kibana 时,会提示您定义一个 index pattern(索引模式) 匹配一个或多个索引。这就是初次使用 Kibana 时所有需要配置的。任何时候都可以在 Management 页面增加索引模式。 提示:默认情况下,Kibana 会连接运行在 localhost 上的 Elasti