The strategy for backup and restore for the entire Voltha cluster is depicted in the diagram below.
Implementation of this strategy would be done post-PoC3.
For PoC-3, the strategy is to backup and restore Consul data manually.
There are two sets of data that could be backup and restored from Consul:
The focus is on the KV store as this is the only Consul data that needs to be backed up for Voltha. We will initiate the backup and restore operations from the voltha/tools container.
The steps below show the basic backup and restore procedure. Consul provides additional options, e.g. authentication, to use during these operations.
Get the IP and port number of one of the running consul node.
Enter the voltha/tools container on one of the cluster node:
docker exec -it <containerid> bash cd /home/tools
consul kv export -http-addr=http://<Consul_IP>:<Consul_PORT></Consul_PORT> service/voltha > consul_backup.json
File consul_backup.json contains all the data in json format from the KV store with prefix 'service/voltha'. The above command can be added as a Cron job to backup the consul data on a regular basis (obviously the back_file will need to be uniquely identified for each backup, preferably using a timestamp)
Restoring a Consul backup implies that the current consul data needs to be overwritten. This is typically a disaster recovery scenario.
docker service rm vcore_vcore
docker service rm consul_consul
docker stack deploy -c /cord/incubator/voltha/compose/docker-compose-consul-cluster.yml consul
docker service ls consul_consul
Get the IP and port number of one of the running consul node.
Enter the voltha/tools container on one of the cluster machine:
docker exec -it <containerid> bash cd /home/tools
consul kv import -http-addr=http://<Consul_IP>:<Consul_PORT></Consul_PORT> @consul_backup.json
The backup data has been restored into Consul
Start the voltha instances. This should be performed from a docker swarm manager node.
docker stack deploy -c /cord/incubator/voltha/compose/docker-compose-voltha-swarm.yml vcore