首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法登录到弹性搜索

无法登录到弹性搜索
EN

Stack Overflow用户
提问于 2019-09-16 21:06:32
回答 1查看 6.8K关注 0票数 0

我正在尝试设置Filebeats/Elasticsearch/Kibana来监视我的应用程序的日志文件。

下面我有一个相当小的作曲节目。

当我进入localhost:19200时,我能够在启用安全性之前获得弹性搜索响应。现在,它促使我登录。然而,elasticchange以及kibanachangeme都不被接受。

试图用curl更改密码

代码语言:javascript
复制
curl  -XPOST -u elastic:changeme 'localhost:19200/_security/user/elastic/_password' -H "Content-Type: application/json" -d "{
  \"password\" : \"insecure\"
}"

如果身份验证错误,也会失败。

从服务器日志中,错误为

elasticsearch_1 | {"type": "server", "timestamp": "2019-09-16T20:59:06,588+0000", "level": "INFO", "component": "o.e.x.s.a.AuthenticationService", "cluster.name": "compass", "node.name": "node-1", "cluster.uuid": "RZ_T1pT5Tp--3Jm8q89NVw", "node.id": "Q-lFQ58gRGOPPOEyzy6Vrw", "message": "Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]" }

返回给curl的JSON是

{"error":{"root_cause":[{"type":"security_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}}],"type":"security_exception","reason":"failed to authenticate user [elastic]","header":{"WWW-Authenticate":"Basic realm=\"security\" charset=\"UTF-8\""}},"status":401}

我做错了什么?

docker-compose.yml

代码语言:javascript
复制
version: "2.4"

services:
  # Accumulate logs into elasticstack
  elasticsearch:
    image: "docker.elastic.co/elasticsearch/elasticsearch:${ELASTIC_VERSION}"
    environment:
      - http.host=0.0.0.0
      - transport.host=127.0.0.1
      - bootstrap.memory_lock=true
      - "ES_JAVA_OPTS=-Xms${ES_JVM_HEAP} -Xmx${ES_JVM_HEAP}"
    mem_limit: ${ES_MEM_LIMIT}
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - ./config/elasticsearch/elasticsearch.yml:/usr/share/elasticsearch/config/elasticsearch.yml
      - data:/usr/share/elasticsearch/data

      #Port 9200 is available on the host. Need to for user to access as well as Packetbeat
    ports: ['19200:9200']
    #Healthcheck to confirm availability of ES. Other containers wait on this.
    healthcheck:
      test: ["CMD", "curl","-s" ,"-f", "-u", "elastic:${ES_PASSWORD}", "http://localhost:9200/_cat/health"]
    #Internal network for the containers
    networks: ['stack']

volumes:
  #Es data
  data:
    driver: local
networks: {stack: {}}

.env

代码语言:javascript
复制
#ELK Stack
ELASTIC_VERSION=7.3.2
ES_PASSWORD=insecure
ES_MEM_LIMIT=2g
ES_JVM_HEAP=1024m

config/elasticsearch/elasticsearch.yml

代码语言:javascript
复制
cluster.name: compass
node.name: node-1
path.data: /usr/share/elasticsearch/data
http.port: 9200
network.host: 0.0.0.0
xpack.security:
  enabled: true
  transport.ssl.enabled: true
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-09-17 10:33:58

启用安全性时,应设置内置用户密码,使用

代码语言:javascript
复制
./bin/elasticsearch-setup-passwords interactive

请参阅https://www.elastic.co/guide/en/elastic-stack-overview/current/get-started-built-in-users.html

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57964421

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档