Qiita Teams that are logged in
You are not logged in to any team

Log in to Qiita Team
Community
OrganizationAdvent CalendarQiitadon (β)
Service
Qiita JobsQiita ZineQiita Blog
4
Help us understand the problem. What is going on with this article?
@nagane

vagrant + serfでjoinが出来ない

More than 5 years have passed since last update.

serfをvagrantでVMを2台立ち上げて試した所
private_networkによりを複数指定した時に何故かjoin出来ずハマった

  • VM1...eth1 192.168.33.10
  • VM2...eth1 192.168.33.11

原因

両VMともに、同じIPであるeth0にバインドしてserfが立ち上がっていた

[root@localhost vagrant]# ip -4 a
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 16436 qdisc noqueue state UNKNOWN
    inet 127.0.0.1/8 scope host lo
2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 10.0.2.15/24 brd 10.0.2.255 scope global eth0
3: eth1: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP qlen 1000
    inet 192.168.33.11/24 brd 192.168.33.255 scope global eth1

このeth0のアドレスは複数台のnodeが全て同じ10.0.2.15になっている

そこで特に何も考えずにserf agentを実行すると・・・

==> Log data will now stream in as it occurs:

    2014/07/03 10:06:44 [INFO] agent: Serf agent starting
    2014/07/03 10:06:44 [INFO] serf: EventMemberJoin: localhost.localdomain 10.0.2.15
    2014/07/03 10:06:45 [INFO] agent: Received event: member-join

[root@localhost ~]# serf members
    2014/07/03 10:06:49 [INFO] agent.ipc: Accepted client: 127.0.0.1:14419
localhost.localdomain  10.0.2.15:7946  alive
[root@localhost ~]#

join失敗

[root@vagrant-web01 vagrant]# ping 192.168.33.11
PING 192.168.33.11 (192.168.33.11) 56(84) bytes of data.
64 bytes from 192.168.33.11: icmp_seq=1 ttl=64 time=2.10 ms
^C
--- 192.168.33.11 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 641ms
rtt min/avg/max/mdev = 2.109/2.109/2.109/0.000 ms


[root@vagrant-web01 vagrant]# serf join 192.168.33.11
    2014/07/03 10:09:52 [INFO] agent.ipc: Accepted client: 127.0.0.1:36688
    2014/07/03 10:09:52 [INFO] agent: joining: [192.168.33.11] replay: false
    2014/07/03 10:09:52 [INFO] serf: EventMemberJoin: localhost.localdomain 10.0.2.15
    2014/07/03 10:09:52 [INFO] agent: joined: 1 nodes
Successfully joined cluster by contacting 1 nodes.
[root@vagrant-web01 vagrant]#     2014/07/03 10:09:53 [WARN] memberlist: Got ping for unexpected node 'localhost.localdomain'
    2014/07/03 10:09:53 [INFO] agent: Received event: member-join
    2014/07/03 10:09:55 [WARN] memberlist: Got ping for unexpected node 'localhost.localdomain'
    2014/07/03 10:09:57 [WARN] memberlist: Got ping for unexpected node 'localhost.localdomain'
    2014/07/03 10:09:58 [WARN] memberlist: Got ping for unexpected node 'localhost.localdomain'
    2014/07/03 10:09:59 [INFO] serf: EventMemberFailed: localhost.localdomain 10.0.2.15
    2014/07/03 10:10:00 [INFO] agent: Received event: member-failed

自動的にeth0が指定され
他のVMもeth0が10.0.2.15になっており
そのIPにserfさんがバインドしてるため上手くjoin出来ず。
一応通信は出来てるっぽいんだけどな

eth0とeth1を取り替えようとしたりeth0に違うipを持たせようとしたり
eth1でルーティングの設定しようか考えていた所・・・・

解決

公式サイトにオプション一覧があった
serf helpなんて飾りだった

serf agent -iface eth1 $

両VMともに上記コマンドで指定してる違うIPをバインドして立ち上がり、無事にjoin

4
Help us understand the problem. What is going on with this article?
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
nagane
infra engineer Lv9 ruby/bash/golang

Comments

No comments
Sign up for free and join this conversation.
Sign Up
If you already have a Qiita account Login
4
Help us understand the problem. What is going on with this article?