Backup and Restore IM Server
This guide describes the steps for backing up and restoring a PortSIP IM server. These procedures are designed to ensure data integrity during system upgrades, migrations, or disaster recovery scenarios.
Important
Backup files and data must be stored on a separate server or external storage device, not on the IM server used for daily operations.
This guide is intended for cases where the IM server is installed on a separate server.
Always validate backups by performing periodic test restores in a non-production environment.
Backup Methods
1. Using Virtual Machine or Cloud Snapshots (Recommended)
If your PortSIP IM Server is running in a virtualized environment (e.g., VMware, KVM) or on a cloud platform, you can use the platform’s native tools to create a snapshot. Snapshots capture the entire system state, providing a fast and reliable backup solution.
Best Practice
Regularly test snapshot restores to ensure the IM server can be successfully recovered in the event of a failure.
Restoring from a Snapshot
To restore the IM Server from a snapshot:
Follow the restore procedure provided by your virtualization or cloud platform.
Start the IM services.
Verify IM message delivery and network connectivity.
Backing Up IM Data
When you install PortSIP IM, the -p parameter specifies the parent directory for IM data storage.
Installation Example
If you specify a chat file storage directory with the -f parameter, such as:
When backing up, ensure that you also back up the chat files by copying the directory specified in the -f parameter, in this case, it's /chat/files.
Backup Procedure (Default Parent Path: /var/lib/portsip)
/var/lib/portsip)Stop the IM server:
Create the backup directory and copy the data:
If the
-fparameter was used to specify the chat file storage directory. Now, back up the chat files using the command below; otherwise, ignore this step.
After completing the backup, restart the IM server if necessary:
Restoring Backup Data
1. Restoring to the Same Server
Step 1: Stop the IM Server and Remove Existing Data
Stop the IM Server:
Remove the existing IM data:
If the
-fparameter was used for chat file storage, then remove the chat files using the command below. Otherwise, ignore this step.
Step 2: Restore the Backup Data
Copy the backup data to the IM server:
Set the correct permissions:
If the
-fparameter was used to specify a chat file storage directory, restore the chat data using the following command. Otherwise, you can skip this step.
Step 3: Start the IM Server with Restored Data
Start the IM server:
Expected Result The IM server is successfully restored on the same server.
2. Restoring to a New Server
Note When restoring to a new server, the IM server will be automatically upgraded to the latest version.
Prepare the new Linux server without installing PortSIP IM Server.
Copy the backup data to the new server:
Set the correct permissions:
If the
-fparameter was used for chat files, restore the chat data using the following command. Otherwise, you can skip this step.
Follow the "Install IM Service" guide to install the IM server on the new server with the new IP address and token, using the restored file paths.
Expected Result The newly installed IM server has successfully restored the backup data.
Notes and Best Practices
1. Permissions (888:888)
Incorrect ownership or permissions on the data folders may prevent the IM server from starting correctly. Ensure that the permissions are set as shown in the restore steps.
2. IP Address Changes
Always use the new IP address and token when restoring the IM server to a new server to avoid network issues.
3. Backup Validation
Periodically test restores to confirm the integrity of your backups and ensure the system can be recovered when needed.
Last updated