ClearlyIP’s Tips and Tricks
The writer of this article had the need to back up the configuration from one server and restore it to another as part of a hardware improvement.
This was about moving the configuration files and databases between two telephony services in the Cloud from one data center to another. We followed the process of generating a backup of the original server and restored it to the destination server one day before the cutover.
In this case, the client did not generate many changes in the configuration regarding users, trunks, etc, but needed the voice mail files up to date on the new server. Because the backup and restore process took too long, as already mentioned, a copy of the backup was restored to the destination server a day earlier.
To address the voicemail issue, we opted to use a file synchronization tool called rsync.
rsync (Remote Sync) is a powerful tool for transmitting and synchronizing files between two servers, although it can also be used to synchronize folders and files locally on the same server.
A great advantage of rsync is that the file transfer is incremental, that is, the first time it is executed, it copies all the content from one server to another, and subsequently, compares the information between the source and the destination servers, and only copies the missing or changed files
How did we do this? We just logged into the source server and executed the following command to synchronize the voicemail folder among both servers:
rsync -avzP /var/spool/asterisk/voicemail/default/* [email protected]
What Does -avzP mean?
- a: for syncing archives recursively, preserving symbolic links, modification times, groups, owners, and permissions.
- v: Stands for ‘verbose’ and will show progress on screen.
- z: This option is for compressing the files before sending them in order to reduce the bandwidth when copying them.
- P: This option allows us to resume the file transfer when interrupted.
Keep in mind that
On this occasion the syntax used is:
rsync -options local_folder [email protected]_of_the_remote_server:destination_folder
It is worth mentioning that rsync behaves very similarly to the SSH protocol, so it is necessary to enter the user’s password (root in this case) to copy the files from one server to another.
Here is a partial output when executing the command for the first time:
For the second time, since there hasn’t been any new files added, this is the output.