Backup/Restore Config Only

Forum for questions and support relating to the 1.24.x releases only.
Locked
troyy0206
Posts: 45
Joined: Fri Oct 30, 2009 1:54 am

Backup/Restore Config Only

Post by troyy0206 »

I have a system that I want to move to another box and I don't really care about the event data, I just want to move the configuration so I don't have to set up each individual camera again. Is the configuration data only stored in the MySQL database? I don't really want to mess with the scripts and such if I don't have to, because I'm a Windows kind of guy :wink:

Can I just use the Windows MySQL admin tool to do a backup and restore of the database to move the configuration safely? Is there anything I need to consider such as host name or anything? I will probably rename the new machine, as well.
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

It doesn't matter if you also transfer the event data. Just run zmaudit.pl once you've done the restore and it will then clean everything up.
troyy0206
Posts: 45
Joined: Fri Oct 30, 2009 1:54 am

Post by troyy0206 »

Paranoid wrote:It doesn't matter if you also transfer the event data. Just run zmaudit.pl once you've done the restore and it will then clean everything up.
So I take this to mean I can do a backup/restore using the Windows MySQL Admin utility and then just run zmaudit.pl to clean up the aftermath from not moving the event data?
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

There are several ways to accomplish this, but yes the above would work.
From the command line is really simple as well to backup the DB:

Code: Select all

mysqldump zm > /root/zm-dbbackup.sql
If you are updating ZM, you should run zmupdate.pl as described in the manual to update the database before running zmaudit after you have loaded you backup DB.

Or if you are going to be loading the same version of ZM, you can just backup the tables for the Config, Filters, Groups, States, Users, Monitors, and Zones and load them after you have installed the stock DB. Add X10 and Devices if your using X10 to the list of tables.

Code: Select all

mysqldump zm Config Filters Groups States Users Monitors Zones --add-drop-table > /root/zm-config.sql
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson »

I am also moving an install from suse to fedora, which means that the document root will be different. I know I could mess about with Apache on fedora to change the root to match suse, but I'd rather not.

Is this just a table or two to update this config, or is this info spread all over the place?

I was going to do a clean install and reconfigure manually, but just saw this thread and thought I'd ask if it was a simple change? Ideally I'd do a new compile and install, then just restorethe DB on from the old system and reconfigure where it thinks the events are?

If not then no worries, I'll do a full clean install and configure.

Hope this is OK and I haven't hijacked the thread too much.

edit:
just reread the post by Cordel. Am I correct in assuming that all config is just stored in the Config table, and if I update this to correct the DocumentRoot I'll be OK?
Paranoid
Posts: 129
Joined: Thu Feb 05, 2009 10:40 pm

Post by Paranoid »

The path to the web root (and associated directories) is defined in the zm.conf file usually located in /etc. If your webroot changes then you make changes in this file to reflect it. You dont need to change entries in the database.
kevin_robson
Posts: 247
Joined: Sun Jan 16, 2005 11:26 am

Post by kevin_robson »

Thanks Paranoid, it is indeed in there. Much easier than I expected.
User avatar
cordel
Posts: 5210
Joined: Fri Mar 05, 2004 4:47 pm
Location: /USA/Washington/Seattle

Post by cordel »

The only thing you might have to change during migration in the database would be path values likely for ZM_PATH_ZMS and ZM_PATH_EVENTS under options/pathes tab if your crossing distros.

Your zm.conf will be generated during the build or installed by the package and should already have the appropriate values passed in from configure.

As to what tables to bring over, is dependent on what parts of the configuration you want to carry over. Most items in the options section is contained in Config with the exceptions of users which are in the Users table. Your Monitor are stored in Monitors table, Zones in Zones, Filters in Filters, etc...
Others of interest might be Groups, States, X10, and Devices.

Tables associated with events are Events, Stats, and Frames.

Tables that unless you have gone in and added values manually that you can likely exclude are ZonePresets, and MonitorPresets as these are not user updatable through the console.

The simplest method would be to bring the entire database, if you are using a newer version of ZM to run zmupdate.pl as described in the manual, and then use zmaudit.pl to clean up the DB if you leave events behind.
zmaudit normally runs by default so even if you don't manually run it, soon after you start ZM it would go in and check for event folders and the DB and start to clean things up anyway.
Locked