在Azure中使用managed Postgres database时,Corda节点无法在启动时连接到数据库。
[ERROR] 2019-01-23T11:28:50,937Z [main] internal.Node.run - Exception during node startup {}
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: FATAL: SSL connection is required. Please specify SSL options and retry.
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:512) ~[HikariCP-2.5.1.jar:?]
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:105) ~[HikariCP-2.5.1.jar:?]
at com.zaxxer.hikari.HikariDataSource.<init>(HikariDataSource.java:71) ~[HikariCP-2.5.1.jar:?]
at net.corda.node.internal.DataSourceFactory.createDataSource(DataSourceFactory.kt:38) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.DataSourceFactory.createDataSource$default(DataSourceFactory.kt:35) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.AbstractNodeKt.configureDatabase(AbstractNode.kt:927) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.AbstractNode.initialiseDatabasePersistence(AbstractNode.kt:695) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.Node.initialiseDatabasePersistence(Node.kt:347) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.AbstractNode.start(AbstractNode.kt:207) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.Node.start(Node.kt:361) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.NodeStartup.startNode(NodeStartup.kt:203) ~[corda-node-3.3-corda.jar:?]
at net.corda.node.internal.NodeStartup.run(NodeStartup.kt:126) [corda-node-3.3-corda.jar:?]
at net.corda.node.Corda.main(Corda.kt:13) [corda-node-3.3-corda.jar:?]
我的node.conf包含this answer中推荐的标准Postgres配置。
dataSourceProperties = {
dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
dataSource.url = "jdbc:postgresql://[HOST]:[PORT/[DATABASE]"
dataSource.user = [USERNAME]
dataSource.password = [PASSWORD]
}
database {
schema = "corda"
transactionIsolationLevel = "READ_COMMITTED"
}
如何确保Postgres通过SSL连接?
答案 0 :(得分:0)
Postgres允许直接在jdbc字符串中设置ssl模式。请参见下面的更新配置,其中包括“?ssl = true”。
dataSourceProperties = {
dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
dataSource.url = "jdbc:postgresql://[HOST]:[PORT/[DATABASE]?ssl=true"
dataSource.user = [USERNAME]
dataSource.password = [PASSWORD]
}
database {
schema = "corda"
transactionIsolationLevel = "READ_COMMITTED"
}