Docker中的Elasticsearch没有到主机的路由
我对Docker中的Elasticsearch 5有问题 堆栈组合文件:Docker中的Elasticsearch没有到主机的路由,docker,
elasticsearch,Docker,
elasticsearch,我对Docker中的Elasticsearch 5有问题 堆栈组合文件: version: "3.4" services: elastic01: &elasticbase image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7 networks: - default restart: always environment:
version: "3.4"
services:
elastic01: &elasticbase
image: docker.elastic.co/elasticsearch/elasticsearch:5.6.7
networks:
- default
restart: always
environment:
- node.name=elastic01
- cluster.name=elastic
- network.host=0.0.0.0
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- xpack.watcher.enabled=false
- bootstrap.memory_lock=false ## Docker swarm does not support that
- discovery.zen.minimum_master_nodes=2
- discovery.zen.ping.unicast.hosts=elastic02,elastic03
volumes:
- /var/docker/elastic:/usr/share/elasticsearch/data
deploy:
placement:
constraints: [node.hostname == node1]
elastic02:
<<: *elasticbase
depends_on:
- elastic01
environment:
- node.name=elastic02
- cluster.name=elastic
- network.host=0.0.0.0
- xpack.security.enabled=false
- xpack.monitoring.enabled=false
- xpack.watcher.enabled=false
- bootstrap.memory_lock=false ## Docker swarm does not support that
- discovery.zen.minimum_master_nodes=2
- discovery.zen.ping.unicast.hosts=elastic01,elastic03
volumes:
- /var/docker/elastic:/usr/share/elasticsearch/data
deploy:
placement:
constraints: [node.hostname == node2]
elastic03:
<<: *elasticbase
depends_on:
- elastic01
volumes:
- /var/docker/elastic:/usr/share/elasticsearch/data
environment:
- node.name=elastic03
- cluster.name=elastic
- network.host=0.0.0.0
- xpack.security.enabled=false
- bootstrap.memory_lock=false ## Docker swarm does not support that
- discovery.zen.minimum_master_nodes=2
- discovery.zen.ping.unicast.hosts=elastic01,elastic02
deploy:
placement:
constraints: [node.hostname == node3]
networks:
default:
driver: overlay
attachable: true
有时:
Feb 10 09:44:10 [2018-02-10T08:44:10,810][WARN ][o.e.t.n.Netty4Transport ] [elastic01] exception caught on transport layer [[id: 0x3675891a, L:/10.0.9.210:53316 - R:10.0.9.5/10.0.9.5:9300]], closing connection
Feb 10 09:44:10 java.io.IOException: No route to host
Feb 10 09:44:10 at sun.nio.ch.FileDispatcherImpl.read0(Native Method) ~[?:?]
Feb 10 09:44:10 at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:39) ~[?:?]
Feb 10 09:44:10 at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) ~[?:?]
Feb 10 09:44:10 at sun.nio.ch.IOUtil.read(IOUtil.java:197) ~[?:?]
Feb 10 09:44:10 at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) ~[?:?]
Feb 10 09:44:10 at io.netty.buffer.PooledHeapByteBuf.setBytes(PooledHeapByteBuf.java:261) ~[netty-buffer-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1100) ~[netty-buffer-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.channel.socket.nio.NioSocketChannel.doReadBytes(NioSocketChannel.java:372) ~[netty-transport-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:123) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:544) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458) [netty-transport-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-common-4.1.13.Final.jar:4.1.13.Final]
Feb 10 09:44:10 at java.lang.Thread.run(Thread.java:748) [?:1.8.0_161]
奇怪的是,每次它发生时,我都能够ping容器并从发生的容器解析名称。没有数据包丢失,没有超时。唯一不好的是弹性体中的传输层。所有其他服务都在同一集群中运行,没有问题(MongoDB、Redis、内部微服务)
有人有线索吗?我发现了这个问题
Elasticsearch必须绑定到单个接口,而不是0.0.0.0。一旦我将它绑定到eth0,它就开始工作了。此外,它看起来无法命名卷-在此期间它会抛出另一个错误。它必须直接安装到本地驱动器上
这项工作:
services:
elastic01:
environment:
network.host=_eth0_
services:
elastic01:
environment:
network.host=_eth0_