Data Flow Adventures — Learn how data moves like magic!
v1.0 • 4 Modules • Ages 9-14Discover the amazing tool that moves data around like a super-smart delivery service!
Data is information. See on kõikjal! Sinu nimi, koolihinded, välistemperatuur, telefonis olevad fotod ja saadetud sõnumid — kõik need on data.
Companies and organisations collect tons of data every second. Think about a weather station recording temperature every minute, or a shop tracking what people buy. All this data needs to move from one place to another to be useful.
Imagine millions of letters and packages arriving at a post office every day. Someone has to sort them, read the addresses, decide where they go, and deliver them. Apache NiFi does exactly this — but for data!
Apache NiFi is a free, open-source software that helps you collect, move, and deliver data between different systems automatically. It was originally created by the NSA (riiklik julgeolekuagentuur) USA-s ja anti hiljem avatud lähtekoodi kogukonnale Apache Software Foundation.
The name "NiFi" comes from "NiagaraFiles" — like the powerful Niagara Falls, it handles huge rivers of data flowing from one place to another!
NiFi kasutamine, muutmine ja jagamine on täiesti tasuta. See sobib Alin Li eesmärgiga taaselustada avatud arvutuse vaimu. Tasuliste litsentside ja tellimusteta — lihtsalt võimas tasuta tarkvara kõigile!
NiFi on nagu super-smart delivery service for data. See suudab teha järgmist:
Grab data from files, websites, sensors, databases, and more
Change data format, filter what you need, combine different sources
Send data to databases, files, cloud services, or other apps
See exactly where your data is and what's happening to it in real-time
Encrypt data, control who can see it, and track every change
Process millions of data items per second without breaking a sweat
NiFi kasutab mõistet „andmevood“. Andmevoog on nagu retsept, mis ütleb NiFi-le: "Võta andmed SIIT, tee nendega SEDA ja saada need SIIS SINNA."
Here's a simple data flow:
Raw materials (data) come in → workers on the line (processors) shape and transform them → finished products (processed data) come out at the end. NiFi is the factory manager that controls the entire line!
Learn the NiFi vocabulary by tapping each card:
Even as a young learner, understanding data flow is super valuable because:
1. Mida tähendab NiFi?
2. Mis on NiFi FlowFile?
3. NiFi on avatud lähtekoodiga tarkvara. Mida see tähendab?
4. Mis on NiFi lõuend Canvas?
Paneme NiFi sinu arvutis tööle — see on lihtsam, kui arvad!
Before installing NiFi, make sure you have:
At Alin Li, we love Linux because it's free, open-source, and perfectly suited for running server applications like NiFi. Most NiFi installations in the real world run on Linux!
NiFi vajab töötamiseks Javat. Paigaldame OpenJDK — the free, open-source version of Java.
Ubuntu/Debian Linuxis:
You should see something like: openjdk version "21.0.x" — that means Java is ready!
Download OpenJDK from adoptium.net — it's the free Java from the Eclipse Foundation. Run the installer and make sure to check "Set JAVA_HOME variable" during installation.
Laadime nüüd NiFi enda alla!
.zip file for all platforms).Linuxis (terminali abil):
The version number (2.1.0) will change over time. Always check the official NiFi website for the latest version before downloading.
Time to launch NiFi and see the magic happen!
Linuxis/macOS-is:
Windowsis:
NiFi käivitub umbes 30-60 sekundiga. Taustal laaditakse võimsaid protsessoreid ja tööriistu. Oota, kuni logisse ilmub „NiFi has started”.
NiFil on kaunis veebiliides. Ava brauser ja mine aadressile:
NiFi 2.x loob esmakäivitusel juhusliku kasutajanime ja parooli. Leiad need logist:
NiFi 2.x kasutab vaikimisi HTTPS-i (turvalist ühendust) pordil 8443. Brauser võib näidata turvahoiatust — kohaliku iseallkirjastatud sertifikaadi puhul on see tavaline. Klõpsa „Täpsem” → „Jätka”.
Pärast sisselogimist näed NiFi Canvas — your blank workspace ready for building data flows!
The NiFi interface has these main parts:
Top bar with icons for adding processors, labels, and other components
The big white area where you drag-and-drop to build flows
Shows how many processors are running, stopped, or have errors
Controls to start, stop, and configure your data flow
1. Mida tuleb paigaldada ENNE NiFi-t?
2. Milline on NiFi vaikimisi veebiaadress?
3. Milline käsk käivitab NiFi Linuxis?
Time to build your first data flow — drag, drop, connect, and watch data move!
Every NiFi data flow is made from just a few building blocks:
That's it! With just processors and connections, you can build incredibly powerful data flows. Let's learn about each piece.
Processors are the workers of NiFi. Each processor does ONE specific job. NiFi comes with over 300 sisseehitatud protsessorit! Siin on algajatele kõige olulisemad:
| Processor | What It Does | Category |
|---|---|---|
GetFile |
Reads files from a folder on your computer | Source |
PutFile |
Writes data to a file on your computer | Destination |
GenerateFlowFile |
Creates test data for experimenting | Source |
LogAttribute |
Prints FlowFile details to the log (for debugging) | Utility |
UpdateAttribute |
Changes or adds labels (attributes) to a FlowFile | Transform |
ReplaceText |
Finds and replaces text inside FlowFile content | Transform |
RouteOnAttribute |
Sends data to different paths based on conditions | Transform |
ListenHTTP |
Receives data sent over HTTP (from websites, IoT, etc.) | Source |
InvokeHTTP |
Calls websites or APIs to get or send data | Utility |
Loome kõige lihtsama voo, et näha NiFit töös!
GenerateFlowFile and add it.LogAttribute and add it.5 sec (nii genereerib see andmeid iga 5 sekundi järel).You've just built your first NiFi data flow! Check the NiFi logs to see the FlowFile attributes being printed. You can find logs at: logs/nifi-app.log
Loome voo, mis automaatselt moves files from one folder to another!
~/nifi-input ja ~/nifi-outputGetFile processor → configure "Input Directory" to /home/yourname/nifi-inputPutFile processor → configure "Directory" to /home/yourname/nifi-outputWithin seconds, the test file will magically appear in the output folder! 🪄
The lines between processors are called Connections. Igal ühendusel on queue where FlowFiles wait.
Imagine a conveyor belt between two workers. If Worker B is slower than Worker A, packages pile up on the belt. In NiFi, FlowFiles pile up in the queue. You can see exactly how many are waiting by looking at the number on the connection!
Queue features you should know:
Drag each processor name to the correct description:
1. Milline on lihtsa andmevoo õige järjestus?
2. Mida teeb protsessor GenerateFlowFile?
3. Mis juhtub, kui NiFi järjekord täitub?
Apply your NiFi skills to exciting real projects — IoT sensors, web APIs, and file routing!
Collect temperature data from an ESP32 sensor and save it with NiFi!
The Idea: Your ESP32 reads a temperature sensor and sends the reading to NiFi over WiFi. NiFi receives it, adds a timestamp, and saves it to a file. This is exactly how real IoT systems work!
This sketch connects your ESP32 to WiFi and sends temperature to NiFi every 10 seconds:
ListenHTTP → set Port to 9090 and Base Path to /iotUpdateAttribute → add property: filename = temp_${now():format('yyyyMMdd_HHmmss')}.jsonPutFile → set Directory to /home/yourname/iot-dataEvery 10 seconds, a new JSON file will appear in your iot-data folder with the temperature reading from the ESP32! You're now running a real IoT data pipeline!
Fetch weather data from a free API and save it automatically!
The Idea: NiFi küsib tasuta ilma-API-lt iga 5 minuti järel praegusi ilmaandmeid ja salvestab faili. Nii kogud aja jooksul ilmaajaloo andmebaasi!
GenerateFlowFile → Scheduling: Run every 5 minInvokeHTTP → set "HTTP URL" to a free weather API like:https://api.open-meteo.com/v1/forecast?latitude=25.29&longitude;=51.53¤t;_weather=trueUpdateAttribute → set filename: weather_${now():format('yyyyMMdd_HHmm')}.jsonPutFile → Directory: /home/yourname/weather-dataOpen-Meteo on täiesti tasuta avatud lähtekoodiga ilma-API — API-võtit pole vaja! See sobib suurepäraselt õppimiseks ja on kooskõlas meie avatud lähtekoodi väärtustega.
Automatically sort files into folders based on their type!
The Idea: Drop any file into an "inbox" folder, and NiFi will automatically sort it — PDFs go to one folder, images to another, text files to a third!
inbox, sorted/pdf, sorted/images, sorted/textGetFile → Input Directory: your inbox folderRouteOnAttribute → Add routing rules:
${filename:endsWith('.pdf')}
${filename:endsWith('.jpg'):or(${filename:endsWith('.png')})}
${filename:endsWith('.txt')}
PutFile processors — one for each sorted folderThe ${filename:endsWith('.pdf')} syntax is called NiFi Expression Language (EL). See on võimas minikeel FlowFile’i atribuutidega töötamiseks. Keerukamaid vooge ehitades kasutad seda sageli!
You've learned the fundamentals of Apache NiFi! Here are some exciting things to try next:
Use PutDatabaseRecord to store data in MySQL, PostgreSQL, or SQLite
Use PutEmail to send yourself alerts when something interesting happens
Get data from one API, transform it, and send it to another
Connect NiFi to Grafana to visualise your IoT data in real-time
1. Milline protsessor võtab ESP32-lt vastu HTTP-päringuid?
2. Milline protsessor saadab API-le HTTP-päringuid?
3. Mida teeb RouteOnAttribute?
4. Mida teeb NiFi avaldisekeeles ${filename:endsWith('.pdf')} check?
Congratulations on completing the Alin Li NiFi kursus — andmevoogude seiklused!
You've learned how to install NiFi, build data flows, and create real IoT and API projects. Keep exploring, keep building, and remember:
„Avatud andmetöötluse vaimu taaselustamine“ 🌟