Saki's 研究记录

Elasticsearch: missing authentication credentials for REST request

字数统计: 94阅读时长: 1 min
2021/11/17

场景

Elasticsearch在开启xpack认证之后, 直接通过curl访问接口会报错:

1
missing authentication credentials for REST request

解决

使用curl时带上认证相关参数:

-u, –user <user:password> Server user and password

在终端curl请求ESREST API时, 可以用以下形式:

1
2
curl -u yourusername:yourpassword -XGET ‘localhost:9200/_cat/health’
1637081511 16:51:51 elasticsearch green 1 1 8 8 0 0 0 0 - 100.0%

Done.

CATALOG
  1. 1. 场景
  2. 2. 解决