[英]Using CitusDB with SQL-alchemy
I am using caravel with CitusDB and I am running into problems connecting to the database node. 我将caravel与CitusDB一起使用,并且在连接数据库节点时遇到问题。 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. 我可以使用
/opt/citusdb/4.0/bin
的psql
脚本登录到运行中的主/opt/citusdb/4.0/bin
但无法从应用程序连接到该主服务器。 Flask-SQLAlchemy supports the postgresql dialect and driver and the server running seems to be on the 5432 port. Flask-SQLAlchemy支持postgresql方言和驱动程序,并且服务器运行似乎在5432端口上。 I am trying it with
psycopg2
. 我正在尝试与
psycopg2
。
I have turned off the postgresql
service because that was interfering with the master node start-up. 我已经关闭了
postgresql
服务,因为它干扰了主节点的启动。
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"?
First of all, I strongly suggest using Citus 5.0. 首先,我强烈建议使用Citus 5.0。 The document you have followed is about CitusDB 4.0 version, which was a fork of PostgreSQL.
您遵循的文档是有关CitusDB 4.0版本的,该版本是PostgreSQL的分支。 Currently, Citus can be installed as an extension to PostgreSQL 9.5 and has lots of new features and bugfixes.
目前,Citus可以作为PostgreSQL 9.5的扩展安装,并具有许多新功能和错误修正。 You can take a look at Citus installation instructions for 5.0.
您可以查看5.0的Citus安装说明 。
If it is not possible to switch to Citus 5.0, then the problem may be related to socket file paths. 如果无法切换到Citus 5.0,则问题可能与套接字文件路径有关。 Could you try issuing the command in this answer ?
您可以尝试在此答案中发出命令吗?
Thanks to @Ahmet Eren Başak
I was able to look at problem from a new angle. 感谢
@Ahmet Eren Başak
我得以从一个新的角度看问题。
The key to this problem was the pid file of the running server. 解决此问题的关键是正在运行的服务器的pid文件。
psycopg2
and postgresql
in general refer to the /var/run/postgresql/
directory to see if the server is running. 通常,
psycopg2
和postgresql
参考/var/run/postgresql/
目录,以查看服务器是否正在运行。 CitusDB apparently does not have permission to edit/create files in this directory. CitusDB显然无权编辑/创建此目录中的文件。 Hence, the pid file is created in
/tmp/
. 因此,在
/tmp/
创建了pid文件。
The solution was to link this file to /var/run/postgresql/
and that solved it 解决方案是将该文件链接到
/var/run/postgresql/
,从而解决了该问题
ln -s /tmp/.s.PGSQL.5432 /var/run/postgresql/.s.PGSQL.5432
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.