使用Nifi-Registry和Docker对Nifi流文件进行版本控制和持久化

时间:2020-03-17 23:31:11

标签: docker gitlab apache-nifi-registry

目前,我正在使用最新的稳定版本Nifi / Nifi-registry和Docker。我正在尝试在Gitlab中对流文件进行版本控制和持久化。 我在网上找到了一些信息,但现在无法正常工作。所有组件都在工作,我也可以将文件从Nifi升级到Nifi注册,但是目前缺少到Gitlab的最后一步。

->我修改了providers.xml并将其安装到容器中

<flowPersistenceProvider>
  <class>org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider</class>
  <property name="Flow Storage Directory">./versioned_flows</property>
  <property name="Remote To Push">origin</property>
  <property name="Remote Access User">*Name*</property>
  <property name="Remote Access Password">*Token*</property>
</flowPersistenceProvider>

andybody是否有一些经验,也许还有代码片段?我会很感激的。

非常感谢。

亲切的问候, T

1 个答案:

答案 0 :(得分:2)

尽管这是一篇老文章,但如果对任何人有帮助,我都会很高兴。

我有以下docker文件夹,它同时运行nifi和注册表容器。 enter image description here

复制nifi目录中的“ conf”文件夹(可以从运行没有卷的容器中获取)

运行docker volume create nifi_data

docker-compose.yml文件为:

version: "3.7"
services:

nifi:
  container_name: nifi
  image: apache/nifi:1.11.4
  ports:
    - target: 8080
      published: 8080
      protocol: tcp
      mode: host
  restart: always
  environment:
    - NIFI_WEB_HTTP_HOST=0.0.0.0
    - NIFI_JVM_HEAP_INIT=4g
    - NIFI_JVM_HEAP_MAX=6g
    - NIFI_VARIABLE_REGISTRY_PROPERTIES=./conf/env.properties
  volumes:
    - nifi_data:/opt/nifi/nifi-current/
    - ./nifi/extensions:/opt/nifi/nifi-current/extensions
    - ./nifi/conf:/opt/nifi/nifi-current/conf

nifi-registry:
  container_name: nifi-registry
  image: apache/nifi-registry:0.7.0
  ports:
    - target: 18080
      published: 18080
      protocol: tcp
      mode: host
  environment:
    - NIFI_REGISTRY_WEB_HTTP_HOST=0.0.0.0
    - JVM_OPTS=-Xmx512m -Xms512m -XX:MaxPermSize=1g
  volumes:
    - $PWD/registry/providers.xml:/opt/nifi-registry/nifi-registry-current/conf/providers.xml
    - $PWD/registry/flow-storage:/opt/nifi-registry/nifi-registry-current/flow_storage
    - $PWD/registry/database:/opt/nifi-registry/nifi-registry-current/database
volumes:
  nifi_data:
    external: true
networks:
  default:
    external:
      name: nifi-network

注意:我具有自定义属性(env.properties),并且自定义处理器位于“扩展名”目录下。另外,由于nifi在“ nifi”用户下运行,因此您可能会遇到权限问题-我敢肯定您会解决它的问题:)

providers.xml(采用默认值-注释文件系统提供程序并取消git提供程序的注释)

<flowPersistenceProvider>
<class>org.apache.nifi.registry.provider.flow.git.GitFlowPersistenceProvider</class>
<property name="Flow Storage Directory">./flow_storage</property>

最后是restart.sh文件:

chown -R 1000:1000 nifi registry // nifi's user:group
chmod -R 775 nifi registry
chmod -R g+s nifi registry
docker-compose down
docker-compose up -d