我无法使用 docker 部署 NiFi 集群(docker 以代码 0 退出)
I cannot deploy a NiFi cluster using docker (docker exits with code 0)
我想部署一个 NiFi 集群 docker compose 使用以下 yaml 文件:
version: "3"
services:
zookeeper:
hostname: zookeeper
container_name: zookeeper
image: 'bitnami/zookeeper:latest'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
nifi:
image: apache/nifi:1.12.0-SNAPSHOT-dockermaven
ports:
- 8080 # Unsecured HTTP Web Port
environment:
- NIFI_WEB_HTTP_PORT=8080
- NIFI_CLUSTER_IS_NODE=true
- NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
- NIFI_ZK_CONNECT_STRING=zookeeper:2181
- NIFI_ELECTION_MAX_WAIT=1 min
然后我使用 docker-compose 像这样部署它:
docker-compose up --scale nifi=3
它成功部署了 zookeeper 但三个 NiFi 节点 docker 容器停止并且 docker 抛出以下信息:
nifi_cluster_2-nifi-2 | 2022-03-04 11:26:16,755 INFO [main] o.a.nifi.properties.NiFiPropertiesLoader Loaded 198 properties from /opt/nifi/nifi-current/./conf/nifi.properties
nifi_cluster_2-nifi-2 | 2022-03-04 11:26:16,801 ERROR [main] o.a.nifi.properties.NiFiPropertiesLoader Clustered Configuration Found: Shared Sensitive Properties Key [nifi.sensitive.props.key] required for cluster nodes
nifi_cluster_2-nifi-2 | 2022-03-04 11:26:16,808 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi
nifi_cluster_2-nifi-2 | java.lang.IllegalArgumentException: There was an issue decrypting protected properties
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.initializeProperties(NiFi.java:373)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:341)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:337)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.main(NiFi.java:329)
nifi_cluster_2-nifi-2 | Caused by: org.apache.nifi.properties.SensitivePropertyProtectionException: Sensitive Properties Key [nifi.sensitive.props.key] not found: See Admin Guide section [Updating the Sensitive Properties Key]
nifi_cluster_2-nifi-2 | at org.apache.nifi.properties.NiFiPropertiesLoader.getDefaultProperties(NiFiPropertiesLoader.java:225)
nifi_cluster_2-nifi-2 | at org.apache.nifi.properties.NiFiPropertiesLoader.get(NiFiPropertiesLoader.java:214)
nifi_cluster_2-nifi-2 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
nifi_cluster_2-nifi-2 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
nifi_cluster_2-nifi-2 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
nifi_cluster_2-nifi-2 | at java.lang.reflect.Method.invoke(Method.java:498)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.initializeProperties(NiFi.java:368)
nifi_cluster_2-nifi-2 | ... 3 common frames omitted
nifi_cluster_2-nifi-1 exited with code 0
nifi_cluster_2-nifi-2 exited with code 0
nifi_cluster_2-nifi-3 exited with code 0
我也尝试使用其他 yaml 文件为 NiFi 集群部署 docker-compose 但我一直遇到相同的“退出代码 0”问题。
我该如何解决这个问题?
使用这些环境变量,您将只能 运行 一个 NiFi 实例。例如,NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
会为每个实例存储在 Zookeeper 中,因此当扩展该实例时,Zookeeper 会混淆哪个实例是哪个,并且当 NiFi 节点尝试形成集群时,它们会共享不正确的数据.
我建议使用 minikube 和 Nifi Operator 来动态设置此类变量并扩展副本集。
我想部署一个 NiFi 集群 docker compose 使用以下 yaml 文件:
version: "3"
services:
zookeeper:
hostname: zookeeper
container_name: zookeeper
image: 'bitnami/zookeeper:latest'
environment:
- ALLOW_ANONYMOUS_LOGIN=yes
nifi:
image: apache/nifi:1.12.0-SNAPSHOT-dockermaven
ports:
- 8080 # Unsecured HTTP Web Port
environment:
- NIFI_WEB_HTTP_PORT=8080
- NIFI_CLUSTER_IS_NODE=true
- NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
- NIFI_ZK_CONNECT_STRING=zookeeper:2181
- NIFI_ELECTION_MAX_WAIT=1 min
然后我使用 docker-compose 像这样部署它:
docker-compose up --scale nifi=3
它成功部署了 zookeeper 但三个 NiFi 节点 docker 容器停止并且 docker 抛出以下信息:
nifi_cluster_2-nifi-2 | 2022-03-04 11:26:16,755 INFO [main] o.a.nifi.properties.NiFiPropertiesLoader Loaded 198 properties from /opt/nifi/nifi-current/./conf/nifi.properties
nifi_cluster_2-nifi-2 | 2022-03-04 11:26:16,801 ERROR [main] o.a.nifi.properties.NiFiPropertiesLoader Clustered Configuration Found: Shared Sensitive Properties Key [nifi.sensitive.props.key] required for cluster nodes
nifi_cluster_2-nifi-2 | 2022-03-04 11:26:16,808 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi
nifi_cluster_2-nifi-2 | java.lang.IllegalArgumentException: There was an issue decrypting protected properties
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.initializeProperties(NiFi.java:373)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:341)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:337)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.main(NiFi.java:329)
nifi_cluster_2-nifi-2 | Caused by: org.apache.nifi.properties.SensitivePropertyProtectionException: Sensitive Properties Key [nifi.sensitive.props.key] not found: See Admin Guide section [Updating the Sensitive Properties Key]
nifi_cluster_2-nifi-2 | at org.apache.nifi.properties.NiFiPropertiesLoader.getDefaultProperties(NiFiPropertiesLoader.java:225)
nifi_cluster_2-nifi-2 | at org.apache.nifi.properties.NiFiPropertiesLoader.get(NiFiPropertiesLoader.java:214)
nifi_cluster_2-nifi-2 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
nifi_cluster_2-nifi-2 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
nifi_cluster_2-nifi-2 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
nifi_cluster_2-nifi-2 | at java.lang.reflect.Method.invoke(Method.java:498)
nifi_cluster_2-nifi-2 | at org.apache.nifi.NiFi.initializeProperties(NiFi.java:368)
nifi_cluster_2-nifi-2 | ... 3 common frames omitted
nifi_cluster_2-nifi-1 exited with code 0
nifi_cluster_2-nifi-2 exited with code 0
nifi_cluster_2-nifi-3 exited with code 0
我也尝试使用其他 yaml 文件为 NiFi 集群部署 docker-compose 但我一直遇到相同的“退出代码 0”问题。
我该如何解决这个问题?
使用这些环境变量,您将只能 运行 一个 NiFi 实例。例如,NIFI_CLUSTER_NODE_PROTOCOL_PORT=8082
会为每个实例存储在 Zookeeper 中,因此当扩展该实例时,Zookeeper 会混淆哪个实例是哪个,并且当 NiFi 节点尝试形成集群时,它们会共享不正确的数据.
我建议使用 minikube 和 Nifi Operator 来动态设置此类变量并扩展副本集。