首页 > 解决方案 > MiNiFi 在使用命令和控制 (C2) 服务器更新 config.yml 文件时因 bootstrap.conf 文件而关闭

问题描述

我正在使用命令和控制 (C2) 服务器自动更新 minifi 中的 config.yml 文件。C2 从当前运行的 NiFi 实例中的模板中获取此文件。它每隔 1 分钟只更新一次 config.yml,在第二次尝试后它说:

错误 [pool-2-thread-2] org.apache.nifi.BootstrapListener 无法与 Bootstrap 通信。Bootstrap 可能无法发出或接收来自 MiNiFi 的命令。

然后它关闭了 minifi 并且它不会重新启动。

请注意,我仍然没有更新 NiFi 中的模板,因此它将要求与以前相同的 config.yml 文件。

minifi-c2-context.xml

<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ 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.
  -->
<beans default-lazy-init="true" xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans 
   http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

<bean id="configService" class="org.apache.nifi.minifi.c2.service.ConfigService" scope="singleton">
    <constructor-arg>
        <list>
            <!--<bean class="org.apache.nifi.minifi.c2.provider.cache.CacheConfigurationProvider">
                <constructor-arg>
                    <list>
                        <value>text/yml</value>
                    </list>
                </constructor-arg>
                <constructor-arg>
                    <bean class="org.apache.nifi.minifi.c2.cache.filesystem.FileSystemConfigurationCache">
                        <constructor-arg>
                            <value>./files</value>
                        </constructor-arg>
                        <constructor-arg>
                            <value>${class}/config</value>
                        </constructor-arg>
                    </bean>
                </constructor-arg>
                <constructor-arg>
                    <bean class="org.apache.nifi.minifi.c2.cache.s3.S3ConfigurationCache">
                        <constructor-arg>
                            <value>bucket</value>
                        </constructor-arg>
                        <constructor-arg>
                            <value>prefix/</value>
                        </constructor-arg>
                        <constructor-arg>
                        <value>${class}</value>
                    </constructor-arg>
                    <constructor-arg>
                        <value>access-key</value>
                    </constructor-arg>
                    <constructor-arg>
                        <value>secret-key</value>
                    </constructor-arg>
                    <constructor-arg>
                        <value>us-east-1</value>
                    </constructor-arg>
                    </bean>
                </constructor-arg>
            </bean>-->
           <bean class="org.apache.nifi.minifi.c2.provider.nifi.rest.NiFiRestConfigurationProvider">
                <constructor-arg>
                    <bean class="org.apache.nifi.minifi.c2.cache.filesystem.FileSystemConfigurationCache">
                        <constructor-arg>
                            <value>./cache</value>
                        </constructor-arg>
                        <constructor-arg>
                            <value>${class}/${class}</value>
                        </constructor-arg>
                    </bean>
                </constructor-arg>
                <constructor-arg>
                    <value>http://localhost:8080/nifi-api</value>
                </constructor-arg>
                <constructor-arg>
                    <value>${class}.v${version}</value>
                </constructor-arg>
            </bean>
        </list>
    </constructor-arg>
    <constructor-arg>
        <bean class="org.apache.nifi.minifi.c2.security.authorization.GrantedAuthorityAuthorizer">
            <constructor-arg value="classpath:authorizations.yaml"/>
        </bean>
    </constructor-arg>
</bean>

MiNiFi 中的 bootstrap.conf

#
# 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.
#

# Java command to use when running MiNiFi
java=java

# Username to use when running MiNiFi. This value will be ignored on     Windows.
run.as=

# Configure where MiNiFi's lib and conf directories live
# When running as a Windows service set full paths instead of relative paths
lib.dir=./lib
conf.dir=./conf

# How long to wait after telling MiNiFi to shutdown before explicitly     killing the Process
graceful.shutdown.seconds=20

# The location for the configuration file
# When running as a Windows service use the full path to the file
nifi.minifi.config=./conf/config.yml

# Notifiers to use for the associated agent, comma separated list of     class names
#nifi.minifi.notifier.ingestors=org.apache.nifi.minifi.bootstrap.configuration.ingestors.FileChangeIngestor
#nifi.minifi.notifier.ingestors=org.apache.nifi.minifi.bootstrap.configuration.ingestors.RestChangeIngestor
nifi.minifi.notifier.ingestors=org.apache.nifi.minifi.bootstrap.configuration.ingestors.PullHttpChangeIngestor

# File change notifier configuration

# Path of the file to monitor for changes.  When these occur, the     FileChangeNotifier, if configured, will begin the configuration reloading process
#nifi.minifi.notifier.ingestors.file.config.path=
# How frequently the file specified by 'nifi.minifi.notifier.file.config.path' should be evaluated for changes.
#nifi.minifi.notifier.ingestors.file.polling.period.seconds=5

# Rest change notifier configuration

# Port on which the Jetty server will bind to, keep commented for a random open port
#nifi.minifi.notifier.ingestors.receive.http.port=8338

#Pull HTTP change notifier configuration

# Hostname on which to pull configurations from
nifi.minifi.notifier.ingestors.pull.http.hostname=localhost
# Port on which to pull configurations from
nifi.minifi.notifier.ingestors.pull.http.port=10080
# Path to pull configurations from
nifi.minifi.notifier.ingestors.pull.http.path=/c2/config
# Query string to pull configurations with
nifi.minifi.notifier.ingestors.pull.http.query=class=minifidemo
# Period on which to pull configurations from, defaults to 5 minutes if     commented out
nifi.minifi.notifier.ingestors.pull.http.period.ms=60000

# Periodic Status Reporters to use for the associated agent, comma separated list of class names
    #nifi.minifi.status.reporter.components=org.apache.nifi.minifi.bootstrap.status.reporters.StatusLogger

# Periodic Status Logger configuration

# The FlowStatus query to submit to the MiNiFi instance
#nifi.minifi.status.reporter.log.query=instance:health,bulletins
# The log level at which the status will be logged
#nifi.minifi.status.reporter.log.level=INFO
# The period (in milliseconds) at which to log the status
#nifi.minifi.status.reporter.log.period=60000

# Disable JSR 199 so that we can use JSP's without running a JDK
java.arg.1=-Dorg.apache.jasper.compiler.disablejsr199=true

# JVM memory settings
java.arg.2=-Xms256m
java.arg.3=-Xmx256m

# Enable Remote Debugging
#java.arg.debug=-    agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=8000

java.arg.4=-Djava.net.preferIPv4Stack=true

# allowRestrictedHeaders is required for Cluster/Node communications to work properly
java.arg.5=-Dsun.net.http.allowRestrictedHeaders=true
java.arg.6=-Djava.protocol.handler.pkgs=sun.net.www.protocol

# Sets the provider of SecureRandom to /dev/urandom to prevent blocking on VMs
java.arg.7=-Djava.security.egd=file:/dev/urandom


# The G1GC is still considered experimental but has proven to be very advantageous in providing great
# performance without significant "stop-the-world" delays.
#java.arg.13=-XX:+UseG1GC

#Set headless mode by default
java.arg.14=-Djava.awt.headless=true

minifi 中的 nifi.properties

# 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.
#
#
#Wed Nov 20 15:01:56 IST 2019
# Core Properties #

nifi.version=1.4.0
nifi.flow.configuration.file=./conf/flow.xml.gz
nifi.flow.configuration.archive.enabled=false
nifi.flow.configuration.archive.dir=./conf/archive/
nifi.flowcontroller.autoResumeState=true
nifi.flowcontroller.graceful.shutdown.period=10 sec
nifi.flowservice.writedelay.interval=500 ms
nifi.administrative.yield.duration=30 sec
nifi.variable.registry.properties=
# If a component has no work to do (is "bored"), how long should we wait before checking again for work?
nifi.bored.yield.duration=10 millis

nifi.authority.provider.configuration.file=./conf/authority-providers.xml
nifi.login.identity.provider.configuration.file=./conf/login-identity-providers.xml
nifi.templates.directory=./conf/templates
nifi.ui.banner.text=
nifi.ui.autorefresh.interval=30 sec
nifi.nar.library.directory=./lib
nifi.nar.working.directory=./work/nar/
nifi.documentation.working.directory=./work/docs/components

##################### State Management #####################
nifi.state.management.configuration.file=./conf/state-management.xml
# The ID of the local state provider
nifi.state.management.provider.local=local-provider

# H2 Settings
nifi.database.directory=./database_repository
nifi.h2.url.append=;LOCK_TIMEOUT\=25000;WRITE_DELAY\=0;AUTO_SERVER\=FALSE

# FlowFile Repository
nifi.flowfile.repository.implementation=org.apache.nifi.controller.repository.WriteAheadFlowFileRepository
nifi.flowfile.repository.directory=./flowfile_repository
nifi.flowfile.repository.partitions=256
nifi.flowfile.repository.checkpoint.interval=2 mins
nifi.flowfile.repository.always.sync=false

nifi.swap.manager.implementation=org.apache.nifi.controller.FileSystemSwapManager
nifi.queue.swap.threshold=20000
nifi.swap.in.period=5 sec
nifi.swap.in.threads=1
nifi.swap.out.period=5 sec
nifi.swap.out.threads=4

# Content Repository
nifi.content.repository.implementation=org.apache.nifi.controller.repository.FileSystemRepository
nifi.content.claim.max.appendable.size=10 MB
nifi.content.claim.max.flow.files=100
nifi.content.repository.archive.max.retention.period=
nifi.content.repository.archive.max.usage.percentage=
nifi.content.repository.archive.enabled=false
nifi.content.repository.directory.default=./content_repository
nifi.content.repository.always.sync=false

# Provenance Repository Properties
nifi.provenance.repository.implementation=org.apache.nifi.provenance.MiNiFiPersistentProvenanceRepository
nifi.provenance.repository.rollover.time=1 min

# Volatile Provenance Respository Properties
nifi.provenance.repository.buffer.size=10000

# Component Status Repository
nifi.components.status.repository.implementation=org.apache.nifi.controller.status.history.VolatileComponentStatusRepository
nifi.components.status.repository.buffer.size=1440
nifi.components.status.snapshot.frequency=1 min

# web properties #
nifi.web.war.directory=./lib
nifi.web.http.host=
nifi.web.http.port=8081
nifi.web.https.host=
nifi.web.https.port=
nifi.web.jetty.working.directory=./work/jetty
nifi.web.jetty.threads=200

# security properties #
nifi.sensitive.props.key=
nifi.sensitive.props.algorithm=PBEWITHMD5AND256BITAES-CBC-OPENSSL
nifi.sensitive.props.provider=BC

nifi.security.keystore=
nifi.security.keystoreType=
nifi.security.keystorePasswd=
nifi.security.keyPasswd=
nifi.security.truststore=
nifi.security.truststoreType=
nifi.security.truststorePasswd=
nifi.security.needClientAuth=
nifi.security.user.credential.cache.duration=24 hours
nifi.security.user.authority.provider=file-provider
nifi.security.user.login.identity.provider=
nifi.security.support.new.account.requests=
# Valid Authorities include: ROLE_MONITOR,ROLE_DFM,ROLE_ADMIN,ROLE_PROVENANCE,ROLE_NIFI
nifi.security.anonymous.authorities=
nifi.security.ocsp.responder.url=
nifi.security.ocsp.responder.certificate=


# cluster node properties (only configure for cluster nodes) #
nifi.cluster.is.node=false

# cluster manager properties (only configure for cluster manager) #
nifi.cluster.is.manager=false

标签: apache-nifiminify

解决方案


您可以将 bootstrap.conf(raspi) 中的 localhost 从您的计算机更改为您的 IP 地址(安装的 c2 服务器)


推荐阅读