database - 如何在 Corda 社区版中使用数据源类型 DB 建立 rpc 属性?
问题描述
要在社区版中建立 RPC 连接,我们需要指定 rpc 用户名、密码和权限,但是当我们集成外部数据库(如 MySQL)并将数据源类型从 INMEMORY 更改为“DB”时,它不允许提供用户属性。
这些是我在 node.conf 中使用的设置
security = {
authService = {
dataSource = {
type = "DB"
passwordEncryption = "SHIRO_1_CRYPT"
connection = {
jdbcUrl = "jdbc:mysql://localhost:3306"
username = "root"
password = "password"
driverClassName = "com.mysql.jdbc.Driver"
}
}
options = {
cache = {
expireAfterSecs = 120
maxEntries = 10000
}
}
}
解决方案
也许我不明白你的问题,但是数据库设置node.conf
与 RPC 用户设置是分开的node.conf
:
数据库(在我的例子中是 PostGres)
extraConfig = [
'dataSourceProperties.dataSourceClassName' : 'org.postgresql.ds.PGSimpleDataSource',
'dataSourceProperties.dataSource.url' : 'jdbc:postgresql://localhost:5432/postgres',
'dataSourceProperties.dataSource.user' : 'db_user',
'dataSourceProperties.dataSource.password' : 'db_user_password',
'database.transactionIsolationLevel' : 'READ_COMMITTED',
'database.initialiseSchema' : 'true'
]
RPC 用户
rpcUsers = [[ user: "rpc_user", "password": "rpc_user_password", "permissions": ["ALL"]]]
好的,我正在添加我的节点node.config
(它是 Corda TestNet 的一部分,并且部署在 Google Cloud 上):
baseDirectory = "."
compatibilityZoneURL = "https://netmap.testnet.r3.com"
emailAddress = "xxx"
jarDirs = [ "plugins", "cordapps" ]
sshd { port = 2222 }
myLegalName = "OU=xxx, O=TESTNET_xxx, L=London, C=GB"
keyStorePassword = "xxx"
trustStorePassword = "xxx"
crlCheckSoftFail = true
database = {
transactionIsolationLevel = "READ_COMMITTED"
initialiseSchema = "true"
}
dataSourceProperties {
dataSourceClassName = "org.postgresql.ds.PGSimpleDataSource"
dataSource.url = "jdbc:postgresql://xxx:xxx/postgres"
dataSource.user = xxx
dataSource.password = xxx
}
p2pAddress = "xxx:xxx"
rpcSettings {
useSsl = false
standAloneBroker = false
address = "0.0.0.0:xxx"
adminAddress = "0.0.0.0:xxx"
}
rpcUsers = [
{ username=cordazoneservice, password=xxx, permissions=[ ALL ] }
]
devMode = false
cordappSignerKeyFingerprintBlacklist = []
useTestClock = false
推荐阅读
- c# - 应用程序配置文件未保存
- java - java中是否有任何方法可以检查字符串是否为数字?
- python - python3.7 使用 asyncio 和 aiohttp 从 URL 中提取批量标题
- gnuplot - 使用 gnuplot 重新采样数据
- python - 如何正确使用 gensim 的 deaccent 方法?
- laravel - 如何在 Laravel 5.7 中使用现有数据库
- firebase - 错误:AngularFireDatabase,@angular/fire/database-deprecated 问题
- jax-rs - 发送 JAX-RS JsonArray 响应自定义 http 标头
- java - 通过recyclerview适配器获取接口实现回调的引用到fragment
- r - 比较基因组的双重组合百分比与参考基因组的百分比