exactly, every “candidate master” has its own mysql DB, raft takes care of holding changes to the database, when it needs to switch, an election starts, someone wins and it will be talking to its local DB, holding the same content.
oneadmin@server000:~$ onezone show 0
ZONE 0 INFORMATION
ID : 0
NAME : OpenNebula
ZONE SERVERS
ID NAME ENDPOINT
0 server000 http://10.1.16.200:2633/RPC2
1 server001 http://10.1.16.201:2633/RPC2
2 server002 http://10.1.16.202:2633/RPC2
HA & FEDERATION SYNC STATUS
ID NAME STATE TERM INDEX COMMIT VOTE FED_INDEX
0 server000 leader 236 266124 266124 0 -1
1 server001 follower 236 266124 266124 -1 -1
2 server002 follower 236 266124 266124 -1 -1
ZONE TEMPLATE
ENDPOINT=“http://localhost:2633/RPC2”
This is the running situation at the moment, when I kill opennebula on server000 (current master), it will switch and will show:
oneadmin@server001:~$ onezone show 0
ZONE 0 INFORMATION
ID : 0
NAME : OpenNebula
ZONE SERVERS
ID NAME ENDPOINT
0 server000 http://10.1.16.200:2633/RPC2
1 server001 http://10.1.16.201:2633/RPC2
2 server002 http://10.1.16.202:2633/RPC2
HA & FEDERATION SYNC STATUS
ID NAME STATE TERM INDEX COMMIT VOTE FED_INDEX
0 server000 error - - - -
1 server001 leader 237 266149 266149 1 -1
2 server002 follower 237 266149 266149 -1 -1
ZONE TEMPLATE
ENDPOINT=“http://localhost:2633/RPC2”
Now server001 is leader and talks to its own database locally. the INDEX and COMMIT value shows how up-to-date they are, the TERM number has increased by 1, to show there has been a new election, which resulted in server001 becoming leader.
All you need to add is a floating IP, available on all 3 servers, this will enable the web interface to also move to server001. So this IP will become active on 000/001/002, depending which server “wins” the election.
If I then enable opennebula on server000 again, it shows:
oneadmin@server000:~$ onezone show 0
ZONE 0 INFORMATION
ID : 0
NAME : OpenNebula
ZONE SERVERS
ID NAME ENDPOINT
0 server000 http://10.1.16.200:2633/RPC2
1 server001 http://10.1.16.201:2633/RPC2
2 server002 http://10.1.16.202:2633/RPC2
HA & FEDERATION SYNC STATUS
ID NAME STATE TERM INDEX COMMIT VOTE FED_INDEX
0 server000 follower 237 266218 266218 -1 -1
1 server001 leader 237 266218 266218 1 -1
2 server002 follower 237 266218 266218 -1 -1
ZONE TEMPLATE
ENDPOINT=“http://localhost:2633/RPC2”
Now there is no need for a new election, because the master (001) is still up. So when server000 becomes active again, it will be made up-to-date and joins as a follower. The TERM stays at 237, because no new election was necessary, and the master is now still @ server001, together with the floating IP and the web interface.
NOTE: remember to apply any changes (EDIT: like changes to /etc/one/oned.conf - thx Martin) 3 times tho, as the configuration of opennebula between the 3 servers MUST stay identical !!