OpenDaylight Nitrogen版本:不重启ODL/Karaf实现MDSAL二进制备份恢复咨询
Alright, let's walk through how to restore MDSAL binary backups on OpenDaylight Nitrogen without restarting the Karaf server. I've done this a few times, so here's a reliable, step-by-step approach that works:
ODL Nitrogen's MDSAL includes native CLI tools to handle backups and restores without needing a server restart. Here's how to use them:
1. Access the Karaf Console
First, get into your Karaf instance – either locally or via SSH:
ssh -p 8101 admin@localhost
Enter your credentials (default is admin/admin unless you've updated them).
2. Verify Datastore Status (Optional but Recommended)
Before starting the restore, check for active transactions that could cause conflicts:
odl:ds-show
This command will display the status of config, operational, and other datastores. Ensure there are no ongoing write transactions; if there are, you can list them with odl:tx-list and cancel stuck ones (if safe) using odl:tx-cancel <tx-id>.
3. Restore the Config Datastore
The config datastore holds your persistent configuration, so this is usually the primary target for restores. Use the following command, replacing /path/to/your/config-backup.zip with the actual path to your binary backup file:
odl:config-restore /path/to/your/config-backup.zip
Wait for the command to finish – you'll see a success message like "Config datastore restored successfully" when it's done.
4. Restore the Operational Datastore (If Necessary)
Restoring the operational datastore is less common, since it typically holds dynamic state from devices and the controller. But if you have a valid binary backup for it and need to restore it, use:
odl:operational-restore /path/to/your/operational-backup.zip
Important: Be cautious here – restoring operational data can override real-time state. Only do this if you're certain the backup is consistent with your current network environment.
5. Validate the Restore
After the restore completes, confirm the data is correctly loaded by querying the datastores:
- For config data (root path):
odl:read-config / - For a specific config path (e.g., netconf topology):
odl:read-config /network-topology/topologies/topology-netconf - For operational data:
odl:read-operational /
- Backup Compatibility: Make sure the backup was taken from an ODL Nitrogen instance (or a fully compatible version). Cross-version backups often fail due to schema changes.
- File Permissions: Ensure the Karaf user has read access to the backup file. If you uploaded it via SCP, set permissions with
chmod 644 /path/to/backup.zip. - Rollback Plan: Always take a fresh backup before restoring, just in case:
odl:config-backup /path/to/pre-restore-config-backup.zip odl:operational-backup /path/to/pre-restore-operational-backup.zip
内容的提问来源于stack exchange,提问作者srinivasa kolluru

