Allowing other host to connect to postgresql-9.1 and restart services in postgresql-9.1
-
06-02-2021 - |
Question
We need to add few Ip address in our pg_hba.conf file so that some new servers can connect to our postgresql database. We did the changes to pg_hba.conf like below
old pg_hba.conf
# 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
host all all 10.150.0.0/16 password
host all all 10.156.14.0/23 password
New Ips to be added to pg_hba.conf
10.24.8.1
10.150.256.170
10.150.256.133
We had done the changes to pg_hba.conf and added entries like below(we directly added IP address without /16 or /32) New pg_hba.conf
# 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
host all all 10.150.0.0/16 password
host all all 10.156.14.0/23 password
host all all 10.24.8.1 password
host all all 10.150.256.170 password
host all all 10.150.256.133 password
Now, we need to restart the postgresql-9.1 server. I tried the below commands but nothing worked.
postgres:~> service status postgresql-9.1
Absolute path to 'service' is '/sbin/service', so it might be intended to be run only by user with superuser privileges (eg. root).
-bash: service: command not found
postgres:~> service postgresql-9.1 status
Absolute path to 'service' is '/sbin/service', so it might be intended to be run only by user with superuser privileges (eg. root).
-bash: service: command not found
postgres:~> systemctl status postgresql-9.4
If 'systemctl' is not a typo you can run the following command to lookup the package that contains the binary:
command-not-found systemctl
-bash: systemctl: command not found
This is the server info having postgresql-9.1 installed
postgres:~> uname -a
Linux camboxtest1 3.0.101-108.87-default #1 SMP Fri Feb 22 16:42:57 UTC 2019 (10e85a8) x86_64 x86_64 x86_64 GNU/Linux
Did i add the IP address in right format ? What will be the command to restart the postgresql-9.1 services?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange