| View previous topic :: View next topic |
| Author |
Message |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Nov 28, 2011 5:49 am Post subject: upgrading to postgresql 9.1 |
|
|
Are there any easy way to upgrade between postgresql versions 9.0 to 9.1
From my notes: | Quote: | First, make sure you backup all your databases:
pg_dumpall -U postgres > postgres-backup.dump
emerge virtual/postgresql-base virtual/postgresql-server
emerge --config =dev-db/postgresql-server-9.1.1
/etc/init.d/postgresql-9.1 start
Do I need to restore the databases? |
_________________ #Joseph |
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
|
| Back to top |
|
 |
titanofold Developer

Joined: 30 Dec 2003 Posts: 225 Location: Bryson City, NC USA
|
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Mon Dec 05, 2011 1:34 am Post subject: |
|
|
I've followed those instruction, but it seems to me they are not complete: | Code: | mkdir /var/lib/postgresql/9.1/
mkdir /var/lib/postgresql/9.1/data
chown postgres:postgres /var/lib/postgresql/9.1/data/
ln -s /etc/postgresql-9.0/*.conf /var/lib/postgresql/9.0/data/
ln -s /etc/postgresql-9.1/*.conf /var/lib/postgresql/9.1/data/
su - postgres
postgres@syscon2 ~ $ pg_upgrade -u postgres \
> -d /var/lib/postgresql/9.0/data -D /var/lib/postgresql/9.1/data \
> -b /usr/lib/postgresql-9.0/bin/ -B /usr/lib/postgresql-9.1/bin
Performing Consistency Checks
-----------------------------
Checking old data directory (/var/lib/postgresql/9.0/data) ok
Checking old bin directory (/usr/lib/postgresql-9.0/bin) ok
Checking new data directory (/var/lib/postgresql/9.1/data) ok
Checking new bin directory (/usr/lib/postgresql-9.1/bin) ok
This utility can only upgrade to PostgreSQL version 9.0. |
The last statement: This utility can only upgrade to PostgreSQL version 9.0.
I'm upgrading from 9.0 to 9.1, is it significant?
The data databases did not get transfered. I have tired to transfer the data but I get an error:
You must have read and write access in the current directory. | Code: | pg_upgrade91 -v --old-datadir=/var/lib/postgresql/9.0/data/ --new-datadir=/var/lib/postgresql/9.1/data --old-bindir=/usr/lib/postgresql-9.0/bin/ --new-bindir=/usr/lib/postgresql-9.1/bin/
Running in verbose mode
Performing Consistency Checks
-----------------------------
Checking current, bin, and data directories
You must have read and write access in the current directory. |
data - directory is owned by "postgres" so why it is complaining about not able to read/write?
| Code: | ls -al /var/lib/postgresql/9.1/
total 12
drwx------ 13 postgres postgres 4096 Dec 4 18:20 data |
_________________ #Joseph |
|
| Back to top |
|
 |
titanofold Developer

Joined: 30 Dec 2003 Posts: 225 Location: Bryson City, NC USA
|
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Thu Dec 08, 2011 4:17 am Post subject: |
|
|
I did not check which directory I was IN but when I do "su - postgres" it places me in: /var/lib
should I be in: /var/lib/postgresql ?
postgresql has permission:
drwxr-xr-x 7 postgres postgres 4096 Nov 27 23:23 postgresql
I'll be upgrading another server most likely tomorrow. _________________ #Joseph |
|
| Back to top |
|
 |
Joseph_sys Advocate

Joined: 08 Jun 2004 Posts: 2316 Location: Edmonton, AB
|
Posted: Thu Dec 08, 2011 5:46 am Post subject: |
|
|
OK, the sequence that worked for me is: | Code: | su - postgres
postgres@syscon4 ~ $ pg_upgrade -u postgres -d /var/lib/postgresql/9.0/data -D /var/lib/postgresql/9.1/data -b /usr/lib/postgresql-9.0/bin -B /usr/lib/postgresql-9.1/bin
Performing Consistency Checks
-----------------------------
Checking old data directory (/var/lib/postgresql/9.0/data) ok
Checking old bin directory (/usr/lib/postgresql-9.0/bin) ok
Checking new data directory (/var/lib/postgresql/9.1/data) ok
Checking new bin directory (/usr/lib/postgresql-9.1/bin) ok
This utility can only upgrade to PostgreSQL version 9.0. |
Question.
Is the old databases from 9.0/data suppose to be transfered to new directory 9.1/data ?
As I'm getting only basic databases (not all of them got transfered - the one I created). | Code: | psql -U postgres -l
List of databases
Name | Owner | Encoding | Collation | Ctype | Access privileges
-----------+----------+----------+-------------+-------------+-----------------------
postgres | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +
| | | | | postgres=CTc/postgres
(3 rows) |
_________________ #Joseph |
|
| Back to top |
|
 |
titanofold Developer

Joined: 30 Dec 2003 Posts: 225 Location: Bryson City, NC USA
|
|
| Back to top |
|
 |
risa2000 n00b

Joined: 17 Oct 2004 Posts: 34
|
Posted: Mon Jul 30, 2012 10:26 am Post subject: |
|
|
I just want to add that on new gentoo (probably udev, but I am not sure what exactly triggered the change) the local sockets are expected in /run/postgresql but for some reason some tools from the package stick to /var/run/postgresql.
I tried to set unix_socket_directory but neither the former nor the latter helped, so finally I needed to "ln -s /var/run/postgresql /run" to be able to run pg_upgrade91. |
|
| Back to top |
|
 |
|