首页 > 解决方案 > NiFi从覆盖nifi.properties中的值

问题描述

我在 docker 中运行 NiFi,所有相关目录都安装为卷。我正在尝试修改 nifi.properties 文件中的一些设置,特别是添加自定义属性文件。但是,当我重新启动 NiFi 时,某些属性会恢复为原始值。

这是我当前的 nifi.properties 文件的示例:

nifi.ui.autorefresh.interval=5 sec
...
nifi.variable.registry.properties=

如果我然后将文件更改为以下内容:

nifi.ui.autorefresh.interval=3 sec
...
nifi.variable.registry.properties=./conf/custom.properties

然后重新启动 NiFi,它会打印几行replacing target file /opt/nifi/nifi-current/conf/nifi.properties,然后启动 UI。当我再次检查 nifi.properties 文件时,它看起来像:

nifi.ui.autorefresh.interval=3 sec
...
nifi.variable.registry.properties=

出于某种原因, nifi.ui.autorefresh.interval 属性将成功更新,但 nifi.variable.registry.properties 属性不会。

为什么有些价值观拒绝接受,我怎样才能让它们在启动过程中存活下来?

标签: apache-nifi

解决方案


有些道具只能用 ENV vars 设置(除了黑客)。如果您查看下面的命令,您可以弄清楚。如您所见,nifi.variable.registry.properties就是其中之一。

cat /opt/nifi/scripts/start.sh | grep prop_replace
prop_replace 'nifi.web.http.port'               "${NIFI_WEB_HTTP_PORT:-8080}"
prop_replace 'nifi.web.http.host'               "${NIFI_WEB_HTTP_HOST:-$HOSTNAME}"
prop_replace 'nifi.remote.input.host'           "${NIFI_REMOTE_INPUT_HOST:-$HOSTNAME}"
prop_replace 'nifi.remote.input.socket.port'    "${NIFI_REMOTE_INPUT_SOCKET_PORT:-10000}"
prop_replace 'nifi.remote.input.secure'         'false'
prop_replace 'baseUrl' "http://${NIFI_WEB_HTTP_HOST:-$HOSTNAME}:${NIFI_WEB_HTTP_PORT:-8080}" ${nifi_toolkit_props_file}
prop_replace 'nifi.variable.registry.properties'    "${NIFI_VARIABLE_REGISTRY_PROPERTIES:-}"
prop_replace 'nifi.cluster.is.node'                         "${NIFI_CLUSTER_IS_NODE:-false}"
prop_replace 'nifi.cluster.node.address'                    "${NIFI_CLUSTER_ADDRESS:-$HOSTNAME}"
prop_replace 'nifi.cluster.node.protocol.port'              "${NIFI_CLUSTER_NODE_PROTOCOL_PORT:-}"
prop_replace 'nifi.cluster.node.protocol.threads'           "${NIFI_CLUSTER_NODE_PROTOCOL_THREADS:-10}"
prop_replace 'nifi.cluster.node.protocol.max.threads'       "${NIFI_CLUSTER_NODE_PROTOCOL_MAX_THREADS:-50}"
prop_replace 'nifi.zookeeper.connect.string'                "${NIFI_ZK_CONNECT_STRING:-}"
prop_replace 'nifi.zookeeper.root.node'                     "${NIFI_ZK_ROOT_NODE:-/nifi}"
prop_replace 'nifi.cluster.flow.election.max.wait.time'     "${NIFI_ELECTION_MAX_WAIT:-5 mins}"
prop_replace 'nifi.cluster.flow.election.max.candidates'    "${NIFI_ELECTION_MAX_CANDIDATES:-}"
prop_replace 'nifi.web.proxy.context.path'                  "${NIFI_WEB_PROXY_CONTEXT_PATH:-}"
prop_replace 'nifi.security.user.login.identity.provider' 'ldap-provider'

推荐阅读