Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

upgrading to postgresql 9.1

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
9 posts • Page 1 of 1
Author
Message
Joseph_sys
Advocate
Advocate
Posts: 2731
Joined: Tue Jun 08, 2004 4:05 pm
Location: Edmonton, AB

upgrading to postgresql 9.1

  • Quote

Post by Joseph_sys » Mon Nov 28, 2011 5:49 am

Are there any easy way to upgrade between postgresql versions 9.0 to 9.1
From my notes:
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?
Top
Joseph_sys
Advocate
Advocate
Posts: 2731
Joined: Tue Jun 08, 2004 4:05 pm
Location: Edmonton, AB

  • Quote

Post by Joseph_sys » Mon Nov 28, 2011 6:22 am

I've found some decent instructions
http://programminglinuxblog.blogspot.co ... entoo.html

but apparently pg_upgrade91 doesn't work as gentoo file are in /etc and pg_upgrade91 expects them in the data directory
Top
titanofold
Developer
Developer
Posts: 235
Joined: Tue Dec 30, 2003 7:00 pm
Location: Bryson City, NC USA

  • Quote

Post by titanofold » Wed Nov 30, 2011 3:49 pm

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

http://www.gentoo.org/doc/en/postgres-h ... #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
Top
Joseph_sys
Advocate
Advocate
Posts: 2731
Joined: Tue Jun 08, 2004 4:05 pm
Location: Edmonton, AB

  • Quote

Post by Joseph_sys » Mon Dec 05, 2011 1:34 am

I've followed those instruction, but it seems to me they are not complete:

Code: Select all

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: Select all

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: Select all

ls -al /var/lib/postgresql/9.1/
total 12
drwx------ 13 postgres postgres 4096 Dec  4 18:20 data
Top
titanofold
Developer
Developer
Posts: 235
Joined: Tue Dec 30, 2003 7:00 pm
Location: Bryson City, NC USA

  • Quote

Post by titanofold » Thu Dec 08, 2011 3:57 am

"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
Top
Joseph_sys
Advocate
Advocate
Posts: 2731
Joined: Tue Jun 08, 2004 4:05 pm
Location: Edmonton, AB

  • Quote

Post by Joseph_sys » Thu Dec 08, 2011 4:17 am

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.
Top
Joseph_sys
Advocate
Advocate
Posts: 2731
Joined: Tue Jun 08, 2004 4:05 pm
Location: Edmonton, AB

  • Quote

Post by Joseph_sys » Thu Dec 08, 2011 5:46 am

OK, the sequence that worked for me is:

Code: Select all

 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: Select all

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)
Top
titanofold
Developer
Developer
Posts: 235
Joined: Tue Dec 30, 2003 7:00 pm
Location: Bryson City, NC USA

  • Quote

Post by titanofold » Fri Dec 09, 2011 3:18 pm

Joseph_sys wrote:

Code: Select all

This utility can only upgrade to PostgreSQL version 9.0.
Use pg_upgrade91 or set 9.1 as the default slot.

Code: Select all

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
Top
risa2000
n00b
n00b
Posts: 35
Joined: Sun Oct 17, 2004 3:34 pm

  • Quote

Post by risa2000 » Mon Jul 30, 2012 10:26 am

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.
Top
Post Reply

9 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic