Docker:Kibana和Elasticsearch -已关闭连接

txu3uszq  于 2023-03-11  发布在  Kibana
关注(0)|答案(1)|浏览(209)

当我尝试使用kibana.yml时,服务意外停止工作。我需要设置xpack.encryptedSavedObjects.encryptionKey,因为我需要启用警报。

version: '3'

services:
  elasticsearch:
    container_name: elasticsearch
    image: docker.elastic.co/elasticsearch/elasticsearch:7.8.1
    environment:
      - bootstrap.memory_lock=true
      - discovery.type=single-node
      - ES_JAVA_OPTS=-Xms512m -Xmx512m
    ports:
      - 9200:9200
    networks:
      - elastic
    ulimits:
      memlock:
        soft: -1
        hard: -1
      nofile:
        soft: 65536
        hard: 65536
    stdin_open: true
    tty: true
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: 50

  kibana:
    container_name: kibana
    image: docker.elastic.co/kibana/kibana:7.8.1
    # environment:
    #   XPACK_APM_SERVICEMAPENABLED: "true"
    #   XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: "something_at_least_32_characters"
    ports:
      - 5601:5601
    networks:
      - elastic
    ulimits:
      memlock:
        soft: -1
        hard: -1
    depends_on:
      - elasticsearch
    volumes:
      - ./kibana.yml:/usr/share/kibana/config/kibana.yml
    stdin_open: true
    tty: true
    logging:
      driver: json-file
      options:
        max-size: 10m
        max-file: 50

有了这个注解部分,不使用卷和相对的kibana.yml,一切都很好。

environment:
       XPACK_APM_SERVICEMAPENABLED: "true"
       XPACK_ENCRYPTEDSAVEDOBJECTS_ENCRYPTIONKEY: "something_at_least_32_characters"

但是当我尝试使用kibana.yml时,我无法访问http://127.0.0.1:5601
这里是kibana.yml:

elasticsearch.hosts: ["http://elasticsearch:9200"]

xpack.apm.serviceMapEnabled: true
xpack.encryptedSavedObjects.encryptionKey: something_at_least_32_characters
xpack.reporting.encryptionKey: something_at_least_32_characters
xpack.security.encryptionKey: something_at_least_32_characters

xpack.actions.preconfigured:
  email_notifications:
     name: Gmail Server
     actionTypeId: .email
     config:
       service: other
       from: test@gmail.com
       host: smtp.gmail.com
       port: 587
       secure: false
     secrets:
       user: test@gmail.com
       password: password

下面是kibana日志:

log   [11:05:38.263] [warning][plugins-discovery] Expect plugin "id" in camelCase, but found: apm_oss
  log   [11:05:38.300] [warning][plugins-discovery] Expect plugin "id" in camelCase, but found: triggers_actions_ui
  log   [11:06:31.226] [info][plugins-service] Plugin "visTypeXy" is disabled.
  log   [11:06:31.227] [info][plugins-service] Plugin "endpoint" is disabled.
  log   [11:06:31.227] [info][plugins-service] Plugin "ingestManager" is disabled.
  log   [11:06:31.228] [info][plugins-service] Plugin "lists" is disabled.
  log   [11:06:36.170] [warning][config][deprecation] Config key [monitoring.cluster_alerts.email_notifications.email_address] will be required for email notifications to work in 8.0."
  log   [11:06:36.253] [info][plugins-system] Setting up [94] plugins: [taskManager,licensing,observability,eventLog,encryptedSavedObjects,code,usageCollection,ossTelemetry,telemetryCollectionManager,telemetry,telemetryCollectionXpack,kibanaLegacy,devTools,kibanaReact,translations,uiActions,statusPage,share,newsfeed,mapsLegacy,mapsLegacyLicensing,kibanaUtils,inspector,embeddable,advancedUiActions,embeddableEnhanced,drilldowns,indexPatternManagement,esUiShared,discover,charts,bfetch,expressions,data,home,cloud,console,consoleExtensions,apm_oss,searchprofiler,painlessLab,grokdebugger,management,upgradeAssistant,reporting,licenseManagement,indexManagement,remoteClusters,crossClusterReplication,indexLifecycleManagement,watcher,advancedSettings,telemetryManagementSection,fileUpload,dataEnhanced,visualizations,visTypeVislib,visTypeVega,visTypeTimeseries,rollup,visTypeTimelion,features,security,snapshotRestore,transform,ingestPipelines,canvas,visTypeTagcloud,visTypeTable,visTypeMetric,visTypeMarkdown,inputControlVis,savedObjects,navigation,lens,graph,maps,visualize,dashboard,dashboardEnhanced,savedObjectsManagement,spaces,actions,case,alerting,alertingBuiltins,triggers_actions_ui,infra,monitoring,logstash,uptime,ml,siem,apm]
  log   [11:06:36.469] [warning][config][plugins][security] Session cookies will be transmitted over insecure connections. This is not recommended.
  log   [11:06:36.580] [info][monitoring][monitoring][plugins] config sourced from: production cluster
  log   [11:06:36.581] [warning][monitoring][monitoring][plugins] X-Pack Monitoring Cluster Alerts will not be available: undefined
  log   [11:06:37.064] [info][savedobjects-service] Waiting until all Elasticsearch nodes are compatible with Kibana before starting saved objects migrations...
  log   [11:06:37.069] [info][crossClusterReplication][plugins] Your basic license does not support crossClusterReplication. Please upgrade your license.
  log   [11:06:37.070] [info][plugins][watcher] Your basic license does not support watcher. Please upgrade your license.
  log   [11:06:37.072] [info][kibana-monitoring][monitoring][monitoring][plugins] Starting monitoring stats collection
  log   [11:06:37.099] [info][savedobjects-service] Starting saved objects migrations
  log   [11:06:37.155] [info][savedobjects-service] Creating index .kibana_task_manager_1.
  log   [11:06:37.164] [info][savedobjects-service] Creating index .kibana_1.
  log   [11:06:39.880] [info][savedobjects-service] Pointing alias .kibana_task_manager to .kibana_task_manager_1.
  log   [11:06:39.969] [info][savedobjects-service] Finished in 2814ms.
  log   [11:06:40.024] [info][savedobjects-service] Pointing alias .kibana to .kibana_1.
  log   [11:06:40.092] [info][savedobjects-service] Finished in 2940ms.
  log   [11:06:40.096] [info][plugins-system] Starting [72] plugins: [taskManager,licensing,observability,eventLog,encryptedSavedObjects,code,usageCollection,ossTelemetry,telemetryCollectionManager,telemetry,telemetryCollectionXpack,kibanaLegacy,translations,share,discover,bfetch,expressions,data,home,cloud,console,consoleExtensions,apm_oss,searchprofiler,painlessLab,grokdebugger,management,upgradeAssistant,reporting,licenseManagement,indexManagement,remoteClusters,crossClusterReplication,indexLifecycleManagement,watcher,advancedSettings,fileUpload,dataEnhanced,visualizations,visTypeVislib,visTypeVega,visTypeTimeseries,rollup,visTypeTimelion,features,security,snapshotRestore,transform,ingestPipelines,canvas,visTypeTagcloud,visTypeTable,visTypeMetric,visTypeMarkdown,inputControlVis,lens,graph,visualize,dashboard,savedObjectsManagement,spaces,actions,case,alerting,alertingBuiltins,infra,monitoring,logstash,uptime,ml,siem,apm]
  log   [11:06:43.304] [info][status][plugin:kibana@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:06:43.309] [info][status][plugin:elasticsearch@7.8.1] Status changed from uninitialized to yellow - Waiting for Elasticsearch
  log   [11:06:43.310] [info][status][plugin:elasticsearch@7.8.1] Status changed from yellow to green - Ready
  log   [11:06:43.313] [info][status][plugin:xpack_main@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:06:43.324] [info][status][plugin:monitoring@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:06:43.331] [warning][plugins][reporting] Chromium sandbox provides an additional layer of protection, but is not supported for Linux Centos 7.8.2003 OS. Automatically setting 'xpack.reporting.capture.browser.chromium.disableSandbox: true'.
  log   [11:06:43.333] [warning][reporting] Enabling the Chromium sandbox provides an additional layer of protection.
  log   [11:07:07.541] [info][status][plugin:reporting@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.657] [info][status][plugin:spaces@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.661] [info][status][plugin:security@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.671] [info][status][plugin:dashboard_mode@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.677] [info][status][plugin:beats_management@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.740] [info][status][plugin:maps@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.776] [info][plugins][taskManager][taskManager] TaskManager is identified by the Kibana UUID: 6af31a0d-28ab-4e63-88d0-473cce8c9d86
  log   [11:07:07.783] [info][status][plugin:task_manager@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.786] [info][status][plugin:encryptedSavedObjects@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.790] [info][status][plugin:console_legacy@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.793] [info][status][plugin:apm_oss@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.797] [info][status][plugin:region_map@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.807] [info][status][plugin:ui_metric@7.8.1] Status changed from uninitialized to green - Ready
  log   [11:07:07.816] [info][listening] Server running at http://localhost:5601
  log   [11:07:08.421] [info][server][Kibana][http] http server running at http://localhost:5601

我在日志中没有错误,我不明白为什么kibana服务没有响应。

curl http://127.0.0.1:5601
Underlying Connection Closed: Connection closed unexpectedly.
yyyllmsg

yyyllmsg1#

你不能像这样发送一个curl请求到kibana。尝试以下

curl GET "http://localhost:5601/api/index_management/indices"

如果不起作用,请尝试使用HTTPS,如果出现身份验证错误,请添加
如果将SERVER_HOST: 0.0.0.0设置为Kibana,则可以从外部到达Kibana

相关问题