我在docker-compose.yml
文件中定义了Nifi容器。我将默认的Nifi端口从8080更改为8181。它可以正常工作。但是,我无法将flow.xml.gz
复制到Nifi容器。
nifi:
image: xemuliam/nifi
network_mode: "host"
ports:
- "8181:8181"
expose:
- "8181"
environment:
- NIFI_WEB_HTTP_PORT=8181
- NIFI_WEB_HTTP_HOST=0.0.0.0
volumes:
- ./src/data_flow_engine/flow.xml.gz:/opt/nifi/conf/flow.xml.gz
- ./src/data_flow_engine/bootstrap.conf:/opt/nifi/conf/bootstrap.conf
当我注释掉
- ./src/data_flow_engine/flow.xml.gz:/opt/nifi/conf/flow.xml.gz
时,它运行良好。这是错误消息:
2018-11-02 12:49:47,818 INFO [main] org.eclipse.jetty.server.Server Started @41290ms
nifi_1 | 2018-11-02 12:49:47,818 WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
nifi_1 | org.apache.nifi.web.NiFiCoreException: Unable to start Flow Controller.
nifi_1 | at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:88)
nifi_1 | at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:876)
nifi_1 | at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:532)
nifi_1 | at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:839)
nifi_1 | at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:344)
nifi_1 | at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1480)
nifi_1 | at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1442)
nifi_1 | at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:799)
nifi_1 | at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:261)
nifi_1 | at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:540)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.server.handler.gzip.GzipHandler.doStart(GzipHandler.java:290)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:113)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:131)
nifi_1 | at org.eclipse.jetty.server.Server.start(Server.java:452)
nifi_1 | at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:105)
nifi_1 | at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
nifi_1 | at org.eclipse.jetty.server.Server.doStart(Server.java:419)
nifi_1 | at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
nifi_1 | at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:777)
nifi_1 | at org.apache.nifi.NiFi.<init>(NiFi.java:157)
nifi_1 | at org.apache.nifi.NiFi.<init>(NiFi.java:71)
nifi_1 | at org.apache.nifi.NiFi.main(NiFi.java:292)
nifi_1 | Caused by: java.nio.file.FileSystemException: ./conf/flow.xml.gz: Resource busy
nifi_1 | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:91)
nifi_1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
nifi_1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
nifi_1 | at sun.nio.fs.UnixFileSystemProvider.implDelete(UnixFileSystemProvider.java:244)
nifi_1 | at sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:108)
nifi_1 | at java.nio.file.Files.deleteIfExists(Files.java:1165)
nifi_1 | at org.apache.nifi.persistence.StandardXMLFlowConfigurationDAO.save(StandardXMLFlowConfigurationDAO.java:165)
nifi_1 | at org.apache.nifi.controller.StandardFlowService.load(StandardFlowService.java:536)
nifi_1 | at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:72)
nifi_1 | ... 33 common frames omitted
nifi_1 | 2018-11-02 12:49:47,819 INFO [Thread-1] org.apache.nifi.NiFi Initiating shutdown of Jetty web server...
nifi_1 | 2018-11-02 12:49:47,820 INFO [Thread-1] o.eclipse.jetty.server.AbstractConnector Stopped ServerConnector@41d0b71d{HTTP/1.1,[http/1.1]}{0.0.0.0:8181}
nifi_1 | 2018-11-02 12:49:47,823 INFO [Thread-1] org.eclipse.jetty.server.session Stopped scavenging
最佳答案
映射flow.xml.gz
文件似乎不起作用(我使用apache / nifi-1.8.0进行了测试,结果与您相同)。
将整个/conf
目录映射到容器对我来说很有效。这是我正在使用的docker-compose文件:
version: "3.5"
services:
nifi:
image: apache/nifi:1.8.0
ports:
- "8181:8080"
environment:
- NIFI_WEB_HTTP_HOST=0.0.0.0
volumes:
- ./conf:/opt/nifi/nifi-current/conf/
在这种情况下,我的本地./conf目录是整个NiFi配置目录,其中包含:
conf
├── authorizers.xml
├── bootstrap-notification-services.xml
├── bootstrap.conf
├── flow.xml.gz
├── logback.xml
├── login-identity-providers.xml
├── nifi.properties
├── state-management.xml
└── zookeeper.properties
如果您还没有conf目录作为起点,则可以通过将其复制到Apache项目提供的与您所使用的Docker镜像版本相对应的便捷二进制文件中来获取它。在我的示例中,我使用了nifi.apache.org提供的nifi-1.8.0.zip中的conf目录。请注意,该目录中的某些文件是在运行时由NiFi在该目录中创建的。
关于docker - Docker:由以下原因引起:java.nio.file.FileSystemException:./conf/flow.xml.gz:资源繁忙,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/53119670/