elasticsearch 尝试恢复与已失效ES示例的连接,但出现错误{:url=>”http://provider:xxxxxx@192.168.15.29:9200/“

omtl5h9j  于 2023-05-06  发布在  ElasticSearch
关注(0)|答案(1)|浏览(237)

尝试恢复到死ES示例的连接,但收到错误{:url=〉”http://provider:xxxxxx@192.168.15.29:9200/“,:exception=〉LogStash::Outputs::ElasticSearch::HttpClient::Pool::BadResponseCodeError,:message=〉“Got response code '401' contacting Elasticsearch at URL 'http://192.168.15.29:9200/'”}
Logstash URL不起作用。我正在尝试将数据从mongoDB传输到elastic。为此,logstash URL应该起作用。有人能帮忙吗

klr1opcd

klr1opcd1#

Elasticsearch中的HTTP 401错误码表示用户没有被授权访问请求的资源。

您正在使用提供程序用户。确保用户具有写入权限。
你可以用curl来测试:

curl -XPOST "https://192.168.15.29:9200/test-index/_bulk" -H "Content-Type: application/json" -d'
{ "index":{ } }
{ "@timestamp": "2099-05-06T16:21:15.000Z", "message": "192.0.2.42 - - [06/May/2099:16:21:15 +0000] \"GET /images/bg.jpg HTTP/1.0\" 200 24736"}
' -u provider:password

使用超级用户测试(弹性):

curl "https://localhost:9200" -k -u elastic:password

curl "http://localhost:9200" -k -u elastic:password

如果你不记得密码你可以重置elastic user password .

bin/elasticsearch-reset-password -u elastic -i

相关问题