When i am trying to register pemagent in anotherhost using pemworker command iam getting error like No route to host - edb

[root#localhost bin]# ./pemworker --register-agent --pem-server 192.168.254.199 --pem-port 5432 --pem-user postgres --display-name MasterAgent --allow_server_restart true --allow-batch-probes true --enable-smtp true
Wed Jun 1 23:21:55 2022 WARNING: ConnectToPEM: unable to connect to PEM database: connection to server at "192.168.254.199", port 5432 failed: No route to host
Is the server running on that host and accepting TCP/IP connections?
Wed Jun 1 23:21:55 2022 ERROR: Unable to connect to Postgres Enterprise Manager Server

Related

tunnel-bastion-client service cannot start

I am trying to establish tunnel bastion connection between two ec2 instance. The client side is allowing Lambda to reach server side RDS. I checked the client side ec2 and find the service tunnel-bastion-client cannot start.
Aug 17 23:07:49 ip-172-31-25-38 systemd[1]: tunnel-bastion-client.service: Scheduled restart job, restart counter is>
Aug 17 23:07:49 ip-172-31-25-38 systemd[1]: Stopped Maintain connection with tunnel bastion.
Aug 17 23:07:49 ip-172-31-25-38 systemd[1]: Started Maintain connection with tunnel bastion.
Aug 17 23:07:50 ip-172-31-25-38 ssh[186032]: Host key verification failed.
Aug 17 23:07:50 ip-172-31-25-38 systemd[1]: tunnel-bastion-client.service: Main process exited, code=exited, status=>
Aug 17 23:07:50 ip-172-31-25-38 systemd[1]: tunnel-bastion-client.service: Failed with result 'exit-code'
For some reason, the tunnel-bastion-client service cannot be started manually. I can connect RDS from server side ec2. So, it is not the database issue.
# psql -h xxxx-xxxx-xxxxxxx.xxxxxxxxxxxxx.us-west-1.rds.amazonaws.com -p 5432 postgres
Password:
psql (10.18 (Ubuntu 10.18-0ubuntu0.18.04.1), server 11.9)
WARNING: psql major version 10, server major version 11.
Some psql features might not work.
SSL connection (protocol: TLSv1.2, cipher: ECDHE-RSA-AES256-GCM-SHA384, bits: 256, compression: off)
Type "help" for help.
postgres=>
I used the terraform to standup the both ec2 and grabbing from parameter store. Please help me find out where exactly is the issue. Appreciate in advance.
work around, execute "ExecStart" line from /etc/systemd/system/tunnel-bastion-client.service file.

Postgres: "Failed to load sql modules into the database cluster" and other errors

I run Windows and I am trying to install postgres, but I can't get it to work. During installation, I get the error:
Failed to load sql modules into the database cluster
When I try to access the server in pgadmin or via SQL Shell, I get the error:
could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432? could not connect to server: Connection refused (0x0000274D/10061) Is the server running on host "localhost" (127.0.0.1) and accepting TCP/IP connections on port 5432?"
I have found a log in the data-folder saying:
2021-04-08 14:53:44.315 CEST [11088] LOG: starting PostgreSQL 13.2, compiled by Visual C++ build 1914, 64-bit
2021-04-08 14:53:44.321 CEST [11088] LOG: could not listen on IPv6 address "::": Permission denied
2021-04-08 14:53:44.326 CEST [11088] LOG: could not listen on IPv4 address "0.0.0.0": Permission denied
2021-04-08 14:53:44.327 CEST [11088] WARNING: could not create listen socket for "*"
2021-04-08 14:53:44.328 CEST [11088] FATAL: could not create any TCP/IP sockets
2021-04-08 14:53:44.331 CEST [11088] LOG: database system is shut down
Can someone please help me?
I had the same issue and followed different tips and tricks available on the internet but nothing worked.
I fixed that issue by following these steps:
First disable antivirus for an hour
Create a folder in either C drive or D drive and give full permission to User
Then again install a fresh application. If you have already installed then uninstall that and install from starting.
Make sure to choose that folder only at the time of installation

Is it needed to use more than one computer for master slave replication?

I am trying to create master slave replication physically with postgresql11 in debian10. I got same errors from different linux dists so is it something related making the replication in same computer? Or something related with master-slave accounts ?
root#dlp:~# vi /etc/postgresql/11/main/postgresql.conf
listen_addresses = '*'
wal_level = replica
synchronous_standby_names = '*'
wal_keep_segments = 10
I configured the pg_hba.conf as follows:
#host replication all 127.0.0.1/32 md5
#host replication all ::1/128 md5
host replication rep_user 127.0.0.1/32 trust
host replication rep_user 10.0.0.30/32 trust
host replication rep_user 10.0.0.51/32 trust
After this segment:
#i didnt create new user as node1 i just used my root/postgres account for all the processes
root#node01:~# systemctl stop postgresql
root#node01:~# rm -rf /var/lib/postgresql/11/main/*
root#node01:~# su - postgres
postgres#node01:~$ pg_basebackup -R -h dlp.srv.world -U rep_user -D /var/lib/postgresql/11/main -P
I got the following error:
pg_basebackup: could not connect to server: could not connect to server: Connection refused
Is the server running on host "dlp.srv.world" (180.43.145.38) and accepting
TCP/IP connections on port 5432?
also in the root account postgres is working fine but i doest show that port 5432 listening?
netstat -nlt
tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN
tcp6 0 0 ::1:631 :::* LISTEN
when i check the status of "postgresql" is says active but when i type :
systemctl status postgresql#11-main
Dec 14 06:20:52 debian postgresql#11-main[6260]: Error: /usr/lib/postgresql/11/bin/pg_ctl /
Dec 14 06:20:52 debian postgresql#11-main[6260]: pg_ctl: directory "/var/lib/postgresql/11/
Dec 14 06:20:52 debian systemd[1]: postgresql#11-main.service: Can't open PID file /run/pos
Dec 14 06:20:52 debian systemd[1]: postgresql#11-main.service: Failed with result 'protocol
Dec 14 06:20:52 debian systemd[1]: Failed to start PostgreSQL Cluster 11-main.
i got that error.

Problem connecting to RDS from EC2 instance: Is the server running on host/accepting TCP/IP connections on port 5432?

I have personal AWS EC2 server and I'm using ssh into this server. I installed PostgreSQL on the EC2 instance, cerated a PostgreSQL RDS, and trying to connect to the RDS from EC2 CLI. I get following error:
Is the server running on host "db-xxxx.us-east-2.rds.amazonaws.com" and accepting
TCP/IP connections on port 5432?
I have:
- change RDS to publicly accessible
- added listen_addresses = '*' to postgres.conf
- added 0.0.0.0/0 md5 to pg_hba.conf
# IPv4 local connections:
host all all 0.0.0.0/0 md5
ensured both EC2 and RDS have same security group
added security-group-for-inbound-nfs-xx to RDS
enabled IAM authorization on RDS
output of "service postgresql status" shows postgres is running and listening on the port 5432
Redirecting to /bin/systemctl status postgresql.service
● postgresql.service - PostgreSQL database server
Loaded: loaded (/usr/lib/systemd/system/postgresql.service; enabled; vendor preset: disabled)
Active: active (running) since Wed 2020-06-03 04:28:54 UTC; 20min ago
Process: 3065 ExecStartPre=/usr/libexec/postgresql-check-db-dir %N (code=exited, status=0/SUCCESS)
Main PID: 3070 (postmaster)
CGroup: /system.slice/postgresql.service
├─3070 /usr/bin/postmaster -D /var/lib/pgsql/data
├─3084 postgres: logger process
├─3089 postgres: checkpointer process
├─3090 postgres: writer process
├─3091 postgres: wal writer process
├─3092 postgres: autovacuum launcher process
├─3093 postgres: stats collector process
└─3094 postgres: bgworker: logical replication launcher
I see postgres is running and listning on the port 5432.
postmaster[3070]: 2020-06-03 04:28:54.168 UTC [3070] LOG: listening on IPv4 address "0.0.0.0", port 5432
Jun 03 04:28:54 ip-172-xx-xx-xx9.us-east-2.compute.internal postmaster[3070]: 2020-06-03 04:28:54.168 UTC [3070] LOG: listening on IPv6 address "::", port 5432
Jun 03 04:28:54 ip-172-xx-xx-xx9.us-east-2.compute.internal postmaster[3070]: 2020-06-03 04:28:54.169 UTC [3070] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
Jun 03 04:28:54 ip-172-xx-xx-xx.us-east-2.compute.internal postmaster[3070]: 2020-06-03 04:28:54.171 UTC [3070] LOG: listening on Unix socket "/tmp/.s.PGSQL.5432"
Jun 03 04:28:54 ip-xx-xx-xx.us-east-2.compute.internal postmaster[3070]: 2020-06-03 04:28:54.198 UTC [3070] LOG: redirecting log output to logging collector process
Jun 03 04:28:54 ip-xx-xx-xx.us-east-2.compute.internal postmaster[3070]: 2020-06-03 04:28:54.198 UTC [3070] HINT: Future log output will appear in directory "log".
Jun 03 04:28:54 ip-172-31-36-109.us-east-2.compute.internal systemd[1]: Started PostgreSQL database server.
I have verified everything provided here:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html
https://aws.amazon.com/premiumsupport/knowledge-center/rds-connectivity-instance-subnet-vpc/
What am I missing? Thanks for the help.
Well, RDS will tell you the endpoint of your PSQL, and the default port would be 5432 right. But I suggest you do the double-check if the endpoint you connected is the same with the RDS dashboard.
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_ConnectToPostgreSQLInstance.html
I had the same issue with identical error. It was fixed when I added Private IP of my EC2 instance to security group used by the instance of my PostgreSQL database from RDS.

Restart PostgreSQL without postgresql-server

I'm on CentOS 7 and I'm trying to get through the 'PG::ConnectionBad: FATAL: Peer authentication failed for user' error.
So I've already figured out that I should change pg_hba.conf (peer to md5) and I've done it. It seems that I have to restart postgres but it is not so easy as I thought.
I tried 'service postgresql restart' which resulted in 'Failed to restart postgresql.service: Unit not found.'
Then tried to install posgresql-server. Got:
oct 23 01:16:15 serverct1 pg_ctl[3280]: HINT: Is another postmaster already running on port 5432? If ...try.
oct 23 01:16:15 serverct1 pg_ctl[3280]: WARNING: could not create listen socket for "localhost"
oct 23 01:16:15 serverct1 pg_ctl[3280]: FATAL: could not create any TCP/IP sockets
oct 23 01:16:16 serverct1 pg_ctl[3280]: pg_ctl: could not start server
oct 23 01:16:16 serverct1 systemd[1]: postgresql.service: control process exited, code=exited status=1
oct 23 01:16:16 serverct1 systemd[1]: Failed to start PostgreSQL database server.
About 5432 port usage:
postgres 5432/tcp postgresql # POSTGRES
postgres 5432/udp postgresql # POSTGRES
So I'm curious:
1) Do postgresql and postgresql-server work separately?
2) Is it possible to restart posgresql without postgresql-server?
3) If not - how to get the port 5432 free in order to run postgresql-server?
You can avoid troubles with serverct1 if you use standard postgres pg_ctl, eg:
pg_ctl reload
Or if needed pg_ctl reload -D $PGDATA
You dont need to restart the postgres for pg_hba changes to apply: https://www.postgresql.org/docs/current/static/auth-pg-hba-conf.html
The pg_hba.conf file is read on start-up and when the main server
process receives a SIGHUP signal. If you edit the file on an active
system, you will need to signal the postmaster (using pg_ctl reload or
kill -HUP) to make it re-read the file.