gpt4 book ai didi

docker - 使用docker-compose将Elasticsearch请求/查询记录到docker实例的stdout中

转载 作者:行者123 更新时间:2023-12-02 19:00:28 27 4
gpt4 key购买 nike

我正在尝试使用dockerhub上的普通docker容器在本地运行Elasticsearch(出于开发目的)。

当我在本地运行实例时,我希望看到所有查询都转储到stdout / console上,这样我就可以轻松地查看我的Elastic-SDK客户端创建/组成/执行的查询。

我在该地点周围看到了一些评论,建议可以通过自定义各种设置来完成此操作,例如:

index.search.slowlog.threshold.query.debug: 0s
index.search.slowlog.threshold.fetch.debug: 0s
index.indexing.slowlog.threshold.index.debug: 0s

但是我不确定如何通过docker-compose做到这一点。

我尝试了以下操作,但ES在启动时崩溃:
version: '3.5'

services:

elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.2.0
container_name: my-elasticsearch
networks:
- my-network
ports:
- "9200:9200"
- "9300:9300"
environment:
- discovery.type=single-node
- index.indexing.slowlog.threshold.index.deb=0s
- index.search.slowlog.threshold.fetch.debug=0s
- index.search.slowlog.threshold.query.debug=0s

有办法吗?

最佳答案

为版本等于或大于5.X的版本添加另一个答案,

  • 这些是当前使用的主要版本。
  • 有问题的设置已从Elasticsearch 5.X中弃用,在elasticsearch.yml中使用它们会引发以下错误:

  • elasticsearch | {"type": "server", "timestamp": "2020-04-04T10:18:57,720Z", "level": "WARN", "component": "o.e.c.s.SettingsModule", "cluster.name": "ami-es", "node.name": "e35893907d50", "message": "\n*************************************************************************************\nFound index level settings on node level configuration.\n\nSince elasticsearch 5.x index level settings can NOT be set on the nodes \nconfiguration like the elasticsearch.yaml, in system properties or command line \narguments.In order to upgrade all indices the settings must be updated via the \n/${index}/_settings API. Unless all settings are dynamic all indices must be closed \nin order to apply the upgradeIndices created in the future should use index templates \nto set default values. \n\nPlease ensure all required values are updated on all indices by executing: \n\ncurl -XPUT 'http://localhost:9200/_all/_settings?preserve_existing=true' -d '{\n \"index.indexing.slowlog.threshold.index.debug\" : \"0ms\",\n \"index.search.slowlog.threshold.fetch.debug\" : \"0ms\",\n \"index.search.slowlog.threshold.query.debug\" : \"0ms\"\n}'\n*************************************************************************************\n" }



    基本上是为了解决它,而不是在elasticsearch.yml中提及它们,只需单击下面的API即可。

    放置http:// {{hostname}}:{{es-port}} / {{index-name}} / _settings
    {
    "index.indexing.slowlog.threshold.index.warn": "0s",
    "index.indexing.slowlog.threshold.index.info": "0s",
    "index.indexing.slowlog.threshold.index.debug": "0s",
    "index.indexing.slowlog.threshold.index.trace": "0s",
    "index.indexing.slowlog.level": "info",
    "index.indexing.slowlog.source": "1000"
    }

    关于docker - 使用docker-compose将Elasticsearch请求/查询记录到docker实例的stdout中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60884748/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com