diff --git a/Data-Backup.md b/Data-Backup.md index 9d38ed9..ebe6264 100644 --- a/Data-Backup.md +++ b/Data-Backup.md @@ -1,28 +1,30 @@ ## A Simple Backup Strategy -The most important thing for storage is to keep data safe and not losing them. It gives you a comfort of thought that your data is safely backup. +The most important thing for storage is to keep data safe and not lose it. It gives you a comfort of thought that your data is safely backed up. -However, we do not want to always copy the whole data files over. We want to do it incrementally. +However, we do not always want to copy the all the data files over. We want to do it incrementally. -"weed backup" command is your friend. +`weed backup` command is your friend. -Run "weed backup" command on any machine that have enough disk spaces. Assuming we want to backup volume 5. +Run `weed backup` command on any machine that has enough disk space. Assuming we want to backup volume 5: - weed backup -server=master:port -dir=. -volumeId=5 +```bash +weed backup -server=master:port -dir=. -volumeId=5 +``` -If local volume 5 does not exist, it will be created. All remote needle entries are fetched and compared to local needle entries. The delta is calculated and local missing files are fetched from the volume server. +If local volume 5 does not exist, it will be created. All remote needle entries are fetched and compared to local needle entries. The delta is calculated, and local missing files are fetched from the volume server. -If you specify `-volumeId=87`, but volume 87 does not exist, it's ok. No files will be created locally. This gives the opportunity that you can create a backup script simply looping from 1 to 100. All existing volumes will be backed up. The non-existing volumes can also be backed up when they are created remotely. +If you specify `-volumeId=87`, but volume 87 does not exist, it's ok. No files will be created locally. This gives the opportunity for you to create a backup script simply looping from 1 to 100. All existing volumes will be backed up. The non-existing volumes can also be backed up when they are created remotely. -The backup scripts is just one command, not a continuous running service though. High Availability servers will be added later. +The backup scripts are just one command, not a continuous running service though. High Availability servers will be added later. ## How to create a mirror of a cluster ### To Start -- Pause operations on cluster you want to backup. This is to avoid a mismatch in the two data sets(the volumes and the Filer metadata) you will be moving separately and combining in the backup cluster. +- Pause operations on cluster you want to backup. This is to avoid a mismatch in the two data sets (the volumes and the Filer metadata) you will be moving separately and combining in the backup cluster. - Install SeaweedFS on a new machine/cluster of machines. Use the same version of SeaweedFS if you can to avoid any issues that could otherwise come up. -- *Do not start your volume servers yet!!* This is to avoid SeaweedFS creating it's own volumes(we will be using the volumes backed up from the current operational cluster). +- *Do not start your volume servers yet!!* This is to avoid SeaweedFS creating it's own volumes (we will be using the volumes backed up from the current operational cluster). ### Prepare the New Cluster and Backup Your Data @@ -32,18 +34,23 @@ The backup scripts is just one command, not a continuous running service though. ### Backup the Metadata -run `fs.meta.save` on the cluster you are pulling from and save the output. This can look like: +Run `fs.meta.save` on the cluster you are pulling from and save the output. This can look like: + ```sh # You will need permission to create a file in the destination directory # I recommend changing the file name because the default naming convention is not very readable BUT it does show the date the file was created which can be good information to store and know. fs.meta.save -o=[yourlocaldir]/[yourfilename].meta ``` + then download the file on the Filer machine you are using in the backup cluster. This can look like: + ```sh # This tool requires that the remote machine be accessable via SSH and that you have the password scp [hostmachineusername]@[hostmachineip]:/remote_directory/file /local/directory ``` + run `fs.meta.load` in the backup cluster on the Filer: + ```sh fs.meta.load [filepath/filename.meta] ```