我在这里的想法是专门将endpoint\u mode设置为dnsrr,希望服务中的每个elasticsearch任务在启动发现播种过程时都能获取一个随机的ip地址。这不管用。如果它在播种时进入一个循环,而从不决定主控形状,会发生什么呢。我特别想找到一些优雅的配置,以便在每个不包括静态配置文件或compose文件中的多个服务声明的节点上部署它。
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:7.9.3
environment:
- cluster.name=es-cluster
- discovery.type=zen
- discovery.seed_hosts=elasticsearch
- cluster.initial_master_nodes=elasticsearch
- bootstrap.memory_lock=false
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
- network.host=0.0.0.0
volumes:
- elasticsearch_data:/usr/share/elasticsearch/data
networks:
- elasticsearch
deploy:
mode: global
endpoint_mode: dnsrr
volumes:
...
elasticsearch_data:
networks:
...
elasticsearch:
部署后,我只是在日志中反复看到(对于每个任务):
web-services_elasticsearch.0.a6ilzu8ev6sp@dsnode3.<redacted> | {"type": "server",
"timestamp": "2020- 11-10T21:47:38,443Z", "level": "WARN", "component":
"o.e.c.c.ClusterFormationFailureHelper", "cluster.name": "es-cluster", "node.name":
"718a5740c014", "message": "master not discovered yet, this node has not previously
joined a bootstrapped (v7+) cluster, and this node must discover master-eligible
nodes [elasticsearch] to bootstrap a cluster: have discovered [{718a5740c014}
{wMUW_UyQSzSxJDaz5jYVUw} {iBXmoZqHSp24fKSEUvuUpw}{10.0.46.129}{10.0.46.129:9300}
{dilmrt} {ml.machine_memory=67428794368, xpack.installed=true, transform.node=true,
ml.max_open_jobs=20}, {99680d51349a}{BBqgO_1wRamiJZGibrhVTw}{WH6Oy5gOR1Cqs-2LUzu9Mw}
{10.0.46.123} {10.0.46.123:9300}{dilmrt}{ml.machine_memory=67424575488,
ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {27bf85fa9967}
{Fm9r8aX4Rr-xa8AF_dUaLQ} {LsL5cXghTayDtXtLeWGV3Q}{10.0.46.126}{10.0.46.126:9300}
{dilmrt} {ml.machine_memory=67424575488, ml.max_open_jobs=20, xpack.installed=true,
transform.node=true}, {fc2900a7227a}{FUztkTZQQuWqi3lyuOOfSQ}{JzACTEvzSnepc9RGXBXCzw}
{10.0.46.131} {10.0.46.131:9300}{dilmrt}{ml.machine_memory=67428794368,
ml.max_open_jobs=20, xpack.installed=true, transform.node=true}, {7b23784db269}
{Dn472Qx5RyekUMY2jeLjIA}{w- m1g1BtS6SzZkttZEidnA}{10.0.46.122}{10.0.46.122:9300}
{dilmrt}{ml.machine_memory=67424575488, ml.max_open_jobs=20, xpack.installed=true,
transform.node=true}, {7d41b0583448} {1pj_6kJZQu6n39waIzcvQQ}{xwNHOG15Q_6jwY20BbBuyQ}
{10.0.46.125}{10.0.46.125:9300}{dilmrt} {ml.machine_memory=67428794368,
ml.max_open_jobs=20, xpack.installed=true, transform.node=true}]; discovery will
continue using [10.0.46.123:9300, 10.0.46.126:9300, 10.0.46.131:9300,
10.0.46.122:9300, 10.0.46.125:9300] from hosts providers and [{718a5740c014}
{wMUW_UyQSzSxJDaz5jYVUw} {iBXmoZqHSp24fKSEUvuUpw}{10.0.46.129}{10.0.46.129:9300}
{dilmrt} {ml.machine_memory=67428794368, xpack.installed=true, transform.node=true,
ml.max_open_jobs=20}] from last-known cluster state; node term 0, last-accepted
version 0 in term 0" }
我觉得这只是node.name与主机名不匹配的问题,但是主机名的设置是正确的。例子:
# docker exec -it web-services_elasticsearch.e3eaakkldj7pa3ygwkqwxts4i.7gjyxyjfjscve6rw41of7fyld hostname
fc2900a7227a
任何想法都将不胜感激。
1条答案
按热度按时间slhcrj9b1#
必须将hostname和node.name设置为“{.node.hostname}}”,然后在列表中列出所有可能的主机名
cluster.initial_master_nodes
环境。{{.node.hostname}}将是DockerSwarm节点的主机名。以下工作。