我无法使用docker部署NiFi集群(docker退出,代码为0)



我想使用docker compose部署一个NiFi集群,使用以下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来部署它,组成如下:

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中,因此当缩放该实例时,Zookeepper会混淆哪个实例是哪个实例,当NiFi节点试图形成集群时,它们会共享不正确的数据。

我建议使用minikube和Nifi运算符来动态设置这些变量并缩放复制集。

最新更新