计算机学习

您现在的位置是:首页 > Elasticsearch8.0 > php-client > 正文

php-client

elasticsearch设置访问密码

hhb2025-01-20php-client35
vi bin/elasticsearch.yml设置xpack.security.enabled: true


vi bin/elasticsearch.yml
设置
xpack.security.enabled: true

设置内置用户的密码

Elasticsearch提供了一组内置用户,如elastickibanalogstash_system等。你可以通过运行以下命令来设置这些内置用户的密码

./bin/elasticsearch-setup-passwords interactive

执行该命令后,系统会提示你为每个内置用户设置密码。你需要为每个用户输入并确认密码。

执行./bin/elasticsearch-setup-passwords interactive,出现以下报错

1737305133744.png

按照提示执行

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

表示要重置elastic的密码

1737305231611.png

把上面的密码,输入然后就可以登陆了

1737305313333.png

php通过setBasicAuthentication配置登陆用户名和密码(xxx为上面重置生成的密码)就可以连接了

$client = Elastic\Elasticsearch\ClientBuilder::create()->setBasicAuthentication('elastic', 'xxxx')->setHosts(['http://129.211.188.74:9200'])->build();


发表评论

评论列表

  • 访客(2024-07-06 05:01:32)回复取消回复

    管它三七二十一!http://42euw.hfltgg.com/