Follow

RBKB-2016-0001 How to backup and restore a Cluster





How to backup and restore a Cluster

 

The purpose of this document is to be a guide in making a cluster backup and how to perform a cluster restore.

 

1 - Cluster backup

There are a two possible destinations to perform the backup:

A. Store the data in a bucket in AWS remote.

To perform a backup in a s3 bucket it's mandatory to have created and configured a bucket in AWS. A detailed explanation of how do this from scratch can be found in Annex A.

The command that must be executed is:

user@node ~]# rb_backup_cluster.rb -b -s
Checking S3 access ... [ OK ]
Segments backup in progress (please, be patient) ... [ OK ]
Chef-server backup in progress ...                                                                   [  OK  ]
Making backup of node node3 ...                                                                       [  OK  ]
Making backup of node node1 ...                                                                      [  OK  ]
Making backup of node node2 ...                                                                       [  OK  ]
Copying cluster information ... [ OK ]

 

B. Store the data in a path

The command that must be executed is:

user@node ~]# rb_backup_cluster.rb -b -p backup_path
Segments backup in progress (please, be patient) ... [ OK ]
Chef-server backup in progress ...                                                           [  OK  ]
Making backup of node node3 ...                                                               [  OK  ]
Making backup of node node1 ...                                                              [  OK  ]
Making backup of node node2 ...                                                               [  OK  ]
Copying cluster information ... [ OK ]

2 - Cluster restore

There are some basic rules for restoring succesfully a cluster:

  1. Have the same number of nodes installed.
  2. The nodes must have the same name, mannagement ip address and sync ip address.
  3. The master node must have all services up and running "ok". The rest of the nodes can be custom installed withouth any services running buts need to be joined to the master node.

There are a two source posibilities to perform the restore:

A. Data stored in a bucket in AWS remote.

To perform a restore from a s3 bucket, it is mandatory to have configured the bucket in the RedBorder Panel. Annex B explains how to configure bucket backup in the RedBorder Panel.

The command that must be executed is:

user@node ~]# rb_backup_cluster.rb -r -s
Checking S3 access ... [ OK ]
Downloading from AWS S3 to temporal directory ... [ OK ]
Stoping chef-client on all nodes ...                                                                  [  OK  ]
Restoring node node2 ...                                                                       [  OK  ]
Restoring node node3 ...                                                                        [  OK  ]
Restoring node node1 ...                                                                       [  OK  ]
Stoping all services ...                                                                              [  OK  ]
Restoring chef-server node node1 ...                                                           [  OK  ]
Restoring postgresql service ...                                                                      [  OK  ]
Restoring chef-server database ...                                                                    [  OK  ]
Restoring cookbooks ...                                                                               [  OK  ]
Reconfiguring chef-server ...                                                                         [  OK  ]
Restarting chef ...                                                                                   [  OK  ]
Restoring the Cluster config (please, be patient) ... [ OK ]
Aplying keys changes (please, be patient) ... [ OK ]
Segments restore in progress (please, be patient) ... [ OK ]

 

B. Data stored in a path:

The command that must be executed is:

user@node ~]# rb_backup_cluster.rb -r -p store_path 
Stoping chef-client on all nodes ...                                                                  [  OK  ]
Restoring node node2 ...                                                                        [  OK  ]
Restoring node node3 ...                                                                         [  OK  ]
Restoring node node1 ...                                                                        [  OK  ]
Stoping all services ...                                                                               [  OK  ]
Restoring chef-server node node1 ...                                                            [  OK  ]
Restoring postgresql service ...                                                                       [  OK  ]
Restoring chef-server database ...                                                                     [  OK  ]
Restoring cookbooks ...                                                                                [  OK  ]
Reconfiguring chef-server ...                                                                          [  OK  ]
Restarting chef ...                                                                                    [  OK  ]
Restoring the Cluster config (please, be patient) ... [ OK ]
Aplying keys changes (please, be patient) ... [ OK ]
Segments restore in progress (please, be patient) ... [ OK ]

 

Annex A . Creating a bucket in AWS

In AWS Panel, go to the section Storage & Content Delivery and click on the S3 option:

Now you are viewing the buckets you have in your AWS Service. To create a new bucket, press the Create Bucket button:

Name the bucket and select the region where you want to store the bucket and press the create button:

In order to have standard names in the guide we are going to name the bucket:

rb-backup-example

2. Create a user to access the buckets:

In AWS Panel, go to the section Security & Identity and click on the Identity & Access Management option:

Go to Users and press the Create New Users button:


Enter the username you want and press the create button:

Now you must write down the Access Key ID and the Secret Access Key:

3. Give bucket access and control permissions to the user:

Go to Users and select the user you created before. Then, go to Permissions and press the Attach Policy button:

Select Policy Generator and press the Select button:

Now we need to allow access and modification permissions to the bucket that we created before. To do that, two ARN statements must be created for the bucket we want to give the permissions to. For example, if we have a bucket named rb-bucket-example, the ARN statements we need to create are:

arn:aws:s3:::rb-bucket-example

arn:aws:s3:::rb-bucket-example/*

Once the statements have been added, press the Next Step button:

And apply the policy:

Annex B - Configuring clusters for backup

The backup segments of the Remote S3 must be configured in the cluster.

Go to Tools -> General Settings and click on “Backup segments (Remote S3)” to reveal the options.


Then we need to fill out the appropriate parameters:

  • Access key, secret key and hostname are the same in all clusters.
  • The Bucket field depends on the cluster being configured because you are linking the cluster itself with the AWS S3 bucket you created before.

 

 



 

Have more questions? Submit a request

Comments

Powered by Zendesk