Докер — Nifi : 1.14.0 — Сбой при запуске — Вызван: org.apache.nifi.свойства.Исключение защиты от несанкционированного доступа

#docker #docker-compose #apache-nifi

Вопрос:

Привет, я совершенно новичок в docker и nifi, и мне нужно настроить nifi в docker, но я получаю следующую ошибку.

Текст ошибки ниже или (скриншот терминала с ошибкой)

 nifi01_1   | 2021-09-17 02:12:30,707 INFO [main] o.a.nifi.properties.NiFiPropertiesLoader Loaded 202 properties from /opt/nifi/nifi-current/./conf/nifi.properties
nifi01_1   | 2021-09-17 02:12:30,719 ERROR [main] o.a.nifi.properties.NiFiPropertiesLoader Clustered Configuration Found: Shared Sensitive Properties Key [nifi.sensitive.props.key] required for cluster nodes
nifi01_1   | 2021-09-17 02:12:30,723 ERROR [main] org.apache.nifi.NiFi Failure to launch NiFi due to java.lang.IllegalArgumentException: There was an issue decrypting protected properties
nifi01_1   | java.lang.IllegalArgumentException: There was an issue decrypting protected properties
nifi01_1   |    at org.apache.nifi.NiFi.initializeProperties(NiFi.java:346)
nifi01_1   |    at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:314)
nifi01_1   |    at org.apache.nifi.NiFi.convertArgumentsToValidatedNiFiProperties(NiFi.java:310)
nifi01_1   |    at org.apache.nifi.NiFi.main(NiFi.java:302)
nifi01_1   | 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]
nifi01_1   |    at org.apache.nifi.properties.NiFiPropertiesLoader.getDefaultProperties(NiFiPropertiesLoader.java:220)
nifi01_1   |    at org.apache.nifi.properties.NiFiPropertiesLoader.get(NiFiPropertiesLoader.java:209)
nifi01_1   |    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
nifi01_1   |    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
nifi01_1   |    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
nifi01_1   |    at java.lang.reflect.Method.invoke(Method.java:498)
nifi01_1   |    at org.apache.nifi.NiFi.initializeProperties(NiFi.java:341)
nifi01_1   |    ... 3 common frames omitted
nifi01_1 exited with code 0
 

докер-compose.yml:

 #    Licensed to the Apache Software Foundation (ASF) under one or more
#    contributor license agreements.  See the NOTICE file distributed with
#    this work for additional information regarding copyright ownership.
#    The ASF licenses this file to You under the Apache License, Version 2.0
#    (the "License"); you may not use this file except in compliance with
#    the License.  You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.

version: "3"
services:
  zookeeper:
    hostname: zookeeper
    container_name: zookeeper
    image: 'bitnami/zookeeper:latest'
    environment:
      - ALLOW_ANONYMOUS_LOGIN=yes
    networks:
      - nifinet
  nifi01:
    image: apache/nifi:1.14.0
    ports:
      - 6980:8080 # Unsecured HTTP Web Port
    networks:
      - nifinet
    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
  nifi02:
    image: apache/nifi:1.14.0
    ports:
      - 6979:8080 # Unsecured HTTP Web Port
    networks:
      - nifinet
    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
  nifi03:
    image: apache/nifi:1.14.0
    ports:
      - 6978:8080 # Unsecured HTTP Web Port
    networks:
      - nifinet
    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
networks:
  nifinet:
    driver: bridge
 

Основываясь на моих исследованиях, упоминается, что мне нужно обновить несколько свойств в файле nifi.properties, но я не уверен, как я могу установить их в образе докера. Пожалуйста, помогите.

Ответ №1:

Просто добавьте NIFI_SENSITIVE_PROPS_KEY переменную среды как переменную среды в файл nifis docker-copmose. Это может быть случайная строка, но убедитесь, что она содержит не менее 12 символов (в противном случае NiFi не сможет ее обработать).