psql.bin: error: connection to server on socket "/tmp/.s.PGSQL.5432" failed: No such file or directory Is the server running locally and accepting connections on that socket?
Updating the certificate for VC extension com.vmware.vim.eamError while updating the certificate for VC extension com.vmware.vim.eamStderr :-[ psql.bin: error: could not connect to server: No such file or directoryIs the server running locally and acceptingconnections on Unix domain socket "/tmp/.s.PGSQL.5432"?] Command Failed!!
In both scenarios above, the error shows that psql is looking in the /tmp/ folder for the Unix domain socket file instead of the correct location /var/run/vpostgres
service-control --status vmware-vpostgresRunning: vmware-vpostgres
vCenter Server 7.0
vCenter Server 8.0
This can happen if the environment variable PGHOST is not set.
To check this, execute the following command at the BASH shell in vCenter:
echo $PGHOSTThe expected/correct output is: /var/run/vpostgres
If this is empty, psql will use the default value of /tmp
This environment variable is set when /etc/profile.d/vmware-vpostgres-config.sh is executed at the start of every SSH session.
If this file was removed or changed, this can result in environment variables not being correctly set.
Copy the file from a working vCenter, or else create a new /etc/profile.d/vmware-vpostgres-config.sh file with the following contents:
export VMWARE_POSTGRES_ROOT=/opt/vmware/vpostgresexport VMWARE_POSTGRES_BASE=$VMWARE_POSTGRES_ROOT/currentexport VMWARE_POSTGRES_BIN=$VMWARE_POSTGRES_BASE/binexport VMWARE_POSTGRES_ETC=$VMWARE_POSTGRES_BASE/etcexport VMWARE_POSTGRES_SCRIPTS=$VMWARE_POSTGRES_BASE/scriptsexport VMWARE_POSTGRES_DB_ADMIN=postgresexport VMWARE_POSTGRES_OS_ADMIN=vpostgresexport VMWARE_POSTGRES_VMON_GROUP=vpgmongrpexport VMWARE_POSTGRES_MOUNT_DATA=/storage/dbexport VMWARE_POSTGRES_DATA=$VMWARE_POSTGRES_MOUNT_DATA/vpostgresexport VMWARE_POSTGRES_SSL_DATA=$VMWARE_POSTGRES_MOUNT_DATA/vpostgres_sslexport VMWARE_POSTGRES_MOUNT_XLOG=/storage/dblogexport VMWARE_POSTGRES_XLOG=$VMWARE_POSTGRES_MOUNT_XLOG/vpostgres/pg_xlogexport VMWARE_POSTGRES_LOG=/var/log/vmware/vpostgresexport VMWARE_POSTGRES_MOUNT_ARCHIVE=/storage/archiveexport VMWARE_POSTGRES_ARCHIVE=$VMWARE_POSTGRES_MOUNT_ARCHIVE/vpostgresexport VMWARE_POSTGRES_BACKUP=$VMWARE_POSTGRES_MOUNT_ARCHIVE/backup_dataexport VMWARE_POSTGRES_MOUNT_SEAT=/storage/seatexport VMWARE_POSTGRES_TBSPACE_SEAT=$VMWARE_POSTGRES_MOUNT_SEAT/vpostgresexport VMWARE_POSTGRES_DB_REPLICATION=replicatorexport PGHOST=/var/run/vpostgresexport PGSERVICEFILE=$VMWARE_POSTGRES_DATA/pg_service.conf
This should not require a reboot/restart of services, but you would need to start a new SSH session for the changes to take effect.