Connect with Apache NiFi
On this page
Apache NiFi is a data integration and automation platform designed to ingest, move, transform, and manage data across various systems in real time.
Refer to Apache NiFi documentation for more information.
Prerequisites
-
Download and install Apache NiFi.
-
Install Java 21+.
-
Download the SingleStore JDBC driver
.
file.jar -
Start Apache NiFi.
Run the following command from the NiFi installation directory. ./bin/nifi.sh start -
Copy the username and password from the generated log.
Use these credentials to log in to NiFi Flow. For example, tail -n 100 <NiFi_installation_directory>/logs/nifi-app.log | grep GeneratedGenerated Username [eea280ec-6000-4000-a000-9aaf521ef5cf] Generated Password [He5Gd9ZHVgkA0JQR9d9uNc2A5WAHROI4]
Configure the Connection to SingleStore
To configure the connection to SingleStore in NiFi Flow, perform the following:
-
Open NiFi Flow, go to https://localhost:8443/nifi.
-
Log in to NiFi Flow using the generated username and password.
-
On the Nifi Flow canvas, open the options menu (right-click) and select Controller Services.
-
Select the + icon.
-
On the Add Controller Service dialog, from the list of controllers, select DBCPConnectionPool > Add.
-
On the Controller Services page.
Select the three dots for the controller added in the previous step, and then select Edit. -
In the Edit Controller Service dialog,
-
On the Settings tab, enter SingleStore in the Name field.
-
On the Properties tab, enter or select the following:
-
Database Connection URL: Specify the connection string for the SingleStore deployment in the following format:
jdbc:singlestore://<endpoint>:<port>/<database>
-
Database Driver Class Name: Specify
com.
.singlestore. jdbc. Driver -
Database Driver Location: Specify the path to the SingleStore JDBC driver
.
file downloaded earlier.jar -
Database User: Specify the username of the SingleStore database user with which to connect.
-
Password: Specify the password for the SingleStore database user.
-
Specify other connection configuration properties as applicable.
-
Under Verification, select ✔ > Verify to verify the connection configuration.
-
-
After the connection configuration is verified, a message similar to the following is displayed:
Perform Validation Component Validation passed Configure Data Source Successfully configured data source Establish Connection Successfully established Database Connection
-
Select Apply.
The SingleStore controller service is now configured.
-
-
Enable the SingleStore controller service.
Select the three dots for the controller, and then select Enable from the list. -
Close the Enable Controller Service dialog once the SingleStore controller service is enabled.
The connection to the SingleStore deployment is now configured.
Example
The following example connects to a SingleStore deployment, runs a SQL query, and then stores the output in a file.
-
On the NiFi Flow canvas, add the ExecuteSQL processor by dragging the processor to the canvas.
-
Configure the ExecuteSQL processor.
Open the options menu for the processor (right-click) and then select Configure. -
On the Edit Processor dialog, enter or select the following:
-
On the Settings tab, enter a name for the processor.
For example, Query table. -
On the Properties tab, select Database Connection Pooling Service and then select SingleStore (the configured controller service) from the list.
-
In the SQL Query field, enter a SQL query to run.
-
Specify other connection configuration properties as applicable.
-
Select Apply.
-
-
On the NiFi Flow canvas, add the ConvertRecord processor.
-
Configure the ConvertRecord processor.
Open the options menu for the processor (right-click) and then select Configure. -
On the Edit Processor dialog, enter or select the following:
-
Record Reader: Select the three dots and then select Create new service > AvroReader.
This example uses the AvroReader
service. -
Record Writer: Select the three dots and then select Create new service > JSONRecordSetWriter.
This example uses the JSONRecordSetWriter
service.
-
-
On the NiFi Flow canvas, add the PutFile processor.
-
Configure the PutFile processor.
Open the options menu for the processor (right-click) and then select Configure. -
In the Edit Processor dialog, enter or select the following:
-
On the Properties tab, enter the path to the directory where the output file is stored in the Directory field.
-
On the Relationships tab, select terminate for success and failure.
-
Select Apply.
-
-
Configure the relationships between the ExecuteSQL, ConvertRecord, and PutFile processors.
-
(If required) Enable all the controller services.
Open the options menu for the canvas (right-click), and then select Enable All Controller Services. -
Open the options menu for the canvas and select Start.
-
The output is written to a file in the specified directory.
For example, Note
The output is formatted for readability.
cat 0b570ff9-9000-4000-9000-9eff3d4dde09[ { "id": 2, "created": "2025-06-05 11:58:23.978207", "payload": "{\"eventId\":202,\"tags\":[\"music\",\"concert\"]}" }, { "id": 3, "created": "2025-06-05 11:58:23.978207", "payload": "{\"eventId\":101,\"tags\":[\"sports\",\"indoor\"]}" }, { "id": 1, "created": "2025-06-05 11:58:23.978207", "payload": "{\"eventId\":101,\"tags\":[\"sports\",\"outdoor\",\"fun\"]}" }]
Last modified: August 25, 2025