Docker中怎么部署elasticsearch
今天就跟大家聊聊有关Docker中怎么部署elasticsearch,可能很多人都不太了解,为了让大家更加了解,小编给大家总结了以下内容,希望大家根据这篇文章可以有所收获。
创新互联主要从事网站设计制作、成都网站建设、网页设计、企业做网站、公司建网站等业务。立足成都服务绥棱,十余年网站建设经验,价格优惠、服务专业,欢迎来电咨询建站服务:18980820575
version: '2' services: elasticsearch: image: elasticsearch:7.12.0 container_name: es01 environment: - "discovery.type=single-node" - "ES_JAVA_OPTS=-Xmx256m -Xms256m" - xpack.security.enabled=true - xpack.license.self_generated.type=basic - xpack.security.transport.ssl.enabled=true volumes: - /opt/docker/elasticsearch/data:/usr/share/elasticsearch/data:rw - /opt/docker/elasticsearch/plugins:/usr/share/elasticsearch/plugins - /opt/docker/elasticsearch/logs:/usr/share/elasticsearch/logs ports: - "9200:9200" - "9300:9300" networks: - elk networks: elk: driver: bridge
继部署单机,快速使用后,设置密码只需要加上xpack相关配置即可
重启容器(docker-compose restart)后,进入容器生成密码
# 进入容器 root# docker exec -it es01 /bin/bash # 在容器内,执行自动生成密码命令 [root@8b97a00d4223 elasticsearch]# bin/elasticsearch-setup-passwords auto Initiating the setup of passwords for reserved users elastic,apm_system,kibana,kibana_system,logstash_system,beats_system,remote_monitoring_user. The passwords will be randomly generated and printed to the console. Please confirm that you would like to continue [y/N]y Changed password for user apm_system PASSWORD apm_system = *** Changed password for user kibana_system PASSWORD kibana_system = *** Changed password for user kibana PASSWORD kibana = *** Changed password for user logstash_system PASSWORD logstash_system = *** Changed password for user beats_system PASSWORD beats_system = *** Changed password for user remote_monitoring_user PASSWORD remote_monitoring_user = *** Changed password for user elastic PASSWORD elastic = ***
至此密码已经设置成功,可以使用对应用户名和密码访问了,***为自动生成的密码,记住即可。
若要重置密码,修改配置,注释掉这一行配置后重启容器:
#- xpack.security.enabled=true
然后访问
curl -XGET "http://localhost:9200/_cat/indices?pretty" -H 'Content-Type: application/json'
会出现一个索引: .security-7 ,删除即可
curl -XDELETE http://localhost:9200/.security-7
看完上述内容,你们对Docker中怎么部署elasticsearch有进一步的了解吗?如果还想了解更多知识或者相关内容,请关注创新互联行业资讯频道,感谢大家的支持。
分享题目:Docker中怎么部署elasticsearch
标题网址:http://azwzsj.com/article/jgodis.html