View previous topic :: View next topic |
Author |
Message |
thurnax Tux's lil' helper
Joined: 17 Apr 2014 Posts: 90
|
Posted: Sat Apr 23, 2016 10:03 am Post subject: [Solved] Problems upgrading postgresql server after depclean |
|
|
I while ago I managed to install postgresql 9.4 on my system and got it up and running. I was happy with that, although I saw that also 9.5 was installed.
Then I went on to install django. The version of it was 1.8.9. I wasn't happy with that because the backend of it didn't work with postgresql. So I forced an update of django to the "unstable" package of 1.9.2. The backend seems to work now.
But then when I did an emerge --depclean, postgresql 9.4 was removed, and now I'm stuck with a dysfunctional installation of postgresql 9.5.
So my question is simple; how do I get postgresl 9.5 working? I don't care about migration, I just want to get it up and running and interface properly with django (i.e. setting up a proper role with required access privileges and database for django).
The emerge --config dev-db/postgresql:9.5 doesn't set up proper configuration for postgresql.
I cannot use pg_upgrade to migrate the old config files because the binaries for the old installation is now removed through depclean. What to do?
Last edited by thurnax on Sat Apr 23, 2016 6:09 pm; edited 1 time in total |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Apr 23, 2016 4:16 pm Post subject: |
|
|
What do you mean by "doesn't set up proper configuration"? It initializes the postgres server exactly the same in each version. Just redo the initial setup and configuration steps you did for 9.4. |
|
Back to top |
|
|
thurnax Tux's lil' helper
Joined: 17 Apr 2014 Posts: 90
|
Posted: Sat Apr 23, 2016 4:39 pm Post subject: |
|
|
By that, I mean that the '/var/lib/postgresql/9.5/data' directory is empty. After reading the Gentoo page for Postgresql I found out that 'initdb -D /var/lib/postgresql/9.5/data' takes care of that.
I found a way to reinstall Postgresql 9.4; after browsing around in '/usr/portage' I found that 'emerge --ask =dev-db/postgresql-9.4.7' did the job.
But still 'pg_upgrade' doesn't work. I acknowledge that one should as a root do 'su - postgres' and then run this command, but when issuing
postgres@computer ~ $ pg_upgrade -U postgres -d /var/lib/postgresql/9.4/data -D /var/lib/postgresql/9.5/data -b /usr/lib/postgresql-9.4/bin -B /usr/lib/postgresql-9.5/bin
I get
Code: | Performing Consistency Checks
-----------------------------
Checking cluster versions ok
connection to database failed: fe_sendauth: no password supplied
could not connect to old postmaster started with the command:
"/usr/lib/postgresql-9.4/bin/pg_ctl" -w -l "pg_upgrade_server.log" -D "/var/lib/postgresql/9.4/data" -o "-p 50432 -b -c listen_addresses='' -c unix_socket_permissions=0700 -c unix_socket_directories='/var/lib/postgresql'" start
Failure, exiting |
Why can't it simply ask for the password should it need it ?!? I know that I said that I'm not interested in migration, but I most likely will be in the future so I find this quite disturbing.
Last edited by thurnax on Sat Apr 23, 2016 5:00 pm; edited 2 times in total |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Apr 23, 2016 4:56 pm Post subject: |
|
|
thurnax wrote: | By that, I mean that the '/var/lib/postgresql/9.5/data' directory is empty. After reading the Gentoo page for Postgresql I found out that 'initdb -D /var/lib/postgresql/9.5/data' takes care of that. |
That sounds strange if there was no error output at all the first time, because emerge --config also runs initdb -D.
Quote: | I found a way to reinstall Postgresql 9.4; after browsing around in '/usr/portage' I found that 'emerge --ask =dev-db/postgresql-9.4.7' did the job. |
emerge postgresql:9.4 would also work there, and won't be depcleaned automatically.
Quote: | Why can't it simply ask for the password should it need it ?!? I know that I said that I'm not interested in migration, but I most likely will be in the future so I find this quite disturbing. |
The pg_upgrade manpage does say to make use of .pgpass or edit pg_hba.conf for exactly that reason... you did read it, right? |
|
Back to top |
|
|
thurnax Tux's lil' helper
Joined: 17 Apr 2014 Posts: 90
|
Posted: Sat Apr 23, 2016 5:05 pm Post subject: |
|
|
Ok, I made sure that both versions of the postgresql server were shut down, ensured that the 'local all all ...' line was set to trust in both '/etc/postgresql-<n>/pg_hba.conf' files. I.e.
Code: | # TYPE DATABASE USER ADDRESS METHOD
# "local" is for Unix domain socket connections only
local all all trust
# IPv4 local connections:
host all all 127.0.0.1/32 password
# IPv6 local connections:
host all all ::1/128 password |
That was enough to make the pg_upgrade execute without errors. Not sure how to make use of .pgpass through pg_update but I suppose I could read the man pages to check it out.
Don't know why "emerge --config" didn't do it. The initdb command worked though.
Perhaps you happen to know how to uninstall postgresql 9.4 while keeping 9.5 when I'm finished with the old version?
Last edited by thurnax on Sat Apr 23, 2016 5:06 pm; edited 1 time in total |
|
Back to top |
|
|
Ant P. Watchman
Joined: 18 Apr 2009 Posts: 6920
|
Posted: Sat Apr 23, 2016 5:06 pm Post subject: |
|
|
Just do emerge -C postgresql:9.4, you might also want to do emerge --noreplace postgresql:9.5 afterwards to make sure that doesn't get depcleaned when 9.6 comes out. |
|
Back to top |
|
|
thurnax Tux's lil' helper
Joined: 17 Apr 2014 Posts: 90
|
Posted: Sat Apr 23, 2016 6:07 pm Post subject: |
|
|
Hmm, I'm seeing into future how I'm struggling to remove 9.5 because I don't know how to unset the --noreplace flag after I'm finished with them migration to 9.6.
Everything works fine now and django is now properly accessing the postgres server. I guess it is recommended to use 1.9.2 instead of 1.8.9. I'm originally from MariaDB/MySQL but I think I'll get used to Postgresql eventually.
Thank you for your help! |
|
Back to top |
|
|
|