Upgrade PostgreSQL data directory?

Discuss installation of Scalix software

Moderators: ScalixSupport, admin

jimjawn

Upgrade PostgreSQL data directory?

Postby jimjawn » Sun Mar 18, 2007 11:26 pm

Hi All! I'm new to scalix but so far i'm really digging it. I noticed that it takes a long time to load the inbox and the sent messages folder when I log onto the server. I did some checking around and realized it was postgre not running. I checked my logs

FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 7.4, which is not compatible with this version 8.1.8.

I installed added the dag repositories and did a yum upgrade to get the clamav rpm's and it upgraded my postgresql. Is there a simple way to undo this and/or make the database 8.1.8 compatible?

Thanks!

Valerion
Scalix Star
Scalix Star
Posts: 2730
Joined: Thu Feb 26, 2004 7:40 am
Location: Johannesburg, South Africa
Contact:

Postby Valerion » Mon Mar 19, 2007 5:56 am

This is a known issue with PostgreSQL. You have to redo your databases after a major verison upgrade. Since there's nothing important in the database that can't be recreated, I would suggest you try to reconfigure the PostgreSQL support in Scalix. If that still doesn't work, uninstall the Scalix PostgreSQL integration, it, then remove /var/opt/scalix/??/postgres and re-install the PostgreSQL integration.

jimjawn

Postby jimjawn » Mon Mar 19, 2007 8:04 am

Uninstall/Reinstall worked like a charm. Much better now. Thanks.

haison_company

Postby haison_company » Thu Mar 22, 2007 9:38 pm

After removing old version 7.4, I downloaded the latest version 8.2 and installed smoothly.

But when starting the new database, there is an error:

Failed to initialize database :

touch: cannot touch `/var/lib/pgsql/pgstartup.log': No such file or directory

Could you explain more on the procedure to upgrade the Postgresql database?

ScalixSupport
Scalix
Scalix
Posts: 5503
Joined: Thu Mar 25, 2004 8:15 pm

Postby ScalixSupport » Fri Mar 23, 2007 1:44 am

Hi!

Run the scalix-installer and re-configure Scalix-DB component.

Thanks,
Subir

haison_company

Postby haison_company » Fri Mar 23, 2007 8:17 pm

Yes, I re-installed the Scalix-postgresql but when run # service postgresql start there is an error:
touch: cannot touch `/var/lib/pgsql/pgstartup.log': No such file or directory

FATAL: database files are incompatible with server
DETAIL: The data directory was initialized by PostgreSQL version 7.4, which is not compatible with this version 8.2.3.

haison_company

Postby haison_company » Sat Mar 24, 2007 10:05 pm

After studying the postgresql manual, I found the solution for this problem: http://www.postgresql.org/docs/8.2/inte ... uster.html

Even I installed the Postgresql database server, it is important to initiate it. Here comes the tricky part, YOU NEED TO MAKE THE DATA FOLDER WITH "POSTGRES" USER PERMISSION.

Before you can do anything, you must initialize a database storage area on disk. We call this a database cluster. (SQL uses the term catalog cluster.) A database cluster is a collection of databases that is managed by a single instance of a running database server. After initialization, a database cluster will contain a database named postgres, which is meant as a default database for use by utilities, users and third party applications. The database server itself does not require the postgres database to exist, but many external utility programs assume it exists. Another database created within each cluster during initialization is called template1. As the name suggests, this will be used as a template for subsequently created databases; it should not be used for actual work. (See Chapter 19 for information about creating new databases within a cluster.)

In file system terms, a database cluster will be a single directory under which all data will be stored. We call this the data directory or data area. It is completely up to you where you choose to store your data. There is no default, although locations such as /usr/local/pgsql/data or /var/lib/pgsql/data are popular. To initialize a database cluster, use the command initdb, which is installed with PostgreSQL. The desired file system location of your database cluster is indicated by the -D option, for example

$ initdb -D /usr/local/pgsql/data

Note that you must execute this command while logged into the PostgreSQL user account, which is described in the previous section.

Tip: As an alternative to the -D option, you can set the environment variable PGDATA.

initdb will attempt to create the directory you specify if it does not already exist. It is likely that it will not have the permission to do so (if you followed our advice and created an unprivileged account). In that case you should create the directory yourself (as root) and change the owner to be the PostgreSQL user. Here is how this might be done:

root# mkdir /usr/local/pgsql/data
root# chown postgres /usr/local/pgsql/data
root# su postgres
postgres$ initdb -D /usr/local/pgsql/data

After this step, everything will be fine :idea:


Return to “Installation”



Who is online

Users browsing this forum: No registered users and 6 guests

cron