Support Questions
Find answers, ask questions, and share your expertise

Apache Nifi failed to start zookeeper

Apache Nifi failed to start zookeeper

New Contributor

Hi everyone,

 

I'm using a Nifi cluster on AWS with autoscaling.

Sometimes, when I rebuild an instance, I got the below error :

 

Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowService': FactoryBean threw exception on object creation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowController': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Unable to initailize Flow because NiFi was configured to start an Embedded Zookeeper server but failed to do so
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
at org.apache.nifi.web.contextlistener.ApplicationStartupContextListener.contextInitialized(ApplicationStartupContextListener.java:55)
... 37 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'flowController': FactoryBean threw exception on object creation; nested exception is java.lang.IllegalStateException: Unable to initailize Flow because NiFi was configured to start an Embedded Zookeeper server but failed to do so
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103)
at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:323)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
at org.apache.nifi.spring.StandardFlowServiceFactoryBean.getObject(StandardFlowServiceFactoryBean.java:48)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
... 43 common frames omitted
Caused by: java.lang.IllegalStateException: Unable to initailize Flow because NiFi was configured to start an Embedded Zookeeper server but failed to do so
at org.apache.nifi.controller.FlowController.<init>(FlowController.java:602)
at org.apache.nifi.controller.FlowController.createClusteredInstance(FlowController.java:414)
at org.apache.nifi.spring.FlowControllerFactoryBean.getObject(FlowControllerFactoryBean.java:65)
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:178)
... 50 common frames omitted
Caused by: java.io.IOException: Failed to start embedded ZooKeeper Peer
at org.apache.nifi.controller.state.server.ZooKeeperStateServer.startDistributed(ZooKeeperStateServer.java:147)
at org.apache.nifi.controller.state.server.ZooKeeperStateServer.start(ZooKeeperStateServer.java:71)
at org.apache.nifi.controller.FlowController.<init>(FlowController.java:600)
... 53 common frames omitted
Caused by: org.apache.zookeeper.server.persistence.FileTxnSnapLog$DatadirException: Unable to create data directory /etc/nifi/state/zookeeper/version-2
at org.apache.zookeeper.server.persistence.FileTxnSnapLog.<init>(FileTxnSnapLog.java:115)
at org.apache.nifi.controller.state.server.ZooKeeperStateServer.startDistributed(ZooKeeperStateServer.java:124)
... 55 common frames omitted
2021-04-01 09:27:31,636 INFO [Thread-1] o.eclipse.jetty.server.AbstractConnector Stopped ServerConnector@2d23faef{HTTP/1.1,[http/1.1]}{olg-enk-dtdev-nifi-node3.dtdev.nprd.fdjaws.corp:8888}
2021-04-01 09:27:31,636 INFO [Thread-1] org.eclipse.jetty.server.session node0 Stopped scavenging

 

This happens randomly.... And the "version-2" is created even if the zookeeper says it is not :


 ll /etc/nifi/state/zookeeper/version-2
total 0
ll /etc/nifi/state/zookeeper/
total 4
-rw-r--r--. 1 nifi nifi 2 Apr 1 09:25 myid
drwxr-xr-x. 2 nifi nifi 6 Apr 1 09:27 version-2

 

Any chance some of you already faced this issue ?

 

Thanks !