2017-11-10 10 views
0

私の環境は2つの物理マシンで、どちらもドッカー作成で動作しています。docker-composeを使ってelasticsearchクラスタを設定しようとしています

私はelasticsearchクラスタクロス2ドッカーのコンテナを作成したいと思います。

My architecture like this

2の容器は、互いに任意のアイデアを接続することはできませんか? 5.4.2

ドッカー-compose.yml

version: '2' 

services: 
    elasticsearch: 
    image: es:542 
    hostname: es2 
    container_name: es2 
    user: elasticsearch 
    ports: 
    - 9200:9200 
    - 9300:9300 
    environment: 
    - ES_JAVA_OPTS=-Xms1g -Xmx1g 
    command: /usr/share/elasticsearch/bin/elasticsearch 

elasticsearch.yml

http.host: 0.0.0.0 
transport.host: 0.0.0.0 
discovery.zen.minimum_master_nodes: 2 

cluster.name: prod_es_cluster 
node.name: prod_es_node1 
node.master: true 
node.data: true 
discovery.zen.ping_timeout: 10s 

network.host: 0.0.0.0 
network.bind_host: 0.0.0.0 
network.publish_host: 0.0.0.0 
transport.tcp.port: 9300 
discovery.zen.ping.unicast.hosts: ["127.0.0.1", "[::1]"] 

とログ

ES1 

[2017:

ドッカー画像がelasticsearchを使用しています-11-09T05:56:10,55 2] [INFO] [oetTransportService] [prod_es_node1] publish_address {172.24.0.2:9300}, bound_addresses {[::]:9300} [2017-11-09T05:56:10,558] [oebBootstrapChecks] [prod_es_node1]非ループバックまたは非リンクローカルへのバインドまたはパブリッシングアドレス、ブートストラップチェックを実施する [2017-11-09T05:56:40,576] [警告] [oenNode] [prod_es_node1] timed out while waiting for initial discovery state - timeout: 30s [2017-11-09T05:56:40,584] [情報] [oehnNetty4HttpServerTransport] [prod_es_node1] publish_address {172.24.0.2:9200}, bound_addresses {[::]:9200} [2017-11-09T05は:56:40587]は[情報] [oenNode] [prod_es_node1]開始

ES2 

[2017-11-09T09:37:20084] [WARN] [oedzZenDiscovery] [prod_es_node2]がマスターに接続できませんでした[{prod_es _node1} {BxKzhOnJTUC50cYTz_Hm fAと} {zqtU07jfQJOrmB9AYL01Ig} {172.24.0.2}{172.24.0.2:9300}], retrying... org.elasticsearch.transport.ConnectTransportException:[prod_es_node1] org.elasticsearch.transport.netty4.Netty4Transport.connectToChannels(Netty4Transport.java:361)で[172.24.0.2:9300] connect_timeout[30s] 〜[:?] org.elasticsearch.transport.TcpTransport.openConnection(TcpTransport.java:549)〜[elasticsearch-5.4.2.jar:5.4.2] at org.elasticsearch.transport.TcpTransport.connectToNode(TcpTransport.java:473)〜 [elasticsearch-5.4.2.jar:5.4.2] at org.elasticsearch.transport.TransportService.connectToNode(TransportService.java:315)〜[elasticsearch-5.4.2.jar:5.4.2] at org.elasticsearch .transport.TransportService.connectToNode(TransportService.java:302)〜[elasticsearch-5.4.2.jar:5.4.2] またはg.elasticsearch.discovery.zen.ZenDiscovery.joinElectedMaster(ZenDiscovery.java:468)[elasticsearch-5.4.2.jar:5.4.2] at org.elasticsearch.discovery.zen.ZenDiscovery.innerJoinCluster(ZenDiscovery.java:420) )[elasticsearch-5.4.2.jar:5.4.2] 、org.elasticsearch.discovery.zen.ZenDiscovery.access $ 4100(ZenDiscovery.java:83)[elasticsearch-5.4.2.jar:5.4.2] at org.elasticsearch.discovery.zen.ZenDiscovery $ JoinThreadControl $ 1.run(ZenDiscovery.java:1197)[elasticsearch-5.4.2.jar:5.4.2] at org.elasticsearch.common.util.concurrent.ThreadContext $ ContextPreservingRunnable。 run(ThreadContext.java:569)[elasticsearch-5.4.2。 jar:5.4.2] java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)の [?:1.8.0_131] のjava.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java: 617)[?:1.8.0_131] java.lang.Thread.run(Thread.java:748)[?:1.8.0_131] 原因:io.netty.channel。AbstractChannel $ AnnotatedConnectException:sun.nio.ch.SocketChannelImpl.checkConnect(ネイティブメソッド)でConnection refused: 172.24.0.2/172.24.0.2:9300 〜[:??]

答えて

0

今私は、クラスタネットワークを設定

OVS構築するopenvswitchpipeworkを使用します。

#ES1 
sudo brctl addbr br0 
sudo ip link set dev br0 up 
sudo ovs-vsctl add-br ovs0 
sudo ovs-vsctl set bridge ovs0 stp_enable=true 
sudo ovs-vsctl add-port ovs0 br0 
sudo ovs-vsctl add-port ovs0 gre0 -- set interface gre0 type=gre options:remote_ip=10.251.34.50 

pipwork設定:

sudo pipework-master/pipework br0 -i eth1 es1 172.28.0.2/8 

ドッキングウィンドウコンテナネットワークが通知エーション:

elasticsearchする@ ES1:を/ usr/share/elasticsearch $ IP

521:eth1をする@ if522:1000 リンク/エーテル4E QLEN状態UPグループのデフォルトのpfifo_fast MTU 1500のqdisc:06:91:91 :1F:3EのBRDのFF:FF:FF:FF:FF:FF INET 172.28.0.2/8 BRD 172.255.255.255の範囲グローバルeth1の valid_lftは永遠にpreferred_lft永遠

両方2つのドッカコンテナを設定した後、クラスタは、作業する必要があります!!

ES1

[email protected]:/usr/share/elasticsearch$ ping 172.18.0.2 
PING 172.18.0.2 (172.18.0.2): 56 data bytes 
64 bytes from 172.18.0.2: icmp_seq=0 ttl=64 time=1.222 ms 
64 bytes from 172.18.0.2: icmp_seq=1 ttl=64 time=0.339 ms 
64 bytes from 172.18.0.2: icmp_seq=2 ttl=64 time=0.547 ms 
64 bytes from 172.18.0.2: icmp_seq=3 ttl=64 time=0.303 ms 
64 bytes from 172.18.0.2: icmp_seq=4 ttl=64 time=0.333 ms 
64 bytes from 172.18.0.2: icmp_seq=5 ttl=64 time=0.362 ms` 

ESログ:

[2017-11-17T02:06:21,205][INFO ][o.e.n.Node    ] [prod_es_node1] started 
[2017-11-17T02:06:21,223][INFO ][o.e.c.s.ClusterService ] [prod_es_node1] new_master {prod_es_node1}{IoG7C5BYQ26AYsggMuJo2A}{AL3oD0itR1CgibIr-x-8Sg}{172.28.0.2}{172.28.0.2:9300}, reason: zen-disco-elected-as-master ([0] nodes joined) 
[2017-11-17T02:06:21,254][INFO ][o.e.g.GatewayService  ] [prod_es_node1] recovered [0] indices into cluster_state 
[2017-11-17T02:06:29,205][INFO ][o.e.c.s.ClusterService ] [prod_es_node1] added {{prod_es_node2}{ZA7CwKyBQS2gm-OamVSz2g}{U6WQyzwoQCiDkwBvmUxoQw}{172.18.0.2}{172.18.0.2:9300},}, reason: zen-disco-node-join[{prod_es_node2}{ZA7CwKyBQS2gm-OamVSz2g}{U6WQyzwoQCiDkwBvmUxoQw}{172.18.0.2}{172.18.0.2:9300}]` 

TEST

curl localhost:9200/_cluster/health?pretty 
{ 
    "cluster_name" : "prod_es_cluster", 
    "status" : "green", 
    "timed_out" : false, 
    "number_of_nodes" : 2, 
    "number_of_data_nodes" : 2, 
    "active_primary_shards" : 0, 
    "active_shards" : 0, 
    "relocating_shards" : 0, 
    "initializing_shards" : 0, 
    "unassigned_shards" : 0, 
    "delayed_unassigned_shards" : 0, 
    "number_of_pending_tasks" : 0, 
    "number_of_in_flight_fetch" : 0, 
    "task_max_waiting_in_queue_millis" : 0, 
    "active_shards_percent_as_number" : 100.0 
} 
関連する問題