通过登录到新设置的3节点群集docker exec -it es01 sh
并运行bin/elasticsearch-setup-passwords interactive --url https://localhost:9200
为内置ES帐户设置密码时
**获取错误:**sh-5.0# bin/ElasticSearch设置密码交互式--url https://localhost:9200
Failed to determine the health of the cluster running at https://localhost:9200
Unexpected response code [503] from calling GET https://localhost:9200/_cluster/health?pretty
Cause: master_not_discovered_exception
同样curl抛出以下错误:
sudo curl -X GET 'https://localhost:9200'
curl: (7) Failed connect to localhost:9200; Connection refused
sudo curl -X GET 'https://localhost:9216'
curl: (35) Encountered end of file
.P12已传输各个节点的证书。在elasticsearch.yml下面
cluster.name: "docker-cluster"
network.host: 0.0.0.0
使用docker-compose设置一个3节点Elasticsearch集群。执行以下步骤:
1.初始化一个 Docker 群。在ES 11上运行 Docker 群初始化。按照说明将12和13加入到 Docker 群中。
1.创建一个覆盖网络docker网络创建-d覆盖--可附加的弹性
1.如有必要,通过运行docker-compose down -v关闭当前群集并删除所有关联的卷
1.使用docker-compose -f创建证书为ES创建SSL证书。yml run --rm创建证书
1.将es 02和03的证书复制到各自的服务器
1.使用此busybox在02和03 sudo docker run -itd --name containerX --net [网络名称] busybox上创建覆盖网络
1.使用docker-compose -f config-certs在02和03上配置证书。yml run --rm config_certs
1.在每台服务器上使用docker-composite up -d启动群集
1.通过登录到集群docker exec -it es 11 sh,然后运行bin/elasticsearch-setup-passwords interactive --url localhost,为内置ES帐户设置密码:9200
在第9步中得到所提到的错误。我遗漏了什么?
在docker-compose.yml文件下面
version: '2.2'
services:
es11:
image: docker.elastic.co/elasticsearch/elasticsearch:${VERSION}
container_name: es11
environment:
- node.name=es11
- transport.port=9316
- cluster.name=uat-lands
- discovery.seed_hosts=es12,es13
- cluster.initial_master_nodes=es11,es12,es13
- bootstrap.memory_lock=true
- "ES_JAVA_OPTS=-Xms4096m -Xmx4096m"
- xpack.security.enabled=true
- xpack.security.http.ssl.enabled=true
- xpack.security.http.ssl.verification_mode=certificate
- xpack.security.http.ssl.keystore.path=${CERTS_DIR}/es11/es11.p12
- xpack.security.http.ssl.truststore.path=${CERTS_DIR}/es11/es11.p12
- xpack.security.transport.ssl.enabled=true
- xpack.security.transport.ssl.verification_mode=certificate
- xpack.security.transport.ssl.keystore.path=${CERTS_DIR}/es11/es11.p12
- xpack.security.transport.ssl.truststore.path=${CERTS_DIR}/es11/es11.p12
ulimits:
memlock:
soft: -1
hard: -1
volumes:
- data:/usr/share/elasticsearch/data
- config:/usr/share/elasticsearch/config
- log:/usr/share/elasticsearch/logs
ports:
- 9216:9200
- 9316:9316
networks:
- elastic
dns:
- es11
healthcheck:
test: curl -k -s https://localhost:9200 >/dev/null; if [[ $$? == 52 ]]; then echo 0; else echo 1; fi
interval: 30s
timeout: 10s
retries: 5
volumes:
data:
driver: local
driver_opts:
config:
driver: local
driver_opts:
type: none
device: '/mnt/elasticmount/es11/config'
o: bind
log:
driver: local
driver_opts:
type: none
device: '/mnt/elasticmount/es11/log'
o: bind
networks:
elastic:
driver: overlay
1条答案
按热度按时间xtfmy6hx1#
你的集群没有配置。我不知道你是怎么创建的。使用弹性文档在Docker中通过Docker-compose启动集群。