ZM Community,
I had ZM 1.24.1 (from Ubuntu Repository) installed on Ubuntu 7->9->10 (system evolved over time). After Thanksgiving I had a rush
upgrade of the Linux box to Ubuntu 11.10 server (with desktop added). I did an sqldump of all my databases (including zm) and saved
the /var/www directory (again including the zm with all events). Now I want to do a clean install of 1.25 from source and merge all my old
events into the new install.
I see the Wiki has an example of clean source install of 1.25
http://www.zoneminder.com/wiki/index.ph ... rom_source
I know from past experience source installs take a bit more time and effort, but eventually you get it too work.
How do I bring my already captured events into my new clean install? Do I copy the event directories into the new install dirs?
I see in the mysqldump the table and data for the events, but how do I merge this into the new install?
I see reference to running zmupgrade.pl to clean up the DB after upgrading ZM, but those all seem to refer to an in place upgrade.
I still have the disc drive with the old version of Ubuntu/ZM so I can also swap discs and export the db/events in some other way.
I have looked through the forums and only found this as something close
http://www.zoneminder.com/forums/viewto ... 21&t=18195
I don't want to do the new install and find out I did something that makes merging old events difficult or impossible. Pointers to
forums entries I've missed would be welcome. I'd also be will to explore paying someone for this, I don't imagine it is difficult to
do, but does require detailed knowledge of ZM internals and procedures.
Thanks in advance for pointers.
Migrating 1.24.1 Events to new 1.25 install
-
- Posts: 12
- Joined: Thu Feb 24, 2005 3:20 am
- Location: Chesterton, IN
Re: Migrating 1.24.1 Events to new 1.25 install
I have done the same thing after 1.25 was released. I did not write down all the details but I also did not have any problems with the event migration.
1)I did a fresh install of ubuntu 10.04 in a new virtual machine.
2)Installed zoneminder from source following the wiki page.
3)stopped zoneminder
4)Then dropped the mysql database (on the new machine).
5a)imported the mysqldump from the old zoneminder installation. I remember having to manually create the database because I just dumped the zm database using mysqldump and it did not include the create database statement. This leaves the db in an old version of zm making it ready for upgrade.
5b)copied over the events directory from the old machine to the new one preserving timestamps/permissions.
(I had 80gb worth of events so I let this run over night.)
6)run the zmupgrade.pl script which upgrades the db to 1.25.
7)finally restart zm
Everything went well. The only issues I remember having was I didn't create the same database user.
Good luck!
1)I did a fresh install of ubuntu 10.04 in a new virtual machine.
2)Installed zoneminder from source following the wiki page.
3)stopped zoneminder
4)Then dropped the mysql database (on the new machine).
5a)imported the mysqldump from the old zoneminder installation. I remember having to manually create the database because I just dumped the zm database using mysqldump and it did not include the create database statement. This leaves the db in an old version of zm making it ready for upgrade.
5b)copied over the events directory from the old machine to the new one preserving timestamps/permissions.
(I had 80gb worth of events so I let this run over night.)
6)run the zmupgrade.pl script which upgrades the db to 1.25.
7)finally restart zm
Everything went well. The only issues I remember having was I didn't create the same database user.
Good luck!
-
- Posts: 12
- Joined: Thu Feb 24, 2005 3:20 am
- Location: Chesterton, IN
Re: Migrating 1.24.1 Events to new 1.25 install
Thanks grndamgt4!
Process worked.
1. Had ZM 1.25.0 Installed.
2. Backedup the zm db in mysql, saved it in case I needed it.
3. stopped zm.
4. dropped the zm database, I like sqlbuddy for working with MySQL. http://www.sqlbuddy.com/
5. imported the old zm db from a file (again used sqlbuddy)
6. confirmed the version number of old version, 1.24.2
7. copied over the events directory from the old machine to the new one preserving timestamps/permissions (-p option for cp)
8. made the symbolic link to the camera name.
9. ran /opt/zm/bin/zmupdate.pl --version=1.24.2
9a. I used the same username, zmuser, and password I had used previously
9b. at one step in the zmupdate, got an error that the user did not have the privs to create a new table (for Logs). During the source install you explicitly give the user select, insert, update, delete but not create. Added the create priv to zmuser, update finished fine.
10. restarted zm, old events work and new events work as well
Thanks for the help. When I set up Ubuntu 11.10 I added an SSD drive.
Playback of events is much smoother. Making video of event is also faster.
Now I see this how this process works, I have another version, 1.22.3 with events I'd like to recover. I've never look deep into the internals of ZM, but I've learned some with this effort. If I have two seperate zm's running 1.25.0 how can I merge the event databases? In the events dir, monitors are 1, 2, 3 with symbolic links to the camera name. In the monitor table, is the monitorid the same as the name of the directory under events? So monitorid 1, is connected to the event dir 1 (events/1)?
If I have zm #1, with one monitor (monitorid=1, camera name=axis1, events/1) and zm #2, with two monitors (monitorid=1, camera name=axis1, events/1, monitorid=2, camera name=axis2, events/2) can I merge them? Move the zm #2 events to zm #1 events dir and rename them events/2, events/3 change the monitor id's and camera names? Just thinking....
Any pointers to threads I may have missed are always welcome.
Thanks for the help.
Pete
Process worked.
1. Had ZM 1.25.0 Installed.
2. Backedup the zm db in mysql, saved it in case I needed it.
3. stopped zm.
4. dropped the zm database, I like sqlbuddy for working with MySQL. http://www.sqlbuddy.com/
5. imported the old zm db from a file (again used sqlbuddy)
6. confirmed the version number of old version, 1.24.2
7. copied over the events directory from the old machine to the new one preserving timestamps/permissions (-p option for cp)
8. made the symbolic link to the camera name.
9. ran /opt/zm/bin/zmupdate.pl --version=1.24.2
9a. I used the same username, zmuser, and password I had used previously
9b. at one step in the zmupdate, got an error that the user did not have the privs to create a new table (for Logs). During the source install you explicitly give the user select, insert, update, delete but not create. Added the create priv to zmuser, update finished fine.
10. restarted zm, old events work and new events work as well
Thanks for the help. When I set up Ubuntu 11.10 I added an SSD drive.
Playback of events is much smoother. Making video of event is also faster.
Now I see this how this process works, I have another version, 1.22.3 with events I'd like to recover. I've never look deep into the internals of ZM, but I've learned some with this effort. If I have two seperate zm's running 1.25.0 how can I merge the event databases? In the events dir, monitors are 1, 2, 3 with symbolic links to the camera name. In the monitor table, is the monitorid the same as the name of the directory under events? So monitorid 1, is connected to the event dir 1 (events/1)?
If I have zm #1, with one monitor (monitorid=1, camera name=axis1, events/1) and zm #2, with two monitors (monitorid=1, camera name=axis1, events/1, monitorid=2, camera name=axis2, events/2) can I merge them? Move the zm #2 events to zm #1 events dir and rename them events/2, events/3 change the monitor id's and camera names? Just thinking....
Any pointers to threads I may have missed are always welcome.
Thanks for the help.
Pete
P. Brown
pbrown@knotranet.com
pbrown@knotranet.com
Re: Migrating 1.24.1 Events to new 1.25 install
peterfbrown, I'm glad your event import worked.
If the 1.25 database your wanting to import the 1.22.3 events into was an upgrade of the 1.22.3 installation then you likely could with just a few sql statements and copying the events over.
However, if the 1.25 database never held the 1.22.3 events in it (a fresh install for example) then you run into a problem.
The Events table has an autoincrement on Id, this Id is then a primary key in the Frames table as well as the directory name for the events when they are stored on disk.
So in order to merge these records into the current 1.25 database you would have
1)create the new monitors, and get the monitor Id's to use in the following inserts (the easy part)
2)insert all the records from the 1.22.3 changing the Id to be the next in line for the autoincrement, (also not hard) and the MonitorId to the id created in #1
3)then insert the records into the Frames table using this new EventId (the Id column from Events)
4)rename all the events directories on disk to be this new EventId
5)copy over the events again preserving permissions/timestamps
It's all doable but assuming you have several events, you'd have to do some scripting and SQL ETL.
I can think of one other thing that would make this much easier. If you were copying over only EventId's that were greater than the largest EventId in the current install (1.25) then you wouldn't have to do the renaming/ETL of the EventId's and could simply alter the Events table autoincrement to the new max EventId.
If you do it or find a script someone has created to do it, I'd be interested in hearing about it.
Good luck
I'm unaware of a utility/script that has been written to do this. Also I have not done it, but...peterfbrown wrote:
Now I see this how this process works, I have another version, 1.22.3 with events I'd like to recover. I've never look deep into the internals of ZM, but I've learned some with this effort. If I have two seperate zm's running 1.25.0 how can I merge the event databases? In the events dir, monitors are 1, 2, 3 with symbolic links to the camera name. In the monitor table, is the monitorid the same as the name of the directory under events? So monitorid 1, is connected to the event dir 1 (events/1)?
If I have zm #1, with one monitor (monitorid=1, camera name=axis1, events/1) and zm #2, with two monitors (monitorid=1, camera name=axis1, events/1, monitorid=2, camera name=axis2, events/2) can I merge them? Move the zm #2 events to zm #1 events dir and rename them events/2, events/3 change the monitor id's and camera names? Just thinking....
If the 1.25 database your wanting to import the 1.22.3 events into was an upgrade of the 1.22.3 installation then you likely could with just a few sql statements and copying the events over.
However, if the 1.25 database never held the 1.22.3 events in it (a fresh install for example) then you run into a problem.
The Events table has an autoincrement on Id, this Id is then a primary key in the Frames table as well as the directory name for the events when they are stored on disk.
So in order to merge these records into the current 1.25 database you would have
1)create the new monitors, and get the monitor Id's to use in the following inserts (the easy part)
2)insert all the records from the 1.22.3 changing the Id to be the next in line for the autoincrement, (also not hard) and the MonitorId to the id created in #1
3)then insert the records into the Frames table using this new EventId (the Id column from Events)
4)rename all the events directories on disk to be this new EventId
5)copy over the events again preserving permissions/timestamps
It's all doable but assuming you have several events, you'd have to do some scripting and SQL ETL.
I can think of one other thing that would make this much easier. If you were copying over only EventId's that were greater than the largest EventId in the current install (1.25) then you wouldn't have to do the renaming/ETL of the EventId's and could simply alter the Events table autoincrement to the new max EventId.
If you do it or find a script someone has created to do it, I'd be interested in hearing about it.
Good luck
Re: Migrating 1.24.1 Events to new 1.25 install
I did this upgrade from 1.22.3 to 1.25.0.
Ran the zm_update.pl and had to modify some things as manually but otherwise it worked ok, events work etc.
Only problem is, for some reason the old usernames and passwords to do not work. Although I can see they are clearly hashed and exist in the Users table.
Any idea what could cause this?
Ran the zm_update.pl and had to modify some things as manually but otherwise it worked ok, events work etc.
Only problem is, for some reason the old usernames and passwords to do not work. Although I can see they are clearly hashed and exist in the Users table.
Any idea what could cause this?