2

I am using caravel with CitusDB and I am running into problems connecting to the database node. To be frank, I have no clue what to do.

I followed the official installation instructions to install and run.

I can log into the running master using the psql script in /opt/citusdb/4.0/bin but I can't connect to it from the application. Flask-SQLAlchemy supports the postgresql dialect and driver and the server running seems to be on the 5432 port. I am trying it with psycopg2.

I have turned off the postgresql service because that was interfering with the master node start-up.

This is the error:

2016-04-28 10:10:53,487:ERROR:flask_appbuilder.security.sqla.manager:DB Creation and initialization failed: (psycopg2.OperationalError) 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"?
metdos
  • 13,411
  • 17
  • 77
  • 120
manu29.d
  • 1,538
  • 1
  • 11
  • 15

2 Answers2

2

First of all, I strongly suggest using Citus 5.0. The document you have followed is about CitusDB 4.0 version, which was a fork of PostgreSQL. Currently, Citus can be installed as an extension to PostgreSQL 9.5 and has lots of new features and bugfixes. You can take a look at Citus installation instructions for 5.0.

If it is not possible to switch to Citus 5.0, then the problem may be related to socket file paths. Could you try issuing the command in this answer?

Community
  • 1
  • 1
Ahmet Eren Başak
  • 493
  • 1
  • 4
  • 14
2

Thanks to @Ahmet Eren Başak I was able to look at problem from a new angle.

The key to this problem was the pid file of the running server. psycopg2 and postgresql in general refer to the /var/run/postgresql/ directory to see if the server is running. CitusDB apparently does not have permission to edit/create files in this directory. Hence, the pid file is created in /tmp/.

The solution was to link this file to /var/run/postgresql/ and that solved it

ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
manu29.d
  • 1,538
  • 1
  • 11
  • 15
  • 2
    I'm not sure this is actually a permissions problem so much as a problem with the Citus 4.0 build. It may use `/tmp` on all platforms, whereas a "regular" PostgreSQL install uses `/var/run/postgresql` on certain platforms. It's likely Citus 5.0 and higher no longer have this problem at all, but good job finding the workaround! – jasonmp85 May 25 '16 at 21:48