Forum .LRN Q&A: changing machines

Collapse
Posted by William Painter on
I am migrating the .LRN system from a development machine to a more stable and robust server. I have installed 2.1.1 (using an older version on the development box) and now I have a question: What is the best way to move the data over?

I don't really want to rebuild everything. I can export the databases but can I import them into 2.1.1? Right now, the 2.1.1 is just out of the box and not populated with anything. I have phpPgAdmin installed to simplify this task. Can I export one and import to the new one without screwing up the new install?

Collapse
3: Re: changing machines (response to 1)
Posted by Dave Bauer on
Here is what I suggest.

1) Make a copy of the entire openacs directory from the current machine.

2) Move that to the new server.

3) Dump the database from the current machine

4) Reload that into an empty database on the new server.

Don't try to change the code base at the same time you are changing the server.

If tsearch2 is installed on there make sure this http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/regprocedure_update.sql is applied to the database before dumping it.

"If you have a working version of tsearch2 in your database, you do not need to re-install the tsearch2 module. Just apply the patch and run make. This patch only affects the tsearch2.sql file. You can run the SQL script found : [right here] This script will make the modifications found in the patch, and update the fields from the existing data. From this point on, you can dump and restore the database in a normal fashion. Without this patch, you must follow the instructions later in this document for backup and restore." see http://www.sai.msu.su/~megera/postgres/gist/tsearch/V2/docs/tsearch-V2-intro.html

Collapse
2: Re: changing machines (response to 1)
Posted by Nima Mazloumi on
William,

more important is the question which version is running on the old box and which on the new? Migration is very easy once you have AOLServer and PostgreSQL installed. Simply create a dump of your source database. Then - if your code versions differ or if you have uploaded files you need - tar-gzip your openacs-root folder. Then unpack the tar.gz in your target system and load your database dump to postgres. That's it.

Here the steps

- Make an archive of your source installation:
tar czpf my_archive.tar.gz [openacs-root-folder]

- Make a dump of your source database. Where database user is equal to database name.

First change user:

su - [database-user]

Then create the dump:

pg_dump [database-name] > my.dump

Now copy the stuff to your target box.
Make a backup of your target installation:

mv [openacs-root-folder] my-backup

Extract the archive:

tar zxpf my_archive.tar.gz

Make a dump of the target database for backup reasons. See above.

Drop your target database:
dropdb [database-name]

Create a new database:
createdb -E UNICODE [database-name]

Load you database dump:
psql [database-name] < my.dump

All the above assumes that you have use the same name on both boxes as system user, database name, database user. Change the lines accordingly if you didn't.

Collapse
4: Re: changing machines (response to 1)
Posted by Nima Mazloumi on
Dave, you are fast as lightning ;)
Collapse
5: Re: changing machines (response to 1)
Posted by William Painter on
Thank you SO much for the advice. I am migrating from .LRN 2.0.3 to 2.1.1 and from ACS 5.0.4 to 5.1.4. Upgrade and move at the same time.

I followed your instructions, except for moving the entire directory tree where .LRN resides. Managed to make a dump and create a new db with the dumped data. I ran into expected errors in the compatibility of the two databases. Missing keys, etc.

I suppose that now I should edit the old db dump to make it compatible with the new structures.

Thanks again for the very quick response