elastic 访问9200 认证无法登陆,日志 出现 401 问题?同样的 访问 kibana http://ip:5601 出现:Kibana server is not ready yet访问异常 ?

    日志信息如下:

    1. [2020-05-22T17:13:30,401][INFO ][o.e.x.s.a.AuthenticationService] [10.10.28.92] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]
    2. [2020-05-22T17:20:49,401][INFO ][o.e.x.s.a.AuthenticationService] [10.10.28.92] Authentication of [elastic] was terminated by realm [reserved] - failed to authenticate user [elastic]

    (1)本地 验证 elastic 账户
    curl -u elastic ‘http://localhost:9200/_xpack/security/_authenticate?pretty
    11.9、elastic 账户认证 401 问题 - 图1

    (2)检查 es 配置;
    切换 elastic 主目录
    vi config/elasticsearch.yml

    1. http.cors.enabled: true
    2. http.cors.allow-origin: "*"
    3. http.cors.allow-headers: Authorization,X-Requested-With,Content-Length,Content-Type
    4. #
    5. xpack.ml.enabled: false
    6. xpack.security.enabled: true
    7. xpack.security.transport.ssl.enabled: true

    (3)检查 kibana 配置;
    切换 kibana 主目录
    vi kibana/config/kibana.yml

    1. elasticsearch.username: "elastic"
    2. elasticsearch.password: "elastic"

    (4)elasticsearch 7.6.2 重置密码;
    重置 elastic 账户密码

    1. curl -u elastic -XPUT 'http://localhost:9200/_xpack/security/user/elastic/_password?pretty' -H 'Content-Type: application/json' -d'
    2. {
    3. "password" : "elastic"
    4. }
    5. '

    (5)如果 重置依然出现问题 ?
    切换 es 主目录 执行 elasticsearch-setup-**passwords** 重置所有密码
    ./elasticsearch-setup-passwords interactive
    11.9、elastic 账户认证 401 问题 - 图2