Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
upgrading to postgresql 9.1
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Nov 28, 2011 5:49 am    Post subject: upgrading to postgresql 9.1 Reply with quote

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
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Nov 28, 2011 6:22 am    Post subject: Reply with quote

I've found some decent instructions
http://programminglinuxblog.blogspot.com/2011/10/postgres-90-to-91-upgrade-gentoo.html

but apparently pg_upgrade91 doesn't work as gentoo file are in /etc and pg_upgrade91 expects them in the data directory
_________________
#Joseph
Back to top
View user's profile Send private message
titanofold
Developer
Developer


Joined: 30 Dec 2003
Posts: 225
Location: Bryson City, NC USA

PostPosted: Wed Nov 30, 2011 3:49 pm    Post subject: Reply with quote

You know, you could just read the official Gentoo Docs.

http://www.gentoo.org/doc/en/postgres-howto.xml#doc_chap5
_________________
The best things in life are free.
Guy-1: Surely, you will fold with me...
Guy-2: Alright, but don't call me Shirley
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Mon Dec 05, 2011 1:34 am    Post subject: Reply with quote

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
View user's profile Send private message
titanofold
Developer
Developer


Joined: 30 Dec 2003
Posts: 225
Location: Bryson City, NC USA

PostPosted: Thu Dec 08, 2011 3:57 am    Post subject: Reply with quote

"You must have read and write access in the current directory."

Which directory were you running pg_upgrade91 in?
_________________
The best things in life are free.
Guy-1: Surely, you will fold with me...
Guy-2: Alright, but don't call me Shirley
Back to top
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Thu Dec 08, 2011 4:17 am    Post subject: Reply with quote

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
View user's profile Send private message
Joseph_sys
Advocate
Advocate


Joined: 08 Jun 2004
Posts: 2316
Location: Edmonton, AB

PostPosted: Thu Dec 08, 2011 5:46 am    Post subject: Reply with quote

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
View user's profile Send private message
titanofold
Developer
Developer


Joined: 30 Dec 2003
Posts: 225
Location: Bryson City, NC USA

PostPosted: Fri Dec 09, 2011 3:18 pm    Post subject: Reply with quote

Joseph_sys wrote:
Code:
This utility can only upgrade to PostgreSQL version 9.0.


Use pg_upgrade91 or set 9.1 as the default slot.
Code:
postgresql-config set 9.1

_________________
The best things in life are free.
Guy-1: Surely, you will fold with me...
Guy-2: Alright, but don't call me Shirley
Back to top
View user's profile Send private message
risa2000
n00b
n00b


Joined: 17 Oct 2004
Posts: 34

PostPosted: Mon Jul 30, 2012 10:26 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum