pgpool / pgpool2

This is the official mirror of git://git.postgresql.org/git/pgpool2.git. Note that this is just a *mirror* - we don't work with pull requests on github. Please subscribe to pgpool-hackers mailing list from our website and submit your patch to this mailing list.
https://www.pgpool.net
Other
305 stars 87 forks source link

[v3.5.3] PCP options from pgpool.conf not being used #4

Open CodeGordon opened 7 years ago

CodeGordon commented 7 years ago

OS: ArchLinux Kernel: 4.6.4-GrSec PgSQL: 9.5.3 PgPool-II: 3.5.3

Compile-time options:

./configure \
    --prefix=/usr \
    --with-openssl \
    --sysconfdir=/etc/pgpool \
    --mandir=/usr/share/man

pgpool.conf (relevant options):

# ...
socket_dir = '/run/postgresql'
# ...
pcp_listen_addresses = ''
pcp_port = 9090
pcp_socket_dir = '/run/postgresql'
# ...
wd_ipc_socket_dir = '/run/postgresql'
# ...

This file should be in /run/postgresql, not in /tmp:

# ls -lAt /tmp
total 0
srwxrwxrwx 1 root root  0 Jul 12 15:17 .s.PGSQL.9090

The PCP service should not be listening on any address, let alone every address.

# ss -lnt | grep ':9090'
LISTEN     0      48           *:9090                     *:*

The pcp_pool_status tool is, according to documentation, supposed to be using the same pgpool.conf file as the main service. It either is not, or has its values hardcoded. No option is listed in the documentation to use a specific configuration file.

# pcp_pool_status -U <user>
ERROR: connection to socket "/tmp/.s.PGSQL.9898" failed with error "No such file or directory"
codeforall commented 7 years ago

All PCP client side tools are independent of pgpool server side settings and have no visibility and access to the pgpool.conf file, Since the utility can be used to connect to any local or remote pgpool server, So pcp utilities always try to connect on the default socket directory and default port unless explicitly specified in the command's argument.

If you are using a different pcp_socket_dir and/or different pcp_port then you would be required to specify the socket file location and port in the pcp command argument

For example:
# with pcp_port = 9090 and pcp_socket_dir = '/run/postgresql'
pcp_pool_status -h /run/postgresql -p 9090 -U <user>

On the part of pgpool's PCP service listening on all addresses despite setting pcp_listen_addresses to empty string, I am able to reproduce the problem and will fix it.

Thanks