3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

SoftLayerのPrivateVLAN上でSerf discover

Last updated at Posted at 2014-10-31

AWS VPC上の仮想ネットワークはmulticastとbroadcastを明示的に禁じているが、SoftLayerの仮想ネットワークにはそのような記述は見当たらない。

ということで、Serf0.4から実装されたmulticastDNSを用いたdiscover機能を使って、SoftLayerのPrivateVLAN上でmulticastが通るのか実験してみた。

--11/01追記--
異なるPrivateVLANに所属するノードでも自動ディスカバリできるか追加実験してみた。

実験1

SoftLayerで3台のVirtual Serverを起動(DCはSan Jose 1、OSはUbuntu Server 14.04)。
これらのeth0は同一のPriavateVLAN(VLAN 2603) & Private Subnet(10.54.222.128/26)に所属している。

ホスト1 (serf-test01)

eth0      Link encap:Ethernet  HWaddr 06:8a:90:33:68:cf  
          inet addr:10.54.222.131  Bcast:10.54.222.191  Mask:255.255.255.192
          inet6 addr: fe80::48a:90ff:fe33:68cf/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:15304 errors:0 dropped:0 overruns:0 frame:0
          TX packets:12198 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:3621123 (3.6 MB)  TX bytes:2601189 (2.6 MB)

ホスト2 (serf-test02)

eth0      Link encap:Ethernet  HWaddr 06:6c:77:46:6b:d4  
          inet addr:10.54.222.132  Bcast:10.54.222.191  Mask:255.255.255.192
          inet6 addr: fe80::46c:77ff:fe46:6bd4/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:116676 errors:0 dropped:0 overruns:0 frame:0
          TX packets:113720 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:23876099 (23.8 MB)  TX bytes:13363864 (13.3 MB)

ホスト3 (serf-test03)

eth0      Link encap:Ethernet  HWaddr 06:97:7c:fd:95:c7  
          inet addr:10.54.222.133  Bcast:10.54.222.191  Mask:255.255.255.192
          inet6 addr: fe80::497:7cff:fefd:95c7/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:48778 errors:0 dropped:0 overruns:0 frame:0
          TX packets:17324 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:49923945 (49.9 MB)  TX bytes:3495874 (3.4 MB)

この状況で、各ホストで以下のコマンドを投げ、serfクラスタを自動構築してみる。

root@serf-test01:~# serf agent -iface=eth0 -discover=test-cluster &  
==> Using interface 'eth0' address '10.54.222.131'
==> Starting Serf agent...
==> Starting Serf agent RPC...
==> Serf agent running!
         Node name: 'serf-test01'
         Bind addr: '10.54.222.131:7946'
          RPC addr: '127.0.0.1:7373'
         Encrypted: false
          Snapshot: false
           Profile: lan
      mDNS cluster: test-cluster

結果

クラスタ参加済みノードのIPアドレスを指定してJOINしなくても、multicastDNSによって自動的にtest-clusterに参加してmember-joinイベントが発生し、Serfクラスタが自動構築されていることが確認できた。

root@serf-test01:~# serf monitor
    2014/11/01 13:55:37 [INFO] agent.ipc: Accepted client: 127.0.0.1:57271
2014/11/01 13:53:31 [INFO] agent: Serf agent starting
2014/11/01 13:53:31 [INFO] serf: EventMemberJoin: serf-test01 10.54.222.131
2014/11/01 13:53:32 [INFO] agent: joining: [10.54.222.131:7946] replay: false
2014/11/01 13:53:32 [INFO] agent: joined: 1 nodes
2014/11/01 13:53:32 [INFO] agent.mdns: Joined 1 hosts
2014/11/01 13:53:32 [INFO] agent: Received event: member-join
2014/11/01 13:55:16 [INFO] serf: EventMemberJoin: serf-test02 10.54.222.132
2014/11/01 13:55:17 [INFO] agent: Received event: member-join
2014/11/01 13:55:21 [INFO] serf: EventMemberJoin: serf-test03 10.54.222.133
2014/11/01 13:55:22 [INFO] agent: Received event: member-join
2014/11/01 13:55:32 [INFO] agent: joining: [10.54.222.133:7946 10.54.222.132:7946] replay: false
2014/11/01 13:55:32 [INFO] agent: joined: 2 nodes
2014/11/01 13:55:32 [INFO] agent.mdns: Joined 2 hosts
2014/11/01 13:55:37 [INFO] agent.ipc: Accepted client: 127.0.0.1:57271
root@serf-test01:~# serf members
    2014/11/01 13:56:09 [INFO] agent.ipc: Accepted client: 127.0.0.1:57273
serf-test01  10.54.222.131:7946  alive  
serf-test02  10.54.222.132:7946  alive  
serf-test03  10.54.222.133:7946  alive

実験2

SoftLayerに1台のBare Metal Serverを起動(DCはSan Jose 1、OSはUbuntu Server 14.04)。
これは上記3台とは異なるPrivateVLAN(VLAN 2224)、異なるサブネット(10.91.83.0/26)に所属している。

ホスト0 (serf-test00)

eth0      Link encap:Ethernet  HWaddr 00:25:90:6c:6b:2e  
          inet addr:10.91.83.2  Bcast:10.91.83.63  Mask:255.255.255.192
          inet6 addr: fe80::225:90ff:fe6c:6b2e/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:2500 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2498 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:384802 (384.8 KB)  TX bytes:181186 (181.1 KB)
          Memory:df980000-dfa00000 

VLAN SpanningをONにしているため、サブネットが異なっても通信可能。

root@serf-test00:~# ping -c1 10.54.222.131
PING 10.54.222.131 (10.54.222.131) 56(84) bytes of data.
64 bytes from 10.54.222.131: icmp_seq=1 ttl=61 time=0.333 ms

--- 10.54.222.131 ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.333/0.333/0.333/0.000 ms

ただしboradcastドメインは異なるのでarpテーブルには乗らない(10.91.83.1はGateway)。

root@serf-test00:~# arp -an -i eth0
? (10.91.83.1) at cc:ef:48:85:70:c0 [ether] on eth0

ホスト1〜3のSerfクラスタを起動したままでホスト0で以下のコマンドを投げ、serfクラスタに参加できるか確認する。

root@serf-test00:~# serf agent -iface=eth0 -discover=test-cluster &
==> Using interface 'eth0' address '10.91.83.2'
==> Starting Serf agent...
==> Starting Serf agent RPC...
==> Serf agent running!
         Node name: 'serf-test00'
         Bind addr: '10.91.83.2:7946'
          RPC addr: '127.0.0.1:7373'
         Encrypted: false
          Snapshot: false
           Profile: lan
      mDNS cluster: test-cluster

結果

既存のSerfクラスタに自動JOINできなかった。

root@serf-test01:~# serf members
    2014/11/01 14:37:35 [INFO] agent.ipc: Accepted client: 127.0.0.1:57241
serf-test01  10.54.222.131:7946  alive  
serf-test02  10.54.222.132:7946  alive  
serf-test03  10.54.222.133:7946  alive
root@serf-test00:~# serf members
    2014/11/01 14:38:19 [INFO] agent.ipc: Accepted client: 127.0.0.1:54992
serf-test00  10.91.83.2:7946  alive

VLAN SpanningされたVLAN間であっても、サブネット間でmulticastはルーティングされない模様。


クラスタの自動ディスカバリができなくても、クラスタメンバーのIPアドレスを明示的に指定すれば、異なるサブネットであってもJOINできる。

root@serf-test00:~# serf join 10.54.222.131
    2014/11/01 14:40:08 [INFO] agent.ipc: Accepted client: 127.0.0.1:54993
    2014/11/01 14:40:08 [INFO] agent: joining: [10.54.222.131] replay: false
    2014/11/01 14:40:08 [INFO] serf: EventMemberJoin: serf-test01 10.54.222.131
    2014/11/01 14:40:08 [INFO] serf: EventMemberJoin: serf-test03 10.54.222.133
    2014/11/01 14:40:08 [INFO] serf: EventMemberJoin: serf-test02 10.54.222.132
    2014/11/01 14:40:08 [INFO] agent: joined: 1 nodes
Successfully joined cluster by contacting 1 nodes.
root@serf-test00:~# serf members
    2014/11/01 14:40:33 [INFO] agent.ipc: Accepted client: 127.0.0.1:54996
serf-test00  10.91.83.2:7946     alive  
serf-test01  10.54.222.131:7946  alive  
serf-test03  10.54.222.133:7946  alive  
serf-test02  10.54.222.132:7946  alive
3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?