我想使用 FileConfigProvider 将数据库密码存储在单独的文件中。有趣的是文件中没有提供最后一个属性。我有连接器配置:
{
"name": "test-conn",
"config": {
"name": "test-conn",
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"connection.url": "${file:/opt/secret/connect-secrets.properties:kafka_connect-url}",
"connection.user": "${file:/opt/secret/connect-secrets.properties:kafka_connect-username}",
"connection.password": "${file:/opt/secret/connect-secrets.properties:kafka_connect-password}",
"table.types": "TABLE,VIEW",
...
}
}
连接器已创建,但是由于与密码验证失败(错误密码)相关的异常,状态为 FAILED。有趣的是 REST 调用的响应:
{
"name": "test-conn",
"config": {
"name": "test-conn",
"connector.class": "io.confluent.connect.jdbc.JdbcSourceConnector",
"connection.url": "${file:/opt/secret/connect-secrets.properties:kafka_connect-url}",
"connection.user": "${file:/opt/secret/connect-secrets.properties:kafka_connect-username}",
"connection.password": "file:/opt/secret/connect-secrets.properties:kafka_connect-password",
"table.types": "TABLE,VIEW",
...
}
"tasks": []
...
}
请注意 JSON 响应的 connection.password 属性。 如果我添加新的配置属性,例如:
"foo": "${}"
,成功提供密码,响应包括:
"foo": "${}"
我面临一些错误吗?我从 confluent-community-2.13 Ubuntu 包安装了 Apache Kafka 7.3.2。
谢谢。