Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Setup environment variables in NiFi cluster setup in openshift

avatar

This repo in github indicates that I can setup nifi docker to use environment variables.

https://github.com/apache/nifi/blob/master/nifi-docker/dockerhub/README.md

I have setup NIFI_ZK_CONNECT_STRING environment variable in openshift as shown in screenshot below.

start-script.png

environment-variable.png

This setup is however not working as the openshift pod for Nifi fails to start.

error.png

Does nifi.properties support environment variables? The GitHub code indicates it would, but below blog post says it would not.

https://community.hortonworks.com/questions/115297/does-nifiproperties-file-accept-env-variables.htm...

Can you please clarify is this is possible?

1 ACCEPTED SOLUTION

avatar
Super Collaborator

The answer that tells that environment variables are not possible is from 1 year ago, the latest docker image of Apache Nifi at the docker hub is 1 month old. I might be wrong, but the startscript in the container seems to set the variables in the config file, so both might be true, the nifi.properties still doesn't allow environment vars, but the docker image does it.

Anyway my assumption is that your error isn't related to the environmental variables, but to something more basic, as the errors says "0: illegal option -", and we need to figure it out. Does your start-script screenshot show the $NIFI_HOME/bin/nifi-env.sh from the docker image?

View solution in original post

5 REPLIES 5

avatar
Super Collaborator

The answer that tells that environment variables are not possible is from 1 year ago, the latest docker image of Apache Nifi at the docker hub is 1 month old. I might be wrong, but the startscript in the container seems to set the variables in the config file, so both might be true, the nifi.properties still doesn't allow environment vars, but the docker image does it.

Anyway my assumption is that your error isn't related to the environmental variables, but to something more basic, as the errors says "0: illegal option -", and we need to figure it out. Does your start-script screenshot show the $NIFI_HOME/bin/nifi-env.sh from the docker image?

avatar

@Harald Berghoff
It appears that the start.sh script had to be changed to Unix format. I thought about this late in the day today and that fixed the issue. The NiFi pod is now up and running in openshift with environment variables set-up for ZK connect string.

avatar

web tutorial in welookups.com

avatar
New Contributor

@Prachi Sharma Would you might sharing your findings on github. I am facing something similar issue.

avatar

@Dhwanil Raval

I was able to follow the github link I have posted above and setup environment variable in openshift and apply them in the script start.sh

The only thing I had to do is convert the script to the Unix format in my text editor as openshift was having trouble running it when deploying the pod and starting nifi.

If you are having a specific issue I could help with that but currently its all working as described in github.