Elasticsearch添加认证报错

技术 置顶 精帖
0 1,014
peng49
peng49 2021-07-09 11:23:12
 

通过官网文档再 elasticsearch.yml 文件中添加如下配置

  1. xpack.security.enabled: true

重启服务失败
查看日志报错如下

  1. [vagrant@localhost ~]$ sudo tail -f /var/log/elasticsearch/application.log
  2. [2021-07-09T11:17:18,662][INFO ][o.e.t.TransportService ] [node-1] publish_address {10.0.2.15:9300}, bound_addresses {[::]:9300}
  3. [2021-07-09T11:17:19,279][INFO ][o.e.b.BootstrapChecks ] [node-1] bound or publishing to a non-loopback address, enforcing bootstrap checks
  4. [2021-07-09T11:17:19,311][ERROR][o.e.b.Bootstrap ] [node-1] node validation exception
  5. [1] bootstrap checks failed. You must address the points described in the following [1] lines before starting Elasticsearch.
  6. bootstrap check failure [1] of [1]: Transport SSL must be enabled if security is enabled on a [basic] license. Please set [xpack.security.transport.ssl.enabled] to [true] or disable security by setting [xpack.security.enabled] to [false]
  7. [2021-07-09T11:17:19,318][INFO ][o.e.n.Node ] [node-1] stopping ...
  8. [2021-07-09T11:17:19,335][INFO ][o.e.n.Node ] [node-1] stopped
  9. [2021-07-09T11:17:19,336][INFO ][o.e.n.Node ] [node-1] closing ...
  10. [2021-07-09T11:17:19,353][INFO ][o.e.n.Node ] [node-1] closed
  11. [2021-07-09T11:17:19,355][INFO ][o.e.x.m.p.NativeController] [node-1] Native controller process has stopped - no new native processes can be started

有报错可知需要在配置文件中再添加

  1. xpack.security.transport.ssl.enabled: true

将配置添加到 elasticsearch.yml 文件中

启动服务成功

或者注释集群的配置,添加 discovery.type: single-node 配置,标识这个单个节点的es也可以

  1. # 注释掉集群配置
  2. # cluster.initial_master_nodes: ["node-1"]
  3. discovery.type: single-node

使用

/usr/share/elasticsearch/bin/elasticsearch-setup-passwords auto

命令生成默认账号和密码

保存生成的账号和密码即可

回帖
登录
忘记密码?