一、安装elasticsearch
1、拉取镜像
docker pull elasticsearch:7.12.1
2、构建容器&运行
docker run --name elasticsearch -d -p 9200:9200 -p 9300:9300 -e "discovery.type=single-node" elasticsearch:7.12.1
3、修改配置
1、进入容器&打开文件
docker exec -it es bash
cd config
vi elasticsearch.yml
2、编辑文件
http.cors.enabled: true
http.cors.allow-origin: "*"
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true
3、重启es并设置密码
cd bin
elasticsearch-setup-passwords interactive
// 输出
Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user.
You will be prompted to enter passwords as the process progresses.
Please confirm