Skip to content

Instantly share code, notes, and snippets.

@hbokh
Created December 24, 2015 20:20
Show Gist options
  • Save hbokh/a7c4a23cbb4cfa6f1aa8 to your computer and use it in GitHub Desktop.
Save hbokh/a7c4a23cbb4cfa6f1aa8 to your computer and use it in GitHub Desktop.
Hypriot Cluster Lab, 20151224 - restarting cluster
HypriotOS: root@cl-master in ~
$ /usr/local/bin/cluster-start.sh
#---------
# prepare
#---------
update package lists
install required packages
create vlan with tag 200 on eth0
configure avahi only on eth0.200 \(vlan with id 200\)
#-----------------
# check if leader
#-----------------
set ip address on vlan 200
if CLUSTERMASTERIP is empty then this machine is the leader
#####################
# #
# configure node as #
# #
# cluster master #
# #
#####################
set ip address on vlan 200
#-------
# avahi
#-------
create avahi cluster-master
#---------
# dnsmasq
#---------
setup dnsmasq dhcp server
restart dnsmasq with new config
get self ip
#--------
# docker
#--------
make backup of /etc/default docker
change config with new options for libnetwork introduced in docker 1.9
restart docker with new config
#------------------
# consul and swarm
#------------------
create docker compose for consul
start consul and swarm container
Creating bin_swarm_1
Creating bin_consul_1
Creating bin_swarmmanage_1
#-----------
# debugging
#-----------
list interface parameters including vlan id
9: eth0.200@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether b8:27:eb:40:7f:47 brd ff:ff:ff:ff:ff:ff promiscuity 0
vlan protocol 802.1Q id 200 <REORDER_HDR>
list ip addresses
9: eth0.200@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether b8:27:eb:40:7f:47 brd ff:ff:ff:ff:ff:ff
inet 192.168.200.1/24 scope global eth0.200
valid_lft forever preferred_lft forever
list routes
default via 192.168.178.1 dev eth0
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.178.0/24 dev eth0 proto kernel scope link src 192.168.178.35
192.168.200.0/24 dev eth0.200 proto kernel scope link src 192.168.200.1
HypriotOS: root@cl-master in ~
$
HypriotOS: root@cl-node-1 in ~
$ /usr/local/bin/cluster-start.sh
#---------
# prepare
#---------
update package lists
W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/InRelease
W: Failed to fetch http://mirrordirector.raspbian.org/raspbian/dists/jessie/Release.gpg Could not resolve 'mirrordirector.raspbian.org'
W: Failed to fetch https://packagecloud.io/Hypriot/Schatzkiste/debian/dists/wheezy/main/binary-armhf/Packages Could not resolve host: packagecloud.io
W: Some index files failed to download. They have been ignored, or old ones used instead.
install required packages
create vlan with tag 200 on eth0
configure avahi only on eth0.200 \(vlan with id 200\)
#-----------------
# check if leader
#-----------------
set ip address on vlan 200
if CLUSTERMASTERIP is empty then this machine is the leader
#####################
# #
# configure node as #
# #
# cluster slave #
# #
#####################
get ip address from DHCP
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/
Listening on LPF/eth0.200/b8:27:eb:d4:bf:d9
Sending on LPF/eth0.200/b8:27:eb:d4:bf:d9
Sending on Socket/fallback
DHCPREQUEST on eth0.200 to 255.255.255.255 port 67
DHCPACK from 192.168.200.1
bound to 192.168.200.186 -- renewal in 2806 seconds.
get self ip
#--------
# docker
#--------
make backup of /etc/default docker
change config with new options for libnetwork introduced in docker 1.9
restart docker with new config
#------------------
# consul and swarm
#------------------
create docker compose for consul
start consul and swarm container
Creating bin_swarm_1
Creating bin_consul_1
#-----------
# debugging
#-----------
list interface parameters including vlan id
7: eth0.200@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP mode DEFAULT group default
link/ether b8:27:eb:d4:bf:d9 brd ff:ff:ff:ff:ff:ff promiscuity 0
vlan protocol 802.1Q id 200 <REORDER_HDR>
list ip addresses
7: eth0.200@eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default
link/ether b8:27:eb:d4:bf:d9 brd ff:ff:ff:ff:ff:ff
inet 192.168.200.186/24 brd 192.168.200.255 scope global eth0.200
valid_lft forever preferred_lft forever
list routes
default via 192.168.178.1 dev eth0
172.17.0.0/16 dev docker0 proto kernel scope link src 172.17.0.1
192.168.178.0/24 dev eth0 proto kernel scope link src 192.168.178.43
192.168.200.0/24 dev eth0.200 proto kernel scope link src 192.168.200.186
HypriotOS: root@cl-node-1 in ~
$
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment