欢迎投稿

今日深度:

postgresql on centos (sequelize+pg+nodejs):Failed to find Po

postgresql on centos (sequelize+pg+nodejs):Failed to find PostgresSQL server.Pleast double check your settings,


  公司的一个项目,使用的nodejs做服务端,数据库是postgresql,在本地时一切ok,放在centos时,postgresql配置ok,可以远程访问,但是nodejs在centos启动时,就会报错,找不到postgresql服务,Error Msg如下:

09/14 10:00:27 - info: Error: Failed to find PostgresSQL server. Please double check your settings.
at connectCallback (/home/sm_dir/CenterAPI/node_modules/sequelize/lib/dialects/postgres/connector-manager.js:112:35)
at /home/sm_dir/CenterAPI/node_modules/pg/lib/pool.js:54:25
at /home/sm_dir/CenterAPI/node_modules/pg/node_modules/generic-pool/lib/generic-pool.js:271:11
at /home/sm_dir/CenterAPI/node_modules/pg/lib/pool.js:27:26
at null.<anonymous> (/home/sm_dir/CenterAPI/node_modules/pg/lib/client.js:172:5)
at emit (events.js:95:17)
at Socket.<anonymous> (/home/sm_dir/CenterAPI/node_modules/pg/lib/connection.js:56:10)
at Socket.emit (events.js:95:17)
at net.js:834:16
at process._tickDomainCallback (node.js:502:13)

  远程访问都可以,结果本地却不行,一直没有头绪。几经周折,在一个stack overflow的帖子中找到了灵感,帖子的链接如下:http://stackoverflow.com/questions/21740560/node-server-cant-connect-to-postgres-db

node-modules=>pg对password,不支持一些特殊字符,其中就有#,而我的数据库密码是:local#123. 于是,移除#,改为local123,之后=》“Init => db success...”,终于成功连接上了。

 

总结:事后分析,远程连接ok,是postgresql配置的问题,远程和本地连接走的验证方式不一样.

www.htsjk.Com true http://www.htsjk.com/postgresSQL/10400.html NewsArticle postgresql on centos (sequelize+pg+nodejs):Failed to find PostgresSQL server.Pleast double check your settings, 公司的一个项目,使用的nodejs做服务端,数据库是postgresql,在本地时一切ok,放在centos时,postgresql配置...
相关文章
    暂无相关文章
评论暂时关闭