cancel
Showing results for 
Search instead for 
Did you mean: 

Backup Database and Dir.Root

maricris_eth0
Champ in-the-making
Champ in-the-making
I need to backup all the files including the user accounts on 4.2.c installation and migrate it to another server. I've done the so-called cold backup and followed this link: http://yogeshpj.blogspot.com/2012/04/alfresco-cold-backup-and-restore-using.html but im not successful enough.

Besides there's an error message once I started the alfresco service on our new server:

pg_ctl.bin: could not open PID file "/opt/alfresco/alf_data/postgresql/postmaster.pid"
/opt/alfresco/postgresql/scripts/ctl.sh: postgresql could not be stopped
/opt/alfresco/postgresql/scripts/ctl.sh: postgresql (pid 2425) already running

There is also a hot backup, but there's no lucence file on my dir.root.

5 REPLIES 5

bopolissimus
Confirmed Champ
Confirmed Champ
Hello,

What version is/was your old alfresco?  Was it actually also 4.2.c (i.e., 4.2.c -> 4.2.c migration) or was it something older, e.g., 4.0.d or even 3.4.something which you now want to upgrade to 4.2.c?

What OS was the old alfresco running on?  The new alfresco looks like linux.  Was the old alfresco also linux?  Which linux distribution and version?

Was your old alfresco installed with the bundle?  did you use java, postgresql, tomcat, openoffice from the installer?  Or did you use some distribution resources (e.g., java, postgresql) and also some bundle/installer resources (alfresco, openoffice)?

How did you install the new (migration destination) 4.2.c?  Did you use Easy or Advanced?  Are you planning to use the bundled postgresql or your own postgresql server?

At a first guess, the postgres errors you mention above (first of all, indicating that on your destination 4.2.c installation at least you're using the bundled postgresql) will happen if you installed postgresql as one user (e.g., root, via sudo alfresco-community-4.2.c-installer-linux-x64.bin) and then start alfresco as another user (e.g., just as yourself, without sudo).

Another common case is where you install via the bundled installer (e.g., alfresco-community-4.2.c-installer-linux-x64.bin) and at the end of the installation you say Y to "Install alfresco as a service".  At that point, alfresco will be started.  If you then go to /opt/alfresco-4.2.c and try to start alfresco again tomcat will tell you that it's already running and postgres will tell you that it's already running.

Let's go through these basic questions first, then tackle further questions around the upgrade.

Gerald

Hi Bopolissimus,

I was trying to do backup and restore from 2 different server with the 4.2.c bundled installer on a linux 12.04 64-bit OS. And upon installation of both, I've chosen Easy and because im new into postgresql, I'm planning to use the bundled postgresql instead of the psql on server.

On Backing up, I first stop the tomcat process and let the psql working. Then I'm successful on backing up the database. But once I restored it to another server considering that I stop the tomcat process. The PID bla bla error (pg_ctl.bin) still shows up.

And yes, I always (Y) when the bundled installer prompts "Install alfresco as a service".?

What should I do?

uchit
Champ in-the-making
Champ in-the-making
Dear maricris,
Whenever you are installing new alfresco or any other system, System will create the process ID file from which it will be initiated.
So once you are putting your old things in newer version, just be aware about this file because if you are overwriting this file, may be your alfresco wont start properly.

g_rathod
Star Contributor
Star Contributor
Hi maricris.eth0,
It seems you are trying to backup on linux machine with postgres sql. Please check if you have sufficient permissions before taking backup as linux environment is much tighter on security. And again one thing I noticed that you are trying to start postgres service which is already running.
So please check it before taking backup of alf_data and postgres db.

bopolissimus
Confirmed Champ
Confirmed Champ
Hello Maricris,

I expect there are things you could improve in your workflow (the operations you perform in linux, not alfresco workflows).  In the past I've hacked things up so that, for instance, I'd start alfresco (bundle), kill (or kill -9) the tomcat so postgres would continue running and then pg_dump the database.  This isn't a great thing to do, particularly if you're not familiar with how things work.  But it can get the job done if you do the right things.

There are several things that could cause this:

> pg_ctl.bin: could not open PID file "/opt/alfresco/alf_data/postgresql/postmaster.pid"
> /opt/alfresco/postgresql/scripts/ctl.sh: postgresql could not be stopped
> /opt/alfresco/postgresql/scripts/ctl.sh: postgresql (pid 2425) already running

The first is just running pg_ctl stop as a regular user.  Or as the user who runs alfresco (if not root).  e.g., I often create an alfresco user and then start/stop alfresco as that user.  That doesn't work too well if you're running the bundle postgres too since that will want to run as the postgres user.

The simplest thing to do would be to stop postgres via sudo, e.g., cd [alfresco-directory]/postgresql/scripts;sudo ./ctl.sh stop

if that doesn't work, the error messages above tell you what pid postgres is running as. You can: kill 2425.  or (if that doesn't work) kill -9 2425 (although running kill -9 against the postmaster is not a good thing).

I would improve your workflow this way:

1. on the *source* alfresco, tell people to not use it.  they should not be creating users, uploading content, changing content, modifying properties in alfresco, etc.   Maybe you could enforce that by:  sudo iptables -A INPUT -p tcp –dport 8080 -j DROP  but just asking people to stop using alfresco is friendlier.

2. It's *safe* to take a backup of a running alfresco if there are no users doing anything on it.  and even if people are working on it, if you do things fast enough, a hot backup should be good (http://wiki.alfresco.com/wiki/Backup_and_Restore#Hot_Backup_Procedure, if you're using a modern alfresco, ignore the lucene-indexes bit, you should be using solr).

3. Once you've got your db backup (I like pg_dump -ORc -h [hostname] -U [username] [dbname] > alfresco-db-backup.sql) and a backup of the content, copy both to the *destination* alfresco.  (preferably that's a separate box altogether although it's possible to install two bundle alfrescos on the same machine as long as they use different ports).

4. on the destination alfresco, *install*the*bundle*.  don't just copy your /opt/alfresco-4.2.c directory from source to destination (that's another way to get the pg_ctl.bin issue if you didn't stop postgres before copying things over).

5. once you've installed the bundle, configure /opt/alfresco-4.2.c/tomcat/shared/classes/alfresco-global.properties (mostly just copy the old one over, possibly modifying things like the alfresco and share hostnames). 

6. copy alf_data over from the source.  load the alfresco-db-backup.sql into the destination postgreql.  start tomcat.

Hmmm, I see that I've glossed over how to keep postgresql running when turning off tomcat.  That's mainly because I tend to use distribution postgresql rather than the bundled postgresql.  But if (1) both tomcat and postgresql are running and (2) you want to turn off tomcat but keep postgresql running:

cd /opt/alfresco-4.2.c/tomcat/scripts
sudo ./ctl.sh stop

that will stop tomcat and postgresql will keep running. 

when you're done with postgresql (you've taken a backup of it and copied it over to the new machine), you can stop postgres with:

cd /opt/alfresco-4.2.c/postgresql/scripts
sudo ./ctl.sh stop

good luck.