NiFi Up and Running
This is a quick-start guide for installing and setting up Apache NiFi 1.x with security enabled. Single-user authentication (used below) needs NiFi 1.14 or newer.
Installation
- Download NiFi and extract to
/opt.
shell
tar -xzvf nifi-<version>-bin.tar.gz -C /opt
- Create a symlink.
shell
cd /opt
ln -s nifi-<version>/ nifi
- Install Java.
shell
yum install java-latest-openjdk -y
- Set Java path in
~/.bash_profile.
shell
java_home=$(dirname $(dirname $(readlink -f $(which java))))
echo -e "\nJAVA_HOME=$java_home\nexport JAVA_HOME" >> ~/.bash_profile
source ~/.bash_profile
Security Configuration
NiFi requires HTTPS and authentication for production use.
- Generate certificates using the NiFi Toolkit (a separate download from the NiFi downloads page, extracted to
/opt/nifi-toolkit):
shell
/opt/nifi-toolkit/bin/tls-toolkit.sh standalone -n localhost -C 'CN=admin, OU=NIFI' -o /opt/nifi/conf/
This creates:
- keystore.jks and truststore.jks
- Client certificate for admin user
- Edit
/opt/nifi/conf/nifi.propertiesand configure HTTPS:
```properties nifi.web.https.host=0.0.0.0 nifi.web.https.port=8443 nifi.web.http.host= nifi.web.http.port=
nifi.security.keystore=/opt/nifi/conf/keystore.jks
nifi.security.keystoreType=jks
nifi.security.keystorePasswd=
- Configure single-user authentication in
/opt/nifi/conf/nifi.properties:
properties
nifi.security.user.login.identity.provider=single-user-provider
- Set initial admin password:
shell
cd /opt/nifi/bin
./nifi.sh set-single-user-credentials admin <your_password>
Firewall Configuration
Allow HTTPS access:
1 2 | firewall-cmd --permanent --add-port=8443/tcp firewall-cmd --reload |
For clustered NiFi, also open cluster ports:
1 2 3 | firewall-cmd --permanent --add-port=6007/tcp # Cluster protocol firewall-cmd --permanent --add-port=9443/tcp # Node-to-node firewall-cmd --reload |
Start NiFi
- Start the service:
shell
cd /opt/nifi/bin
./nifi.sh start
- Monitor startup logs:
shell
tail -f /opt/nifi/logs/nifi-app.log
Wait for: NiFi has started. The UI is available at...
- Access the web UI:
https://<server-ip>:8443/nifi
Login with username admin and the password you set.
Initial Configuration
-
In the NiFi UI, drag a processor onto the canvas to start building flows.
-
Common first processors: - GetFile - Read files from disk - ListenTCP - Receive TCP data - GenerateFlowFile - Create test data
-
Right-click canvas → Configure → Controller Services to add: - DBCPConnectionPool for database connections - JsonRecordSetWriter for JSON output - CSVReader for CSV parsing
Systemd Service (Optional)
Create a nifi service user and give it the install:
1 2 | useradd -r -s /sbin/nologin nifi chown -R nifi:nifi /opt/nifi /opt/nifi-<version> |
Then create /etc/systemd/system/nifi.service:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | [Unit] Description=Apache NiFi After=network.target [Service] Type=forking User=nifi Group=nifi ExecStart=/opt/nifi/bin/nifi.sh start ExecStop=/opt/nifi/bin/nifi.sh stop ExecRestart=/opt/nifi/bin/nifi.sh restart Restart=on-failure [Install] WantedBy=multi-user.target |
Enable and start:
1 2 3 | systemctl daemon-reload systemctl enable nifi systemctl start nifi |
Troubleshooting
Check Java heap size in /opt/nifi/conf/bootstrap.conf:
1 2 | java.arg.2=-Xms512m java.arg.3=-Xmx2g |
View logs:
1 2 | tail -f /opt/nifi/logs/nifi-app.log tail -f /opt/nifi/logs/nifi-user.log |