es下载地址:
Past Releases of Elastic Stack Software | Elastic
https://www.elastic.co/cn/downloads/past-releases#elasticsearch
选择8.10版本
进入es bin目录下执行启动命令
./elasticsearch
这个时候localhost:9200无法访问
原因是是因为开启了ssl认证。
新开命令窗口通过命令测试
修改密码需要在es启动,并cd
到es的bin
目录下执行
1.重置密码并在控制台显示新密码(密码是自动生成的复杂度较高)
./elasticsearch-reset-password -u 用户名
例:重置elastic用户的密码:
./elasticsearch-reset-password -u elastic
./elasticsearch-reset-password --username 用户名 -i
例:重置elastic用户的密码为elastic
./elasticsearch-reset-password --username elastic -i
测试是否启动成功,用上面重置的密码替换掉下面命令中Y+Hfk00S90PCNFuQLyDT的密码部分
curl --cacert /Users/wangfengchen/Downloads/elasticsearch/elasticsearch-8.11.0/config/certs/http_ca.crt -u "elastic:Y+Hfk00S90PCNFuQLyDT" https://localhost:9200
如果想用页面访问,在config/elasticsearch.yml文件中把xpack.security.http.ssl:enabled设置成false然后重启es即可,然后用命令访问,此时不用https即可。
curl --cacert /Users/wangfengchen/Downloads/elasticsearch/elasticsearch-8.11.0/config/certs/http_ca.crt -u "elastic:elastic" http://localhost:9200
再用页面也可访问。