寻找任何nodejs Postgres JS驱动程序或逻辑来处理多主机数据库支持。
下面尝试使用pg库和连接字符串作为DB URL的解析,但是在JS驱动程序方面失败。
const conn = new ConnectionString('postgres://server1.site1.company.com:1512,server2.site2.company.com:1512/dbname?target_session_attrs=read-write');
conn.setDefaults({user:'user',password:'password'});
但是失败,如下所示
(node:13772) UnhandledPromiseRejectionWarning: error: database ":1512,server2.site2.company.com/dbname" does not exist
at Connection.parseE (node_modules\pg\lib\connection.js:604:13)
at Connection.parseMessage (node_modules\pg\lib\connection.js:403:19)