Обсуждение: yum packages for 9.5 vs <=9.4
the yum packages for 9.5 apparently changed the path of the socket from /tmp to /var/run/postgresql I have several versions installed on the same dev system running on different ports.... for 9.1 through 9.4 this was no problem, but since I installed 9.5, I now have to specify -h /tmp -p XXXX to connect to an earlier version, this has raised havoc with my scripts and stuff, for instance this script invoked from crontab no longer works on the earlier versions... #!/bin/bash ## postgres backup script DD=$(date +%a) PP=/backups/pgsql/svfis-kvm3 for p in 5432 5433 5434 5435; do pg_dumpall -p $p -g -f $PP/pg_dumpall.$p.globals-$DD.sql for db in $(psql -p $p -tc "select datname from pg_database where not datistemplate"); do pg_dump -Fc -p $p --schema-only -f $PP/pgdump.$p.$db.$DD.dump -d $db done done -- john r pierce, recycling bits in santa cruz
On 01/21/2016 10:09 AM, John R Pierce wrote: > the yum packages for 9.5 apparently changed the path of the socket from > /tmp to /var/run/postgresql > > I have several versions installed on the same dev system running on > different ports.... for 9.1 through 9.4 this was no problem, but since > I installed 9.5, I now have to specify -h /tmp -p XXXX to connect to an > earlier version, this has raised havoc with my scripts and stuff, for > instance this script invoked from crontab no longer works on the earlier > versions... > > #!/bin/bash > ## postgres backup script > DD=$(date +%a) > PP=/backups/pgsql/svfis-kvm3 > for p in 5432 5433 5434 5435; do > pg_dumpall -p $p -g -f $PP/pg_dumpall.$p.globals-$DD.sql > for db in $(psql -p $p -tc "select datname from pg_database where > not datistemplate"); do > pg_dump -Fc -p $p --schema-only -f $PP/pgdump.$p.$db.$DD.dump -d > $db > done > done I have not actually done it but from here: http://www.postgresql.org/docs/9.5/interactive/runtime-config-connection.html unix_socket_directories (string) Specifies the directory of the Unix-domain socket(s) on which the server is to listen for connections from client applications. Multiple sockets can be created by listing multiple directories separated by commas. Whitespace between entries is ignored; surround a directory name with double quotes if you need to include whitespace or commas in the name. An empty value specifies not listening on any Unix-domain sockets, in which case only TCP/IP sockets can be used to connect to the server. The default value is normally /tmp, but that can be changed at build time. This parameter can only be set at server start. In addition to the socket file itself, which is named .s.PGSQL.nnnn where nnnn is the server's port number, an ordinary file named .s.PGSQL.nnnn.lock will be created in each of the unix_socket_directories directories. Neither file should ever be removed manually. This parameter is irrelevant on Windows, which does not have Unix-domain sockets. Seems it would be possible to change the above to point at both /tmp and /var/run/postgresql and keep everybody happy. > > > -- Adrian Klaver adrian.klaver@aklaver.com
On 01/21/2016 10:09 AM, John R Pierce wrote: > the yum packages for 9.5 apparently changed the path of the socket from > /tmp to /var/run/postgresql > > I have several versions installed on the same dev system running on > different ports.... for 9.1 through 9.4 this was no problem, but since > I installed 9.5, I now have to specify -h /tmp -p XXXX to connect to an > earlier version, this has raised havoc with my scripts and stuff, for > instance this script invoked from crontab no longer works on the earlier > versions... > > #!/bin/bash > ## postgres backup script > DD=$(date +%a) > PP=/backups/pgsql/svfis-kvm3 > for p in 5432 5433 5434 5435; do > pg_dumpall -p $p -g -f $PP/pg_dumpall.$p.globals-$DD.sql > for db in $(psql -p $p -tc "select datname from pg_database where > not datistemplate"); do > pg_dump -Fc -p $p --schema-only -f $PP/pgdump.$p.$db.$DD.dump -d > $db > done > done > > Curiosity got the better of me, so now I have tried it: unix_socket_directories = '/tmp, /var/run/postgresql' aklaver@panda:~> /usr/local/pgsql95/bin/psql -d postgres -p 5462 -h /tmp -U postgres psql (9.5.0) Type "help" for help. postgres=# \q aklaver@panda:~> /usr/local/pgsql95/bin/psql -d postgres -p 5462 -h /var/run/postgresql -U postgres psql (9.5.0) Type "help" for help. postgres=# -- Adrian Klaver adrian.klaver@aklaver.com
Hi, On Thu, 2016-01-21 at 10:09 -0800, John R Pierce wrote: > the yum packages for 9.5 apparently changed the path of the socket > from /tmp to /var/run/postgresql I think we use both now. If not, that must be a packaging bug. On my boxes, I can see that the unix_socket_directory points to both. > I have several versions installed on the same dev system running on > different ports.... for 9.1 through 9.4 this was no problem, but > since I installed 9.5, I now have to specify -h /tmp -p XXXX to > connect to an > earlier version, this has raised havoc with my scripts and stuff, > for > instance this script invoked from crontab no longer works on the > earlier > versions... Sorry about that, but we had to do it. Regards, -- Devrim GÜNDÜZ Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer Twitter: @DevrimGunduz , @DevrimGunduzTR
Вложения
Hi again, On Thu, 2016-01-21 at 21:46 +0200, Devrim GÜNDÜZ wrote: > Sorry about that, but we had to do it. Here is the reason why: https://bugzilla.redhat.com/show_bug.cgi?id=825448 Regards, -- Devrim GÜNDÜZ Principal Systems Engineer @ EnterpriseDB: http://www.enterprisedb.com PostgreSQL Danışmanı/Consultant, Red Hat Certified Engineer Twitter: @DevrimGunduz , @DevrimGunduzTR
Вложения
On 1/21/2016 11:46 AM, Devrim GÜNDÜZ wrote: > Hi, > > On Thu, 2016-01-21 at 10:09 -0800, John R Pierce wrote: >> >the yum packages for 9.5 apparently changed the path of the socket >> >from /tmp to /var/run/postgresql > I think we use both now. If not, that must be a packaging bug. On my > boxes, I can see that the unix_socket_directory points to both. > indeed, 9.5 is putting it in both places, but 9.5's libpq is looking for it in /var/run/pgsql ... the problem is the older versions are only putting it in /tmp, so the newer libpq doesn't work. does unix_socket_directory allow dual locations in 9.1+ ? I guess I should just try that... -- john r pierce, recycling bits in santa cruz
On 1/21/2016 12:00 PM, John R Pierce wrote: > On 1/21/2016 11:46 AM, Devrim GÜNDÜZ wrote: >> Hi, >> >> On Thu, 2016-01-21 at 10:09 -0800, John R Pierce wrote: >>> >the yum packages for 9.5 apparently changed the path of the socket >>> >from /tmp to /var/run/postgresql >> I think we use both now. If not, that must be a packaging bug. On my >> boxes, I can see that the unix_socket_directory points to both. >> > > > indeed, 9.5 is putting it in both places, but 9.5's libpq is looking > for it in /var/run/pgsql ... the problem is the older versions are > only putting it in /tmp, so the newer libpq doesn't work. > > does unix_socket_directory allow dual locations in 9.1+ ? I guess I > should just try that... ugh, its unix_socket_directories in 9.3-9.5, and _directory in 9.2, which presumably doesn't allow multiple choices? -- john r pierce, recycling bits in santa cruz
On 01/21/2016 12:00 PM, John R Pierce wrote: > On 1/21/2016 11:46 AM, Devrim GÜNDÜZ wrote: >> Hi, >> >> On Thu, 2016-01-21 at 10:09 -0800, John R Pierce wrote: >>> >the yum packages for 9.5 apparently changed the path of the socket >>> >from /tmp to /var/run/postgresql >> I think we use both now. If not, that must be a packaging bug. On my >> boxes, I can see that the unix_socket_directory points to both. >> > > > indeed, 9.5 is putting it in both places, but 9.5's libpq is looking for > it in /var/run/pgsql ... the problem is the older versions are only > putting it in /tmp, so the newer libpq doesn't work. > > does unix_socket_directory allow dual locations in 9.1+ ? I guess I > should just try that... No: http://www.postgresql.org/docs/9.1/interactive/runtime-config-connection.html > > > -- Adrian Klaver adrian.klaver@aklaver.com
On 01/21/2016 12:00 PM, John R Pierce wrote: > On 1/21/2016 11:46 AM, Devrim GÜNDÜZ wrote: >> Hi, >> >> On Thu, 2016-01-21 at 10:09 -0800, John R Pierce wrote: >>> >the yum packages for 9.5 apparently changed the path of the socket >>> >from /tmp to /var/run/postgresql >> I think we use both now. If not, that must be a packaging bug. On my >> boxes, I can see that the unix_socket_directory points to both. >> > > > indeed, 9.5 is putting it in both places, but 9.5's libpq is looking for > it in /var/run/pgsql ... the problem is the older versions are only > putting it in /tmp, so the newer libpq doesn't work. Alternate method: http://www.postgresql.org/docs/9.5/static/libpq-pgservice.html If you are following what I assume is the pattern of 'naked' binaries being the most recent version, you could create a service file for that version that overrides the defaults. That being said using one version of a binary to connect to multiple Postgres versions seems fragile. > > does unix_socket_directory allow dual locations in 9.1+ ? I guess I > should just try that... > > > -- Adrian Klaver adrian.klaver@aklaver.com