cent + docker 安装elasticsearch,设置密码并启动测试和正式双实例

简易启动, 为了复制配置文件

docker run --name es -e “discovery.type=single-node” -e “ES_JAVA_OPTS=-Xms512m -Xmx512m” -d elasticsearch:7.17.10

复制配置

docker cp es://usr/share/elasticsearch/config /root/docker/es

修改配置,激活使用密码访问

vi /root//docker/es/config/elasticsearch.yml

增加内容:

http.cors.enabled: true
http.cors.allow-origin: “*”
http.cors.allow-headers: Authorization
xpack.security.enabled: true
xpack.security.transport.ssl.enabled: true

删除简易版

docker rm -f es

es0

docker run -p 9200:9200 -p 9300:9300 --name es0 --restart=always --privileged=true
-e “discovery.type=single-node” -e “ES_JAVA_OPTS=-Xms512m -Xmx512m”
-v /root/docker/es/data/ds0:/usr/share/elasticsearch/data
-v /root/docker/es/logs:/usr/share/elasticsearch/log

你可能感兴趣的:(百万架构师重要笔记,docker,100.上线运维,docker,elasticsearch,容器)