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. إنها في كل مكان! اسمك ودرجاتك المدرسية ودرجة الحرارة في الخارج والصور على هاتفك والرسائل التي ترسلها — كل هذه تُعد 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 (وكالة الأمن القومي) في الولايات المتحدة، ثم قُدّم لاحقًا إلى مجتمع المصدر المفتوح عبر 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 مجاني تمامًا للاستخدام والتعديل والمشاركة. ينسجم ذلك مع مهمة Alin Li لإحياء روح الحوسبة المفتوحة. لا تراخيص مدفوعة أو اشتراكات — فقط برنامج قوي مجاني للجميع!
NiFi يشبه super-smart delivery service for data. إليك ما يمكنه فعله:
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 مفهومًا يُسمّى «تدفقات البيانات». يشبه تدفّق البيانات وصفة تخبر NiFi: "خذ البيانات من هنا، ونفّذ عليها هذا، ثم أرسلها إلى هناك."
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. إلى ماذا يرمز NiFi؟
2. ما FlowFile في NiFi؟
3. NiFi برنامج مفتوح المصدر. ماذا يعني ذلك؟
4. ما مساحة العمل Canvas في NiFi؟
لنشغّل NiFi على حاسوبك — الأمر أسهل مما تظن!
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 إلى Java ليعمل. سنثبّت OpenJDK — the free, open-source version of Java.
على Ubuntu/Debian Linux:
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.
لننزّل NiFi نفسه الآن!
.zip file for all platforms).على Linux (باستخدام الطرفية):
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!
على Linux/macOS:
على Windows:
يستغرق بدء NiFi نحو 30-60 ثانية. يحمّل في الخلفية معالجاته وأدواته القوية. انتظر ظهور "NiFi has started" في السجل.
لدى NiFi واجهة ويب جميلة. افتح المتصفح وانتقل إلى:
يولّد NiFi 2.x اسم مستخدم وكلمة مرور عشوائيين عند أول تشغيل. تجدهما في السجل:
يستخدم NiFi 2.x اتصال HTTPS آمنًا افتراضيًا على المنفذ 8443. قد يعرض المتصفح تحذيرًا أمنيًا — هذا طبيعي لشهادة محلية موقّعة ذاتيًا. انقر «متقدم» ← «متابعة».
بعد تسجيل الدخول، سترى 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. ما الذي يجب تثبيته قبل NiFi؟
2. ما عنوان الويب الافتراضي للوصول إلى NiFi؟
3. أي أمر يبدأ NiFi على Linux؟
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 معالج مدمج! إليك أهمها للمبتدئين:
| 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 |
لننشئ أبسط تدفق ممكن لنرى NiFi أثناء العمل!
GenerateFlowFile and add it.LogAttribute and add it.5 sec (ليولّد بيانات كل 5 ثوانٍ).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
لننشئ تدفقًا ينفّذ تلقائيًا moves files from one folder to another!
~/nifi-input و ~/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. لكل اتصال 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. ما الترتيب الصحيح لتدفق بيانات أساسي؟
2. ماذا يفعل المعالج GenerateFlowFile؟
3. ماذا يحدث عندما يمتلئ طابور NiFi؟
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 واجهة طقس مجانية كل 5 دقائق، ويجلب البيانات الحالية ويحفظها بملف. مع الوقت تبني قاعدة بيانات لسجل الطقس!
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 واجهة API للطقس مجانية تمامًا ومفتوحة المصدر — لا تحتاج إلى مفتاح API! إنها مثالية للتعلّم ومتوافقة مع قيمنا في المصادر المفتوحة.
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). إنها لغة مصغّرة قوية للتعامل مع سمات FlowFile. ستستخدمها كثيرًا عند بناء تدفّقات أكثر تعقيدًا!
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. أي معالج يستقبل طلبات HTTP من ESP32؟
2. أي معالج يرسل طلبات HTTP إلى API؟
3. ماذا يفعل RouteOnAttribute؟
4. في لغة تعبيرات NiFi، ما الذي يفعله ${filename:endsWith('.pdf')} check?
Congratulations on completing the Alin Li — دورة NiFi — مغامرات تدفق البيانات!
You've learned how to install NiFi, build data flows, and create real IoT and API projects. Keep exploring, keep building, and remember:
«إحياء روح الحوسبة المفتوحة» 🌟