How can I set up pgAgent as a daemon? - postgresql

I'm trying to set the PostgreSQL pgAgent as a daemon on Ubuntu Server 20.04, but I'm getting the following error and I can't find much documentation about it:
ERROR: Stopping pgAgent: Couldn't establish the primary connection with the database server.
I am trying it in the following way:
pgagent host=/var/run/postgresql dbname=mydb user=mydb
What is this due to or what needs to be done?

Related

pgbouncer throws Pooler Error: Auth Failed when using datagrip but NOT when using pgadmin

I have a postgres database (version 9.2) running on Centos 6.9.
I am running pgbouncer version 1.6.1
When I try connect to postgres using datagrip from my Mac, I get:
08P01: Error: Auth Failed
And I get on the server:
/var/log/pgbouncer.log
2021-05-21 18:29:02.644 7489 WARNING C-0x15cf078: postgres/jode#127.0.0.1:56254 Pooler Error: Auth failed
When I login to postgres using Pgadmin 4 from the same Mac and same settings, I get right in and there are no errors or warnings in pgbouncer.
What could the problem?
PgAdmin is not working via JDBC. So you need to configure pgBouncer to accept TCP/IP connections (see similar dba exchange question)

azure + postgresql: How to fix error: Unable to connect to server: server closed the connection unexpectedly

i use postgresql server in azure. Until few hours ago I was able to access the server from pgAdmin 4 but now I get the following error:
' Unable to connect to server:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request. '
Same for using psql.
From my node js backend app I can access the database to get and edit the db.
How can I fix the access for the db server from pgAdmin 4 and psql?
EDIT:
I managed to connect from psql but still not from pgAdmin 4, and after enabling disconnection logs in azure I get this log:
' An existing connection was forcibly closed by the remote host '.
https://stackoverflow.com/a/59640480/798053 fixed it for me:
$ brew services stop postgresql
$ brew install postgresql#10
$ brew services start postgresql#10
$ brew link --overwrite --force postgresql#10ode here
You need to add your IP address or VNet in Connection Security. By default it is blocked.
In my case, I had chosen to create an Azure SQL Database rather than an Azure Database for PostgreSQL. I doubt many others have made this mistake, but if you have, it will cause this error!

How to solve psql error: could not connect to server?

I'm trying to install GeoDjango for my website. To do that, I first need to create a PostgreSQL database. Following this tutorial, I'm trying to connect to PostgreSQL by using sudo su - postgres and then psql. The problem is that I get this error : psql: error: could not connect to server: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I made some researchs and found this post explaining how to solve the problem. However, when I run sudo service postgresql start I have to type the password for postgres but I don't know what it is, I never created a password for postgres. I've made researchs about that and I can't find a solution because all solutions need to first connect to psql in order to alter the existing user. But I need first to find the password in order to solve the problem of connection to psql.
What am I supposed to do ?
Thanks in advance !
PS : I'm using windows 10 with the Ubuntu terminal.
PS2 : I've found some topics saying it's easier to install PostgreSQL and PostGIS using Docker. However, there are lots of compatibility problems with Docker due to the fact I'm using windows 10. Do you think I should use Docker ?
I've found the solution !
So for those interested, I had to change the password in order to get log in and that solve the psql error: could not connect to server. To change the password, simply type sudo passwd postgres and set up a new password. I hope this will help other people !

Postgresql installation

I'm going crazy with postgresql (9.1) installation on my server (debian) i have rent on gandi.net !
I did the aptitude get-install postgresql postgresql-client command.
I'm having this error when trying to execute psql command.
psql: could not connect to server: No such file or directory
Is the server running locally and accepting
connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?
I've been searching on the web. And maybe the servers are not running. I don't know how to check and how to launch them.
My postgres command doesn't work either (command not found).
Any idea?
The database engine is not running.
service postgresql start
or
/etc/init.d/postgresql start
to start the engine. I don't remember though if debian initializes the data dir automatically.

Heroku iOS Tutorial using Postgres

I am following the tutorial on Heroku on how to use heroku on iOS. The example uses a postgres database to store images and geolocation. I downloaded the postgres app on my Lion OSX and it says the postgres server running correctly. Now I am stuck on this step:
Update the config/database.yml file to reference the correct database user and password for >the development and test environments. Then create the local development database and run the >migrations.
$ bundle exec rake db:create db:migrate
== CreatePhotos: migrating ===========
-- create_table(:photos)
...
But I receive the following error:
could not connect to server: Permission denied
Is the server running locally and accepting
connections on Unix domain socket "/var/pgsql_socket/.s.PGSQL.5432"?
....
What did I do wrong? I tried to manually create the postgres database using the createdb command but I go the same connectivity error.
This error occurs when PostgreSQL is not listening on the socket specified. Causes can include (in order to check)
PostgreSQL not properly installed
PostgreSQL stopped or not running.
PostgreSQL listening on a different socket or in a different directory. This information is specified in the postgresql.conf.