{"id":120759,"date":"2025-11-13T15:30:00","date_gmt":"2025-11-13T08:30:00","guid":{"rendered":"https:\/\/tino.vn\/blog\/?p=120759"},"modified":"2026-01-02T17:01:25","modified_gmt":"2026-01-02T10:01:25","slug":"airflow-la-gi","status":"publish","type":"post","link":"https:\/\/tino.vn\/blog\/airflow-la-gi\/","title":{"rendered":"Airflow l\u00e0 g\u00ec? Gi\u1ea3i m\u00e3 chi ti\u1ebft c\u00f4ng c\u1ee5 \u0111i\u1ec1u ph\u1ed1i Data Pipeline m\u1ea1nh m\u1ebd nh\u1ea5t 2026"},"content":{"rendered":"\n<p><strong>Trong k\u1ef7 nguy\u00ean Big Data, d\u1eef li\u1ec7u kh\u00f4ng ch\u1ec9 l\u1edbn m\u00e0 c\u00f2n ph\u1ee9c t\u1ea1p, \u0111\u00f2i h\u1ecfi c\u00e1c quy tr\u00ecnh x\u1eed l\u00fd ph\u1ea3i ch\u1ea1y li\u00ean t\u1ee5c v\u00e0 ch\u00ednh x\u00e1c. Nh\u01b0ng \u0111i\u1ec1u g\u00ec x\u1ea3y ra khi m\u1ed9t t\u00e1c v\u1ee5 th\u1ea5t b\u1ea1i l\u00fac 3 gi\u1edd s\u00e1ng? L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 b\u1ea1n qu\u1ea3n l\u00fd h\u00e0ng tr\u0103m quy tr\u00ecnh ETL ph\u1ee5 thu\u1ed9c l\u1eabn nhau m\u00e0 kh\u00f4ng l\u00e3ng ph\u00ed s\u1ee9c ng\u01b0\u1eddi? \u0110\u00e2y ch\u00ednh l\u00e0 l\u00fac Airflow xu\u1ea5t hi\u1ec7n. V\u1eady c\u1ee5 th\u1ec3 Airflow l\u00e0 g\u00ec? C\u00f9ng Tino gi\u1ea3i m\u00e3 chi ti\u1ebft qua b\u00e0i vi\u1ebft d\u01b0\u1edbi \u0111\u00e2y nh\u00e9!<\/strong><\/p>\n\n\n\n<h2 id=\"Airflow_l\u00e0_g\u00ec?\"><a id=\"post-120759-_hv53r5do7u4u\"><\/a>Airflow l\u00e0 g\u00ec?<\/h2>\n\n\n\n<h3 id=\"T\u1ed5ng_quan_v\u1ec1_Airflow\"><a id=\"post-120759-_lbn6te8xlwbe\"><\/a><strong>T\u1ed5ng quan v\u1ec1 Airflow<\/strong><\/h3>\n\n\n\n<p><a href=\"https:\/\/airflow.apache.org\/\" target=\"_blank\" data-type=\"link\" data-id=\"https:\/\/airflow.apache.org\/\" rel=\"noreferrer noopener nofollow\">Airflow (Apache Airflow) <\/a>l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng m\u00e3 ngu\u1ed3n m\u1edf \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng \u0111\u1ec3 l\u1eadp tr\u00ecnh, l\u00ean l\u1ecbch v\u00e0 gi\u00e1m s\u00e1t c\u00e1c quy tr\u00ecnh c\u00f4ng vi\u1ec7c m\u1ed9t c\u00e1ch c\u00f3 h\u1ec7 th\u1ed1ng. \u0110\u01b0\u1ee3c ph\u00e1t tri\u1ec3n t\u1ea1i Airbnb, Airflow nhanh ch\u00f3ng tr\u1edf th\u00e0nh m\u1ed9t d\u1ef1 \u00e1n h\u00e0ng \u0111\u1ea7u c\u1ee7a Qu\u1ef9 ph\u1ea7n m\u1ec1m Apache (Apache Software Foundation) v\u00e0 l\u00e0 c\u00f4ng c\u1ee5 kh\u00f4ng th\u1ec3 thi\u1ebfu trong l\u0129nh v\u1ef1c K\u1ef9 thu\u1eadt d\u1eef li\u1ec7u (Data Engineering).<\/p>\n\n\n\n<p>Ch\u1ee9c n\u0103ng c\u1ed1t l\u00f5i c\u1ee7a Airflow l\u00e0 \u0111i\u1ec1u ph\u1ed1i, \u0111\u00f3ng vai tr\u00f2 nh\u01b0 m\u1ed9t &#8220;nh\u1ea1c tr\u01b0\u1edfng&#8221; th\u00f4ng minh, \u0111\u1ea3m b\u1ea3o r\u1eb1ng c\u00e1c t\u00e1c v\u1ee5 ph\u1ee9c t\u1ea1p \u0111\u01b0\u1ee3c th\u1ef1c thi \u0111\u00fang th\u1ee9 t\u1ef1, v\u00e0o \u0111\u00fang th\u1eddi \u0111i\u1ec3m, v\u00e0 x\u1eed l\u00fd c\u00e1c s\u1ef1 c\u1ed1 c\u00f3 th\u1ec3 x\u1ea3y ra.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-1.png\" alt=\"T\u1ed5ng quan v\u1ec1 Airflow\" class=\"wp-image-120760\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-1.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-1-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>T\u1ed5ng quan v\u1ec1 Airflow<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>\u0110i\u1ec3m kh\u00e1c bi\u1ec7t ch\u00ednh c\u1ee7a Airflow n\u1eb1m \u1edf tri\u1ebft l\u00fd &#8220;Workflows as Code&#8221; (Quy tr\u00ecnh l\u00e0m vi\u1ec7c d\u01b0\u1edbi d\u1ea1ng m\u00e3). Thay v\u00ec s\u1eed d\u1ee5ng giao di\u1ec7n k\u00e9o-th\u1ea3, ng\u01b0\u1eddi d\u00f9ng \u0111\u1ecbnh ngh\u0129a to\u00e0n b\u1ed9 quy tr\u00ecnh l\u00e0m vi\u1ec7c c\u1ee7a m\u00ecnh b\u1eb1ng <a href=\"https:\/\/tino.vn\/blog\/python-la-gi\/\" target=\"_blank\" data-type=\"post\" data-id=\"16155\" rel=\"noreferrer noopener\">ng\u00f4n ng\u1eef l\u1eadp tr\u00ecnh Python<\/a>. \u0110i\u1ec1u n\u00e0y mang l\u1ea1i s\u1ef1 linh ho\u1ea1t v\u00f4 h\u1ea1n, cho ph\u00e9p c\u00e1c k\u1ef9 s\u01b0 x\u00e2y d\u1ef1ng c\u00e1c pipeline ph\u1ee9c t\u1ea1p, t\u00edch h\u1ee3p logic \u0111\u1ed9ng v\u00e0 qu\u1ea3n l\u00fd phi\u00ean b\u1ea3n cho c\u00e1c quy tr\u00ecnh d\u1eef li\u1ec7u c\u1ee7a h\u1ecd gi\u1ed1ng nh\u01b0 c\u00e1ch h\u1ecd qu\u1ea3n l\u00fd m\u00e3 ngu\u1ed3n ph\u1ea7n m\u1ec1m.<\/p>\n\n\n\n<p>Ng\u00e0y nay, Airflow \u0111\u01b0\u1ee3c s\u1eed d\u1ee5ng r\u1ed9ng r\u00e3i b\u1edfi c\u00e1c c\u00f4ng ty c\u00f4ng ngh\u1ec7 l\u1edbn nh\u01b0 Airbnb, Spotify, Netflix hay Uber \u0111\u1ec3 t\u1ef1 \u0111\u1ed9ng h\u00f3a h\u00e0ng ngh\u00ecn t\u00e1c v\u1ee5 m\u1ed7i ng\u00e0y. Nh\u1edd kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng, t\u00ednh minh b\u1ea1ch v\u00e0 c\u1ed9ng \u0111\u1ed3ng ph\u00e1t tri\u1ec3n m\u1ea1nh m\u1ebd, Apache Airflow \u0111\u00e3 tr\u1edf th\u00e0nh chu\u1ea9n m\u1ef1c trong l\u0129nh v\u1ef1c Data Engineering hi\u1ec7n \u0111\u1ea1i.<\/p>\n\n\n\n<h3 id=\"T\u1ea1i_sao_Cronjob_l\u00e0_kh\u00f4ng_\u0111\u1ee7?\"><a id=\"post-120759-_t8w9ihoj40ac\"><\/a><strong>T\u1ea1i sao Cronjob l\u00e0 kh\u00f4ng \u0111\u1ee7?<\/strong><\/h3>\n\n\n\n<p>Trong giai \u0111o\u1ea1n \u0111\u1ea7u khi x\u00e2y d\u1ef1ng h\u1ec7 th\u1ed1ng d\u1eef li\u1ec7u ho\u1eb7c \u1ee9ng d\u1ee5ng nh\u1ecf, nhi\u1ec1u k\u1ef9 s\u01b0 th\u01b0\u1eddng s\u1eed d\u1ee5ng Cronjob \u0111\u1ec3 t\u1ef1 \u0111\u1ed9ng h\u00f3a c\u00e1c t\u00e1c v\u1ee5 theo l\u1ecbch \u0111\u1ecbnh s\u1eb5n. V\u00ed d\u1ee5: &#8220;ch\u1ea1y m\u1ed9t script x\u00f3a file log l\u00fac 3 gi\u1edd s\u00e1ng m\u1ed7i ng\u00e0y&#8221; ho\u1eb7c &#8220;g\u1eedi m\u1ed9t email b\u00e1o c\u00e1o l\u00fac 8 gi\u1edd s\u00e1ng&#8221;.<\/p>\n\n\n\n<p>Nh\u00ecn chung, Cronjob \u0111\u01a1n gi\u1ea3n, d\u1ec5 thi\u1ebft l\u1eadp v\u00e0 ph\u00f9 h\u1ee3p v\u1edbi c\u00e1c t\u00e1c v\u1ee5 \u0111\u1ed9c l\u1eadp, nh\u1ecf l\u1ebb. Tuy nhi\u00ean, quy m\u00f4 v\u00e0 \u0111\u1ed9 ph\u1ee9c t\u1ea1p t\u0103ng l\u00ean, Cronjob nhanh ch\u00f3ng b\u1ed9c l\u1ed9 nhi\u1ec1u h\u1ea1n ch\u1ebf nghi\u00eam tr\u1ecdng:<\/p>\n\n\n\n<h4 id=\"Thi\u1ebfu_kh\u1ea3_n\u0103ng_qu\u1ea3n_l\u00fd_lu\u1ed3ng_c\u00f4ng_vi\u1ec7c_ph\u1ee9c_t\u1ea1p\"><a id=\"post-120759-_4nzaze1gbiy6\"><\/a>Thi\u1ebfu kh\u1ea3 n\u0103ng qu\u1ea3n l\u00fd lu\u1ed3ng c\u00f4ng vi\u1ec7c ph\u1ee9c t\u1ea1p<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p>Cronjob ch\u1ec9 \u0111\u01a1n thu\u1ea7n ch\u1ea1y m\u1ed9t t\u1eadp l\u1ec7nh theo l\u1ecbch, kh\u00f4ng hi\u1ec3u m\u1ed1i quan h\u1ec7 gi\u1eefa c\u00e1c t\u00e1c v\u1ee5. Trong khi \u1edf th\u1ef1c t\u1ebf, c\u00e1c quy tr\u00ecnh d\u1eef li\u1ec7u th\u01b0\u1eddng ph\u1ee5 thu\u1ed9c l\u1eabn nhau \u2013 v\u00ed d\u1ee5: b\u1ea1n ch\u1ec9 c\u00f3 th\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u sau khi qu\u00e1 tr\u00ecnh thu th\u1eadp ho\u00e0n t\u1ea5t v\u00e0 ch\u1ec9 c\u00f3 th\u1ec3 g\u1eedi b\u00e1o c\u00e1o khi d\u1eef li\u1ec7u \u0111\u00e3 \u0111\u01b0\u1ee3c t\u1ed5ng h\u1ee3p.<\/p>\n\n\n\n<p>Cronjob kh\u00f4ng th\u1ec3 qu\u1ea3n l\u00fd chu\u1ed7i ph\u1ee5 thu\u1ed9c n\u00e0y, d\u1eabn \u0111\u1ebfn vi\u1ec7c x\u1eed l\u00fd sai th\u1ee9 t\u1ef1, ch\u1ed3ng l\u1ec7nh ho\u1eb7c l\u1ed7i d\u1eef li\u1ec7u n\u1ebfu m\u1ed9t b\u01b0\u1edbc b\u1ecb th\u1ea5t b\u1ea1i m\u00e0 h\u1ec7 th\u1ed1ng v\u1eabn ti\u1ebfp t\u1ee5c ch\u1ea1y.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-2.png\" alt=\"T\u1ea1i sao Cronjob l\u00e0 kh\u00f4ng \u0111\u1ee7?\" class=\"wp-image-120761\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-2.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-2-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>T\u1ea1i sao Cronjob l\u00e0 kh\u00f4ng \u0111\u1ee7?<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h4 id=\"Kh\u00f4ng_c\u00f3_kh\u1ea3_n\u0103ng_gi\u00e1m_s\u00e1t_v\u00e0_kh\u00f4i_ph\u1ee5c_l\u1ed7i\"><a id=\"post-120759-_8lbecf9lberm\"><\/a>Kh\u00f4ng c\u00f3 kh\u1ea3 n\u0103ng gi\u00e1m s\u00e1t v\u00e0 kh\u00f4i ph\u1ee5c l\u1ed7i<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p>Cronjob kh\u00f4ng cung c\u1ea5p giao di\u1ec7n \u0111\u1ec3 theo d\u00f5i tr\u1ea1ng th\u00e1i t\u00e1c v\u1ee5. Khi m\u1ed9t job th\u1ea5t b\u1ea1i, b\u1ea1n ch\u1ec9 bi\u1ebft th\u00f4ng qua log h\u1ec7 th\u1ed1ng \u2013 \u0111i\u1ec1u n\u00e0y khi\u1ebfn vi\u1ec7c ki\u1ec3m tra th\u1ee7 c\u00f4ng r\u1ea5t t\u1ed1n th\u1eddi gian.<\/p>\n\n\n\n<h4 id=\"Kh\u00f3_m\u1edf_r\u1ed9ng_v\u00e0_thi\u1ebfu_t\u00ednh_linh_ho\u1ea1t\"><a id=\"post-120759-_1v24bf9ys7da\"><\/a>Kh\u00f3 m\u1edf r\u1ed9ng v\u00e0 thi\u1ebfu t\u00ednh linh ho\u1ea1t<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p>Cronjob ho\u1ea1t \u0111\u1ed9ng t\u1ed1t tr\u00ean m\u1ed9t m\u00e1y ch\u1ee7 \u0111\u01a1n, nh\u01b0ng khi h\u1ec7 th\u1ed1ng c\u1ea7n m\u1edf r\u1ed9ng sang nhi\u1ec1u server ho\u1eb7c m\u00f4i tr\u01b0\u1eddng cloud, vi\u1ec7c \u0111\u1ed3ng b\u1ed9 v\u00e0 qu\u1ea3n l\u00fd Cronjob tr\u1edf n\u00ean ph\u1ee9c t\u1ea1p.<\/p>\n\n\n\n<h4 id=\"Kh\u00f4ng_h\u1ed7_tr\u1ee3_theo_d\u00f5i_ph\u1ee5_thu\u1ed9c_d\u1eef_li\u1ec7u\"><a id=\"post-120759-_u7lvk5wowvui\"><\/a>Kh\u00f4ng h\u1ed7 tr\u1ee3 theo d\u00f5i ph\u1ee5 thu\u1ed9c d\u1eef li\u1ec7u<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p>Cronjob kh\u00f4ng c\u00f3 c\u01a1 ch\u1ebf \u0111\u1ec3 \u0111\u1ea3m b\u1ea3o r\u1eb1ng d\u1eef li\u1ec7u \u0111\u1ea7u v\u00e0o \u0111\u00e3 s\u1eb5n s\u00e0ng tr\u01b0\u1edbc khi ch\u1ea1y job. \u0110i\u1ec1u n\u00e0y \u0111\u1eb7c bi\u1ec7t nguy hi\u1ec3m trong c\u00e1c pipeline d\u1eef li\u1ec7u l\u1edbn, n\u01a1i m\u1ed9t sai s\u00f3t nh\u1ecf c\u00f3 th\u1ec3 l\u00e0m h\u1ecfng to\u00e0n b\u1ed9 k\u1ebft qu\u1ea3.<\/p>\n\n\n\n<h4 id=\"Kh\u00f3_b\u1ea3o_tr\u00ec_v\u00e0_m\u1edf_r\u1ed9ng_quy_tr\u00ecnh_theo_th\u1eddi_gian\"><a id=\"post-120759-_6cbqitwji6d8\"><\/a>Kh\u00f3 b\u1ea3o tr\u00ec v\u00e0 m\u1edf r\u1ed9ng quy tr\u00ecnh theo th\u1eddi gian<\/h4>\n\n\n\n<p><\/p>\n\n\n\n<p>Khi s\u1ed1 l\u01b0\u1ee3ng Cronjob t\u0103ng l\u00ean h\u00e0ng ch\u1ee5c ho\u1eb7c h\u00e0ng tr\u0103m, vi\u1ec7c b\u1ea3o tr\u00ec, c\u1eadp nh\u1eadt ho\u1eb7c thay \u0111\u1ed5i logic tr\u1edf th\u00e0nh \u201c\u00e1c m\u1ed9ng\u201d. C\u00e1c script n\u1eb1m r\u1ea3i r\u00e1c, thi\u1ebfu c\u1ea5u tr\u00fac, v\u00e0 kh\u00f4ng th\u1ec3 d\u1ec5 d\u00e0ng t\u00e1i s\u1eed d\u1ee5ng.<\/p>\n\n\n\n<h2 id=\"C\u00e1c_t\u00ednh_n\u0103ng_n\u1ed5i_b\u1eadt_c\u1ee7a_Airflow\"><a id=\"post-120759-_ijwgn3lkk446\"><\/a>C\u00e1c t\u00ednh n\u0103ng n\u1ed5i b\u1eadt c\u1ee7a Airflow<\/h2>\n\n\n\n<h3 id=\"Tri\u1ebft_l\u00fd_&#8220;Workflows_as_Code&#8221;_\"><a id=\"post-120759-_1x7jv5pn9z7c\"><\/a><strong>Tri\u1ebft l\u00fd &#8220;Workflows as Code&#8221; <\/strong><\/h3>\n\n\n\n<p>Thay v\u00ec d\u00f9ng giao di\u1ec7n k\u00e9o &#8211; th\u1ea3 b\u1ecb gi\u1edbi h\u1ea1n, b\u1ea1n \u0111\u1ecbnh ngh\u0129a to\u00e0n b\u1ed9 quy tr\u00ecnh c\u00f4ng vi\u1ec7c b\u1eb1ng Python. \u0110i\u1ec1u n\u00e0y m\u1edf ra v\u00f4 s\u1ed1 kh\u1ea3 n\u0103ng:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Qu\u1ea3n l\u00fd phi\u00ean b\u1ea3n:<\/strong> B\u1ea1n c\u00f3 th\u1ec3 \u0111\u01b0a c\u00e1c pipeline c\u1ee7a m\u00ecnh v\u00e0o Git. \u0110i\u1ec1u n\u00e0y cho ph\u00e9p b\u1ea1n theo d\u00f5i l\u1ecbch s\u1eed thay \u0111\u1ed5i (ai, khi n\u00e0o, t\u1ea1i sao), xem x\u00e9t code (code reviews), v\u00e0 d\u1ec5 d\u00e0ng ho\u00e0n t\u00e1c (rollback) khi c\u00f3 l\u1ed7i.<\/li>\n\n\n\n<li><strong>T\u1ea1o Pipeline \u0111\u1ed9ng: <\/strong>B\u1ea1n c\u00f3 th\u1ec3 d\u00f9ng code Python \u0111\u1ec3 t\u1ef1 \u0111\u1ed9ng t\u1ea1o ra h\u00e0ng tr\u0103m pipeline gi\u1ed1ng nhau t\u1eeb m\u1ed9t t\u1ec7p c\u1ea5u h\u00ecnh, thay v\u00ec t\u1ea1o th\u1ee7 c\u00f4ng.<\/li>\n\n\n\n<li><strong>D\u1ec5 ki\u1ec3m th\u1eed: <\/strong>V\u00ec pipeline l\u00e0 code, b\u1ea1n c\u00f3 th\u1ec3 vi\u1ebft c\u00e1c b\u00e0i ki\u1ec3m th\u1eed (unit tests) cho ch\u00fang, \u0111\u1ea3m b\u1ea3o logic nghi\u1ec7p v\u1ee5 ch\u00ednh x\u00e1c tr\u01b0\u1edbc khi tri\u1ec3n khai.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Gi\u00e1m_s\u00e1t_tr\u1ef1c_quan_v\u00e0_minh_b\u1ea1ch\"><a id=\"post-120759-_3jzo248j9gpn\"><\/a><strong>Gi\u00e1m s\u00e1t tr\u1ef1c quan v\u00e0 minh b\u1ea1ch<\/strong><\/h3>\n\n\n\n<p>Airflow thay th\u1ebf &#8220;h\u1ed9p \u0111en&#8221; c\u1ee7a c\u00e1c script Cronjob b\u1eb1ng m\u1ed9t Giao di\u1ec7n Ng\u01b0\u1eddi d\u00f9ng (UI) m\u1ea1nh m\u1ebd, n\u01a1i b\u1ea1n c\u00f3 th\u1ec3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Theo d\u00f5i th\u1eddi gian th\u1ef1c: <\/strong>Tr\u1ef1c quan h\u00f3a tr\u1ea1ng th\u00e1i c\u1ee7a m\u1ecdi DAG v\u00e0 m\u1ecdi Task (\u0111ang ch\u1ea1y, th\u00e0nh c\u00f4ng, th\u1ea5t b\u1ea1i, \u0111ang ch\u1edd th\u1eed l\u1ea1i).<\/li>\n\n\n\n<li><strong>Xem log t\u1eadp trung: <\/strong>\u0110\u1ecdc log l\u1ed7i c\u1ee7a b\u1ea5t k\u1ef3 task n\u00e0o ngay tr\u00ean UI m\u00e0 kh\u00f4ng c\u1ea7n ph\u1ea3i SSH v\u00e0o nhi\u1ec1u m\u00e1y ch\u1ee7 \u0111\u1ec3 t\u00ecm file log.<\/li>\n\n\n\n<li><strong>Hi\u1ec3u r\u00f5 s\u1ef1 ph\u1ee5 thu\u1ed9c: <\/strong>Xem bi\u1ec3u \u0111\u1ed3 v\u00e0 c\u1ea5u tr\u00fac c\u00e2y \u0111\u1ec3 hi\u1ec3u r\u00f5 task n\u00e0o ph\u1ea3i ch\u1ea1y tr\u01b0\u1edbc, task n\u00e0o ch\u1ea1y sau.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-3.png\" alt=\"C\u00e1c t\u00ednh n\u0103ng n\u1ed5i b\u1eadt c\u1ee7a Airflow\" class=\"wp-image-120762\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-3.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-3-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>C\u00e1c t\u00ednh n\u0103ng n\u1ed5i b\u1eadt c\u1ee7a Airflow<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"Kh\u1ea3_n\u0103ng_ph\u1ee5c_h\u1ed3i_l\u1ed7i_m\u1ea1nh_m\u1ebd\"><a id=\"post-120759-_d7fxfpz3raqe\"><\/a><strong>Kh\u1ea3 n\u0103ng ph\u1ee5c h\u1ed3i l\u1ed7i m\u1ea1nh m\u1ebd<\/strong><\/h3>\n\n\n\n<p>Trong th\u1ef1c t\u1ebf, c\u00e1c quy tr\u00ecnh d\u1eef li\u1ec7u r\u1ea5t &#8220;mong manh&#8221; (m\u1ea1ng l\u1ed7i, API s\u1eadp, d\u1eef li\u1ec7u \u0111\u1ebfn tr\u1ec5). Airflow \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf v\u1edbi t\u00e2m th\u1ebf ch\u1ea5p nh\u1eadn th\u1ea5t b\u1ea1i v\u00e0 x\u1eed l\u00fd ch\u00fang m\u1ed9t c\u00e1ch th\u00f4ng minh:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>T\u1ef1 \u0111\u1ed9ng th\u1eed l\u1ea1i: <\/strong>T\u1ef1 \u0111\u1ed9ng ch\u1ea1y l\u1ea1i c\u00e1c task th\u1ea5t b\u1ea1i theo s\u1ed1 l\u1ea7n v\u00e0 kho\u1ea3ng th\u1eddi gian ch\u1edd b\u1ea1n \u0111\u1ecbnh ngh\u0129a (v\u00ed d\u1ee5: &#8220;th\u1eed l\u1ea1i 3 l\u1ea7n, m\u1ed7i l\u1ea7n c\u00e1ch nhau 5 ph\u00fat&#8221;).<\/li>\n\n\n\n<li><strong>C\u1ea3nh b\u00e1o t\u1ef1 \u0111\u1ed9ng: <\/strong>T\u00edch h\u1ee3p s\u1eb5n c\u01a1 ch\u1ebf g\u1eedi email ho\u1eb7c tin nh\u1eafn (qua Slack, Teams) khi m\u1ed9t task quan tr\u1ecdng th\u1ea5t b\u1ea1i v\u0129nh vi\u1ec5n.<\/li>\n<\/ul>\n\n\n\n<h3 id=\"Kh\u1ea3_n\u0103ng_m\u1edf_r\u1ed9ng_v\u01b0\u1ee3t_tr\u1ed9i\"><a id=\"post-120759-_rssqkk5vjoa2\"><\/a><strong>Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u01b0\u1ee3t tr\u1ed9i<\/strong><\/h3>\n\n\n\n<p>Airflow c\u00f3 th\u1ec3 ph\u00e1t tri\u1ec3n t\u1eeb vi\u1ec7c ch\u1ea1y v\u00e0i t\u00e1c v\u1ee5 tr\u00ean m\u00e1y t\u00ednh c\u00e1 nh\u00e2n c\u1ee7a b\u1ea1n l\u00ean \u0111\u1ebfn \u0111i\u1ec1u ph\u1ed1i h\u00e0ng ch\u1ee5c ng\u00e0n t\u00e1c v\u1ee5 ph\u1ee9c t\u1ea1p m\u1ed7i ng\u00e0y tr\u00ean m\u1ed9t c\u1ee5m m\u00e1y ch\u1ee7:<\/p>\n\n\n\n<p>V\u1edbi ki\u1ebfn tr\u00fac ph\u00e2n t\u00e1n, Airflow c\u00f3 th\u1ec3 \u0111\u01b0\u1ee3c thi\u1ebft l\u1eadp \u0111\u1ec3 ph\u00e2n ph\u1ed1i c\u00f4ng vi\u1ec7c (tasks) cho m\u1ed9t &#8220;h\u1ea1m \u0111\u1ed9i&#8221; c\u00e1c m\u00e1y tr\u1ea1m (Workers) th\u00f4ng qua c\u00e1c Executor nh\u01b0 Celery ho\u1eb7c Kubernetes, \u0111\u1ea3m b\u1ea3o h\u1ec7 th\u1ed1ng kh\u00f4ng b\u1ecb qu\u00e1 t\u1ea3i.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-9.png\" alt=\"Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u01b0\u1ee3t tr\u1ed9i\" class=\"wp-image-120772\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-9.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-9-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>Kh\u1ea3 n\u0103ng m\u1edf r\u1ed9ng v\u01b0\u1ee3t tr\u1ed9i<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"Kh\u1ea3_n\u0103ng_ch\u1ea1y_l\u1ea1i_l\u1ecbch_s\u1eed\"><a id=\"post-120759-_dauizkcoozzz\"><\/a><strong>Kh\u1ea3 n\u0103ng ch\u1ea1y l\u1ea1i l\u1ecbch s\u1eed<\/strong><\/h3>\n\n\n\n<p>N\u1ebfu b\u1ea1n ph\u00e1t hi\u1ec7n m\u1ed9t l\u1ed7i logic trong code v\u00e0 c\u1ea7n x\u1eed l\u00fd l\u1ea1i d\u1eef li\u1ec7u c\u1ee7a 2 tu\u1ea7n qua, Airflow cho ph\u00e9p b\u1ea1n l\u00e0m \u0111i\u1ec1u n\u00e0y m\u1ed9t c\u00e1ch d\u1ec5 d\u00e0ng. B\u1ea1n ch\u1ec9 c\u1ea7n ra l\u1ec7nh cho Airflow &#8220;ch\u1ea1y l\u1ea1i&#8221; (backfill) c\u00e1c DAG trong kho\u1ea3ng th\u1eddi gian \u0111\u00f3, v\u00e0 n\u00f3 s\u1ebd t\u1ef1 \u0111\u1ed9ng l\u1eadp l\u1ecbch v\u00e0 th\u1ef1c thi l\u1ea1i m\u1ecdi th\u1ee9 theo \u0111\u00fang th\u1ee9 t\u1ef1.<\/p>\n\n\n\n<h3 id=\"H\u1ec7_sinh_th\u00e1i_v\u00e0_t\u00edch_h\u1ee3p\"><a id=\"post-120759-_72vui91g3or3\"><\/a><strong>H\u1ec7 sinh th\u00e1i v\u00e0 t\u00edch h\u1ee3p<\/strong><\/h3>\n\n\n\n<p>Airflow l\u00e0 m\u1ed9t d\u1ef1 \u00e1n m\u00e3 ngu\u1ed3n m\u1edf h\u00e0ng \u0111\u1ea7u v\u1edbi m\u1ed9t c\u1ed9ng \u0111\u1ed3ng kh\u1ed5ng l\u1ed3. L\u1ee3i \u00edch l\u00e0 b\u1ea1n c\u00f3 m\u1ed9t th\u01b0 vi\u1ec7n &#8220;Provider&#8221; (nh\u00e0 cung c\u1ea5p) kh\u1ed5ng l\u1ed3, cung c\u1ea5p c\u00e1c Operator \u0111\u01b0\u1ee3c x\u00e2y d\u1ef1ng s\u1eb5n \u0111\u1ec3 k\u1ebft n\u1ed1i v\u00e0 \u0111i\u1ec1u khi\u1ec3n g\u1ea7n nh\u01b0 m\u1ecdi d\u1ecbch v\u1ee5 b\u00ean ngo\u00e0i (AWS S3, Google BigQuery, Snowflake, Databricks, Spark,&#8230;), gi\u00fap b\u1ea1n ti\u1ebft ki\u1ec7m v\u00f4 s\u1ed1 th\u1eddi gian t\u00edch h\u1ee3p.<\/p>\n\n\n\n<h2 id=\"Kh\u00e1m_ph\u00e1_c\u00e1c_th\u00e0nh_ph\u1ea7n_c\u1ed1t_l\u00f5i_v\u00e0_nguy\u00ean_l\u00fd_ho\u1ea1t_\u0111\u1ed9ng_c\u1ee7a_Airflow_\"><a id=\"post-120759-_59mfzd6zdlk3\"><\/a>Kh\u00e1m ph\u00e1 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i v\u00e0 nguy\u00ean l\u00fd ho\u1ea1t \u0111\u1ed9ng c\u1ee7a Airflow <\/h2>\n\n\n\n<h3 id=\"3_kh\u00e1i_ni\u1ec7m_c\u1ed1t_l\u00f5i_trong_Airflow\"><a id=\"post-120759-_pve87olsdqs8\"><\/a><strong>3 kh\u00e1i ni\u1ec7m c\u1ed1t l\u00f5i trong Airflow<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 nh\u1eefng kh\u1ed1i x\u00e2y d\u1ef1ng b\u1ea1n s\u1eed d\u1ee5ng trong t\u1ec7p Python \u0111\u1ec3 \u0111\u1ecbnh ngh\u0129a quy tr\u00ecnh:<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">1. DAG (Directed Acyclic Graph):<\/span><\/strong><\/p>\n\n\n\n<p>\u0110\u00e2y l\u00e0 &#8220;b\u1ea3n thi\u1ebft k\u1ebf&#8221; cho quy tr\u00ecnh l\u00e0m vi\u1ec7c (workflow) c\u1ee7a b\u1ea1n. N\u00f3 l\u00e0 m\u1ed9t t\u1ec7p Python \u0111\u1ecbnh ngh\u0129a:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><em>T\u1eadp h\u1ee3p c\u00e1c Task<\/em> b\u1ea1n mu\u1ed1n ch\u1ea1y.<\/li>\n\n\n\n<li><em>M\u1ed1i quan h\u1ec7 ph\u1ee5 thu\u1ed9c<\/em> gi\u1eefa ch\u00fang (v\u00ed d\u1ee5: Task B ch\u1ec9 ch\u1ea1y sau Task A).<\/li>\n\n\n\n<li><em>L\u1ecbch tr\u00ecnh<\/em> ch\u1ea1y (v\u00ed d\u1ee5: ch\u1ea1y h\u00e0ng ng\u00e0y l\u00fac 3 gi\u1edd s\u00e1ng).<\/li>\n<\/ul>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">2. Operators (To\u00e1n t\u1eed):<\/span><\/strong><\/p>\n\n\n\n<p>\u0110\u00e2y l\u00e0 c\u00e1c &#8220;kh\u1ed1i x\u00e2y d\u1ef1ng&#8221; (building blocks) \u0111\u1ecbnh ngh\u0129a <em>m\u1ed9t<\/em> c\u00f4ng vi\u1ec7c c\u1ee5 th\u1ec3 ph\u1ea3i l\u00e0m. Khi b\u1ea1n th\u00eam m\u1ed9t Operator v\u00e0o DAG, b\u1ea1n \u0111ang t\u1ea1o ra m\u1ed9t Task. V\u00ed d\u1ee5 ph\u1ed5 bi\u1ebfn:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>BashOperator: Ch\u1ea1y m\u1ed9t l\u1ec7nh shell (v\u00ed d\u1ee5: echo &#8216;hello&#8217;).<\/li>\n\n\n\n<li>PythonOperator: Ch\u1ea1y m\u1ed9t h\u00e0m Python.<\/li>\n\n\n\n<li>PostgresOperator: Ch\u1ea1y m\u1ed9t truy v\u1ea5n SQL tr\u00ean Postgres.<\/li>\n\n\n\n<li>&#8230;Operator: C\u00f3 h\u00e0ng tr\u0103m Operator \u0111\u1ec3 t\u01b0\u01a1ng t\u00e1c v\u1edbi AWS, Google Cloud, Snowflake, v.v.<\/li>\n<\/ul>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">3. Task (Nhi\u1ec7m v\u1ee5):<\/span><\/strong><\/p>\n\n\n\n<p>M\u1ed9t Task l\u00e0 m\u1ed9t <em>b\u1ea3n th\u1ec3 hi\u1ec7n (instance)<\/em> c\u1ee7a m\u1ed9t Operator. N\u00f3 l\u00e0 m\u1ed9t n\u00fat (node) trong DAG, \u0111\u1ea1i di\u1ec7n cho m\u1ed9t \u0111\u01a1n v\u1ecb c\u00f4ng vi\u1ec7c c\u1ea7n \u0111\u01b0\u1ee3c th\u1ef1c thi.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-4.png\" alt=\"Kh\u00e1m ph\u00e1 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i c\u1ee7a Airflow v\u00e0 nguy\u00ean l\u00fd ho\u1ea1t \u0111\u1ed9ng\" class=\"wp-image-120763\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-4.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-4-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>Kh\u00e1m ph\u00e1 c\u00e1c th\u00e0nh ph\u1ea7n c\u1ed1t l\u00f5i v\u00e0 nguy\u00ean l\u00fd ho\u1ea1t \u0111\u1ed9ng <strong>c\u1ee7a Airflow <\/strong><\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"5_th\u00e0nh_ph\u1ea7n_ki\u1ebfn_tr\u00fac_h\u1ec7_th\u1ed1ng\"><a id=\"post-120759-_tmbwn3a07a4y\"><\/a><strong>5 th\u00e0nh ph\u1ea7n ki\u1ebfn tr\u00fac h\u1ec7 th\u1ed1ng<\/strong><\/h3>\n\n\n\n<p>D\u01b0\u1edbi \u0111\u00e2y l\u00e0 4 d\u1ecbch v\u1ee5 ch\u00ednh ch\u1ea1y li\u00ean t\u1ee5c \u0111\u1ec3 Airflow c\u1ee7a b\u1ea1n ho\u1ea1t \u0111\u1ed9ng:<\/p>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">1. Scheduler (B\u1ed9 l\u1eadp l\u1ecbch): <\/span><\/strong><\/p>\n\n\n\n<p>Scheduler l\u00e0 m\u1ed9t d\u1ecbch v\u1ee5 ch\u1ea1y li\u00ean t\u1ee5c, c\u00f3 c\u00e1c nhi\u1ec7m v\u1ee5 ch\u00ednh bao g\u1ed3m:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Qu\u00e9t th\u01b0 m\u1ee5c ch\u1ee9a c\u00e1c t\u1ec7p DAG c\u1ee7a b\u1ea1n \u0111\u1ec3 ph\u00e1t hi\u1ec7n thay \u0111\u1ed5i.<\/li>\n\n\n\n<li>Ki\u1ec3m tra l\u1ecbch tr\u00ecnh (schedule) c\u1ee7a t\u1ea5t c\u1ea3 c\u00e1c DAG.<\/li>\n\n\n\n<li>Khi \u0111\u1ebfn th\u1eddi \u0111i\u1ec3m ch\u1ea1y, n\u00f3 s\u1ebd t\u1ea1o m\u1ed9t b\u1ea3n th\u1ec3 hi\u1ec7n (instance) c\u1ee7a DAG (g\u1ecdi l\u00e0 DagRun).<\/li>\n\n\n\n<li>Theo d\u00f5i s\u1ef1 ph\u1ee5 thu\u1ed9c c\u1ee7a c\u00e1c Task (nhi\u1ec7m v\u1ee5).<\/li>\n\n\n\n<li>G\u1eedi c\u00e1c Task s\u1eb5n s\u00e0ng th\u1ef1c thi (\u0111\u00e3 \u0111\u1ee7 \u0111i\u1ec1u ki\u1ec7n) v\u00e0o h\u00e0ng \u0111\u1ee3i.<\/li>\n<\/ul>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">2. Web Server (M\u00e1y ch\u1ee7 Web):<\/span><\/strong><\/p>\n\n\n\n<p>Web Server cung c\u1ea5p giao di\u1ec7n ng\u01b0\u1eddi d\u00f9ng (UI) tr\u1ef1c quan m\u00e0 b\u1ea1n t\u01b0\u01a1ng t\u00e1c. Th\u00f4ng qua UI, b\u1ea1n c\u00f3 th\u1ec3:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Gi\u00e1m s\u00e1t tr\u1ea1ng th\u00e1i c\u1ee7a c\u00e1c DAG v\u00e0 Task (th\u00e0nh c\u00f4ng, th\u1ea5t b\u1ea1i, \u0111ang ch\u1ea1y).<\/li>\n\n\n\n<li>K\u00edch ho\u1ea1t (trigger) ho\u1eb7c h\u1ee7y b\u1ecf m\u1ed9t DAG ch\u1ea1y b\u1eb1ng tay.<\/li>\n\n\n\n<li>Xem log l\u1ed7i chi ti\u1ebft c\u1ee7a t\u1eebng Task.<\/li>\n\n\n\n<li>Qu\u1ea3n l\u00fd c\u00e1c k\u1ebft n\u1ed1i, bi\u1ebfn v\u00e0 ng\u01b0\u1eddi d\u00f9ng.<\/li>\n<\/ul>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">3. Metadata Database (C\u01a1 s\u1edf d\u1eef li\u1ec7u Si\u00eau d\u1eef li\u1ec7u):<\/span><\/strong><\/p>\n\n\n\n<p>Metadata Database l\u01b0u tr\u1eef <em>m\u1ecdi<\/em> tr\u1ea1ng th\u00e1i v\u00e0 th\u00f4ng tin v\u1ec1 h\u1ec7 th\u1ed1ng c\u1ee7a b\u1ea1n (th\u01b0\u1eddng d\u00f9ng Postgres ho\u1eb7c MySQL). C\u01a1 s\u1edf d\u1eef li\u1ec7u n\u00e0y c\u00f3 th\u1ec3 l\u01b0u tr\u1eef:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>T\u1ea5t c\u1ea3 c\u00e1c DAG v\u00e0 c\u1ea5u tr\u00fac c\u1ee7a ch\u00fang.<\/li>\n\n\n\n<li>L\u1ecbch s\u1eed c\u1ee7a t\u1ea5t c\u1ea3 c\u00e1c l\u1ea7n ch\u1ea1y (DagRun).<\/li>\n\n\n\n<li>Tr\u1ea1ng th\u00e1i c\u1ee7a t\u1eebng Task (task instances).<\/li>\n\n\n\n<li>C\u00e1c bi\u1ebfn, k\u1ebft n\u1ed1i (connections) \u0111\u1ebfn h\u1ec7 th\u1ed1ng b\u00ean ngo\u00e0i, v\u00e0 th\u00f4ng tin ng\u01b0\u1eddi d\u00f9ng.<\/li>\n\n\n\n<li><em>(L\u01b0u \u00fd: Scheduler, Web Server v\u00e0 Workers \u0111\u1ec1u giao ti\u1ebfp qua c\u01a1 s\u1edf d\u1eef li\u1ec7u n\u00e0y).<\/em><\/li>\n<\/ul>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">4. Executor (B\u1ed9 th\u1ef1c thi):<\/span><\/strong><\/p>\n\n\n\n<p>Executor l\u00e0 c\u01a1 ch\u1ebf ch\u1ecbu tr\u00e1ch nhi\u1ec7m ch\u1ea1y c\u00e1c Task. Khi Scheduler quy\u1ebft \u0111\u1ecbnh m\u1ed9t Task c\u1ea7n ch\u1ea1y, n\u00f3 s\u1ebd \u0111\u01b0a cho Executor:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>LocalExecutor:<\/strong> Ch\u1ea1y c\u00e1c Task song song tr\u00ean c\u00f9ng m\u1ed9t m\u00e1y ch\u1ee7 n\u01a1i Scheduler \u0111ang ch\u1ea1y (d\u00f9ng cho quy m\u00f4 nh\u1ecf).<\/li>\n\n\n\n<li><strong>CeleryExecutor \/ KubernetesExecutor:<\/strong> Ph\u00e2n ph\u1ed1i c\u00e1c Task \u0111\u1ebfn m\u1ed9t c\u1ee5m (cluster) g\u1ed3m nhi\u1ec1u m\u00e1y tr\u1ea1m (Workers). \u0110\u00e2y l\u00e0 c\u00e1ch Airflow m\u1edf r\u1ed9ng quy m\u00f4 (scalability) \u0111\u1ec3 ch\u1ea1y h\u00e0ng ng\u00e0n Task c\u00f9ng l\u00fac.<\/li>\n<\/ul>\n\n\n\n<p><strong><span style=\"text-decoration: underline;\">5. Worker (m\u00e1y ch\u1ea1m):<\/span><\/strong><\/p>\n\n\n\n<p>Worker l\u00e0 c\u00e1c m\u00e1y ch\u1ea1m \u0111\u1ea3m nhi\u1ec7m ch\u1ea1y c\u00e1c t\u00e1c v\u1ee5 \u0111\u01b0\u1ee3c giao trong Executor. Trong m\u00f4 h\u00ecnh ph\u00e2n t\u00e1n, b\u1ea1n c\u00f3 th\u1ec3 c\u00f3 nhi\u1ec1u Worker ho\u1ea1t \u0111\u1ed9ng song song, gi\u00fap h\u1ec7 th\u1ed1ng x\u1eed l\u00fd h\u00e0ng ngh\u00ecn c\u00f4ng vi\u1ec7c m\u1ed7i ph\u00fat.<\/p>\n\n\n\n<p>N\u1ebfu m\u1ed9t Worker b\u1ecb l\u1ed7i, c\u00e1c Worker kh\u00e1c c\u00f3 th\u1ec3 t\u1ef1 \u0111\u1ed9ng ti\u1ebfp qu\u1ea3n nhi\u1ec7m v\u1ee5, \u0111\u1ea3m b\u1ea3o quy tr\u00ecnh kh\u00f4ng b\u1ecb gi\u00e1n \u0111o\u1ea1n.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-5-1.png\" alt=\"5 th\u00e0nh ph\u1ea7n ki\u1ebfn tr\u00fac h\u1ec7 th\u1ed1ng\" class=\"wp-image-120767\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-5-1.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-5-1-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>5 th\u00e0nh ph\u1ea7n ki\u1ebfn tr\u00fac h\u1ec7 th\u1ed1ng<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"Nguy\u00ean_l\u00fd_ho\u1ea1t_\u0111\u1ed9ng_t\u1ed5ng_th\u1ec3_c\u1ee7a_Airflow\"><a id=\"post-120759-_q2fxh1id2w4z\"><\/a><strong>Nguy\u00ean l\u00fd ho\u1ea1t \u0111\u1ed9ng t\u1ed5ng th\u1ec3 c\u1ee7a Airflow<\/strong><\/h3>\n\n\n\n<p>Qu\u00e1 tr\u00ecnh ho\u1ea1t \u0111\u1ed9ng c\u01a1 b\u1ea3n c\u1ee7a Airflow c\u00f3 th\u1ec3 t\u00f3m t\u1eaft theo chu tr\u00ecnh sau:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Scheduler<\/strong> \u0111\u1ecdc c\u00e1c DAG \u0111\u1ecbnh ngh\u0129a b\u1eb1ng Python v\u00e0 l\u00ean l\u1ecbch th\u1ef1c thi d\u1ef1a tr\u00ean th\u1eddi gian \u0111\u01b0\u1ee3c c\u1ea5u h\u00ecnh.<\/li>\n\n\n\n<li>Khi \u0111\u1ebfn th\u1eddi \u0111i\u1ec3m, Scheduler s\u1ebd g\u1eedi task v\u00e0o <strong>Executor<\/strong>.<\/li>\n\n\n\n<li><strong>Executor<\/strong> ph\u00e2n ph\u1ed1i task \u0111\u1ebfn c\u00e1c <strong>Worker<\/strong> ph\u00f9 h\u1ee3p \u0111\u1ec3 th\u1ef1c thi.<\/li>\n\n\n\n<li>K\u1ebft qu\u1ea3 v\u00e0 log \u0111\u01b0\u1ee3c ghi l\u1ea1i trong <strong>Metadata Database<\/strong>.<\/li>\n\n\n\n<li>Ng\u01b0\u1eddi d\u00f9ng c\u00f3 th\u1ec3 theo d\u00f5i to\u00e0n b\u1ed9 ti\u1ebfn tr\u00ecnh qua <strong>Web Server UI<\/strong>.<\/li>\n<\/ol>\n\n\n\n<p>Nh\u1edd m\u00f4 h\u00ecnh n\u00e0y, Airflow c\u00f3 th\u1ec3 <strong>\u0111i\u1ec1u ph\u1ed1i h\u00e0ng ngh\u00ecn workflow \u0111\u1ed3ng th\u1eddi<\/strong>, \u0111\u1ea3m b\u1ea3o m\u1ed7i t\u00e1c v\u1ee5 \u0111\u01b0\u1ee3c ch\u1ea1y \u0111\u00fang th\u1eddi \u0111i\u1ec3m, \u0111\u00fang th\u1ee9 t\u1ef1 v\u00e0 c\u00f3 th\u1ec3 ph\u1ee5c h\u1ed3i n\u1ebfu x\u1ea3y ra l\u1ed7i.<\/p>\n\n\n\n<h2 id=\"T\u1ea1i_sao_doanh_nghi\u1ec7p_n\u00ean_s\u1eed_d\u1ee5ng_Airflow?\"><a id=\"post-120759-_rpts3pej5fy2\"><\/a><strong>T\u1ea1i sao doanh nghi\u1ec7p n\u00ean s\u1eed d\u1ee5ng Airflow?<\/strong><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Th\u00fac \u0111\u1ea9y chuy\u1ec3n \u0111\u1ed5i s\u1ed1 v\u00e0 ra quy\u1ebft \u0111\u1ecbnh nhanh h\u01a1n: <\/strong>Airflow gi\u00fap t\u1ef1 \u0111\u1ed9ng h\u00f3a to\u00e0n b\u1ed9 quy tr\u00ecnh x\u1eed l\u00fd d\u1eef li\u1ec7u \u2013 t\u1eeb thu th\u1eadp, l\u00e0m s\u1ea1ch, t\u1ed5ng h\u1ee3p \u0111\u1ebfn ph\u00e2n t\u00edch. Nh\u1edd \u0111\u00f3, doanh nghi\u1ec7p c\u00f3 th\u1ec3 c\u1eadp nh\u1eadt d\u1eef li\u1ec7u theo th\u1eddi gian th\u1ef1c v\u00e0 ra quy\u1ebft \u0111\u1ecbnh nhanh, ch\u00ednh x\u00e1c h\u01a1n, thay v\u00ec ph\u1ea3i t\u1ed5ng h\u1ee3p th\u1ee7 c\u00f4ng.<\/li>\n\n\n\n<li><strong>Chu\u1ea9n h\u00f3a v\u00e0 minh b\u1ea1ch h\u00f3a quy tr\u00ecnh d\u1eef li\u1ec7u: <\/strong>Airflow h\u1ee3p nh\u1ea5t c\u00e1c t\u00e1c v\u1ee5 d\u1eef li\u1ec7u r\u1ea3i r\u00e1c trong nhi\u1ec1u h\u1ec7 th\u1ed1ng th\u00e0nh m\u1ed9t n\u1ec1n t\u1ea3ng th\u1ed1ng nh\u1ea5t, gi\u00fap ghi log, theo d\u00f5i v\u00e0 ki\u1ec3m so\u00e1t d\u1ec5 d\u00e0ng. \u0110i\u1ec1u n\u00e0y \u0111\u1ea3m b\u1ea3o t\u00ednh minh b\u1ea1ch, truy xu\u1ea5t ngu\u1ed3n d\u1eef li\u1ec7u r\u00f5 r\u00e0ng v\u00e0 \u0111\u00e1p \u1ee9ng y\u00eau c\u1ea7u tu\u00e2n th\u1ee7, b\u1ea3o m\u1eadt.<\/li>\n\n\n\n<li><strong>Gi\u1ea3m thi\u1ec3u sai s\u00f3t v\u00e0 r\u1ee7i ro con ng\u01b0\u1eddi: <\/strong>V\u1edbi kh\u1ea3 n\u0103ng t\u1ef1 \u0111\u1ed9ng h\u00f3a pipeline v\u00e0 ki\u1ec3m so\u00e1t \u0111i\u1ec1u ki\u1ec7n ch\u1ea1y, Airflow lo\u1ea1i b\u1ecf l\u1ed7i thao t\u00e1c th\u1ee7 c\u00f4ng. C\u01a1 ch\u1ebf retry v\u00e0 c\u1ea3nh b\u00e1o th\u00f4ng minh gi\u00fap ph\u00e1t hi\u1ec7n, x\u1eed l\u00fd l\u1ed7i s\u1edbm, tr\u00e1nh gi\u00e1n \u0111o\u1ea1n to\u00e0n h\u1ec7 th\u1ed1ng.<\/li>\n\n\n\n<li><strong>Linh ho\u1ea1t m\u1edf r\u1ed9ng theo quy m\u00f4 doanh nghi\u1ec7p: <\/strong>Airflow d\u1ec5 d\u00e0ng m\u1edf r\u1ed9ng t\u1eeb m\u1ed9t m\u00e1y ch\u1ee7 nh\u1ecf \u0111\u1ebfn h\u1ea1 t\u1ea7ng ph\u00e2n t\u00e1n ho\u1eb7c cloud-native. Nh\u1edd ki\u1ebfn tr\u00fac m\u00f4-\u0111un (Scheduler \u2013 Worker \u2013 Executor), doanh nghi\u1ec7p c\u00f3 th\u1ec3 t\u00edch h\u1ee3p v\u1edbi AWS, GCP, Kubernetes m\u00e0 kh\u00f4ng c\u1ea7n thay \u0111\u1ed5i quy tr\u00ecnh.<\/li>\n\n\n\n<li><strong>H\u1ee3p nh\u1ea5t to\u00e0n b\u1ed9 h\u1ec7 sinh th\u00e1i d\u1eef li\u1ec7u: <\/strong>Airflow \u0111\u00f3ng vai tr\u00f2 \u201ctrung t\u00e2m \u0111i\u1ec1u ph\u1ed1i\u201d, k\u1ebft n\u1ed1i c\u01a1 s\u1edf d\u1eef li\u1ec7u, API, kho d\u1eef li\u1ec7u v\u00e0 c\u00f4ng c\u1ee5 ph\u00e2n t\u00edch th\u00e0nh m\u1ed9t lu\u1ed3ng th\u1ed1ng nh\u1ea5t. \u0110i\u1ec1u n\u00e0y gi\u00fap d\u1eef li\u1ec7u lu\u00e2n chuy\u1ec3n li\u1ec1n m\u1ea1ch gi\u1eefa c\u00e1c b\u1ed9 ph\u1eadn v\u00e0 h\u1ec7 th\u1ed1ng.<\/li>\n\n\n\n<li><strong>Ti\u1ebft ki\u1ec7m chi ph\u00ed v\u1eadn h\u00e0nh v\u00e0 nh\u00e2n s\u1ef1: <\/strong>T\u1ef1 \u0111\u1ed9ng h\u00f3a gi\u00fap gi\u1ea3m \u0111\u00e1ng k\u1ec3 kh\u1ed1i l\u01b0\u1ee3ng c\u00f4ng vi\u1ec7c th\u1ee7 c\u00f4ng, ti\u1ebft ki\u1ec7m chi ph\u00ed v\u1eadn h\u00e0nh v\u00e0 th\u1eddi gian c\u1ee7a \u0111\u1ed9i k\u1ef9 thu\u1eadt. Nh\u00e2n s\u1ef1 c\u00f3 th\u1ec3 t\u1eadp trung v\u00e0o c\u00e1c nhi\u1ec7m v\u1ee5 t\u1ea1o gi\u00e1 tr\u1ecb cao h\u01a1n nh\u01b0 t\u1ed1i \u01b0u d\u1eef li\u1ec7u hay ph\u00e1t tri\u1ec3n s\u1ea3n ph\u1ea9m.<\/li>\n\n\n\n<li><strong>B\u1ea3o m\u1eadt v\u00e0 ki\u1ec3m so\u00e1t d\u1eef li\u1ec7u n\u1ed9i b\u1ed9 tuy\u1ec7t \u0111\u1ed1i: <\/strong>Khi tri\u1ec3n khai tr\u00ean m\u00f4i tr\u01b0\u1eddng ri\u00eang, Airflow gi\u00fap doanh nghi\u1ec7p ki\u1ec3m so\u00e1t ho\u00e0n to\u00e0n d\u1eef li\u1ec7u v\u00e0 kh\u00f3a API, \u0111\u1ea3m b\u1ea3o an to\u00e0n cho c\u00e1c l\u0129nh v\u1ef1c \u0111\u00f2i h\u1ecfi b\u1ea3o m\u1eadt cao nh\u01b0 t\u00e0i ch\u00ednh, y t\u1ebf hay th\u01b0\u01a1ng m\u1ea1i \u0111i\u1ec7n t\u1eed.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-6.png\" alt=\"T\u1ea1i sao doanh nghi\u1ec7p n\u00ean s\u1eed d\u1ee5ng Airflow?\" class=\"wp-image-120765\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-6.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-6-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>T\u1ea1i sao doanh nghi\u1ec7p n\u00ean s\u1eed d\u1ee5ng Airflow?<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h2 id=\"So_s\u00e1nh_nhanh_Airflow_v\u1edbi_c\u00e1c_c\u00f4ng_c\u1ee5_kh\u00e1c\"><a id=\"post-120759-_qhirdywjsxhu\"><\/a>So s\u00e1nh nhanh Airflow v\u1edbi c\u00e1c c\u00f4ng c\u1ee5 kh\u00e1c<\/h2>\n\n\n\n<h3 id=\"Airflow_vs._Prefect\"><strong>Airflow vs. Prefect<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 cu\u1ed9c chi\u1ebfn gi\u1eefa &#8220;s\u1ef1 \u1ed5n \u0111\u1ecbnh&#8221; v\u00e0 &#8220;t\u00ednh linh ho\u1ea1t hi\u1ec7n \u0111\u1ea1i&#8221;.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Airflow<\/strong> (\u0111\u1eb7c bi\u1ec7t l\u00e0 c\u00e1c phi\u00ean b\u1ea3n c\u0169 h\u01a1n) c\u00f3 c\u1ea5u tr\u00fac kh\u00e1 c\u1ee9ng nh\u1eafc. B\u1ea1n ph\u1ea3i \u0111\u1ecbnh ngh\u0129a c\u00e1c DAG (pipeline) theo m\u1ed9t c\u00e1ch c\u1ee5 th\u1ec3. B\u00f9 l\u1ea1i, h\u1ec7 sinh th\u00e1i Provider (k\u1ebft n\u1ed1i) c\u1ee7a n\u00f3 l\u00e0 l\u1edbn nh\u1ea5t, cho ph\u00e9p b\u1ea1n t\u00edch h\u1ee3p v\u1edbi g\u1ea7n nh\u01b0 m\u1ecdi d\u1ecbch v\u1ee5.<\/li>\n\n\n\n<li><strong>Prefect<\/strong> \u0111\u01b0\u1ee3c x\u00e2y d\u1ef1ng v\u1edbi tri\u1ebft l\u00fd &#8220;Python-native&#8221;. B\u1ea1n ch\u1ec9 c\u1ea7n th\u00eam c\u00e1c &#8220;decorator&#8221; (@task, @flow) v\u00e0o c\u00e1c h\u00e0m Python b\u00ecnh th\u01b0\u1eddng \u0111\u1ec3 bi\u1ebfn ch\u00fang th\u00e0nh m\u1ed9t workflow. \u0110i\u1ec1u n\u00e0y khi\u1ebfn Prefect <em>c\u1ef1c k\u1ef3 linh ho\u1ea1t<\/em> \u0111\u1ec3 t\u1ea1o c\u00e1c pipeline \u0111\u1ed9ng (dynamic pipeline) \u2013 th\u1ee9 m\u00e0 Airflow l\u00e0m kh\u00e1 v\u1ea5t v\u1ea3. Prefect c\u0169ng x\u1eed l\u00fd c\u00e1c lu\u1ed3ng c\u00f4ng vi\u1ec7c th\u1ea5t b\u1ea1i v\u00e0 ch\u1ea1y l\u1ea1i (retry) m\u1ed9t c\u00e1ch th\u00f4ng minh h\u01a1n.<\/li>\n<\/ul>\n\n\n\n<p><strong>\u27a1\ufe0f<\/strong> D\u00f9ng <strong>Airflow<\/strong> cho c\u00e1c h\u1ec7 th\u1ed1ng ETL\/ELT l\u1edbn, \u0111\u00e3 \u0111\u01b0\u1ee3c chu\u1ea9n h\u00f3a, c\u1ea7n nhi\u1ec1u t\u00edch h\u1ee3p. D\u00f9ng <strong>Prefect<\/strong> khi \u0111\u1ed9i ng\u0169 c\u1ee7a b\u1ea1n m\u1ea1nh v\u1ec1 Python v\u00e0 c\u1ea7n ch\u1ea1y c\u00e1c workflow ph\u1ee9c t\u1ea1p, thay \u0111\u1ed5i li\u00ean t\u1ee5c (v\u00ed d\u1ee5: pipeline Machine Learning).<\/p>\n\n\n\n<h3 id=\"Airflow_vs._Dagster\"><strong>Airflow vs. Dagster<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 s\u1ef1 kh\u00e1c bi\u1ec7t v\u1ec1 tri\u1ebft l\u00fd: &#8220;Ch\u1ea1y t\u00e1c v\u1ee5&#8221; so v\u1edbi &#8220;T\u1ea1o t\u00e0i s\u1ea3n&#8221;.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Airflow<\/strong> t\u1eadp trung v\u00e0o <strong>T\u00e1c v\u1ee5 (Tasks)<\/strong>. C\u00f4ng c\u1ee5 s\u1ebd quan t\u00e2m: &#8220;Task A \u0111\u00e3 ch\u1ea1y th\u00e0nh c\u00f4ng ch\u01b0a? OK, ch\u1ea1y Task B.&#8221; Dagster kh\u00f4ng th\u1ef1c s\u1ef1 &#8220;hi\u1ec3u&#8221; Task A \u0111\u00e3 <em>t\u1ea1o ra c\u00e1i g\u00ec<\/em>.<\/li>\n\n\n\n<li><strong>Dagster<\/strong> t\u1eadp trung v\u00e0o <strong>T\u00e0i s\u1ea3n D\u1eef li\u1ec7u (Data Assets)<\/strong>. C\u00f4ng c\u1ee5 n\u00e0y quan t\u00e2m: &#8220;Task A t\u1ea1o ra <em>file_raw.csv<\/em>. Task B c\u1ea7n <em>file_raw.csv<\/em> \u0111\u1ec3 t\u1ea1o ra <em>b\u1ea3ng_clean_data<\/em>.&#8221; Dagster theo d\u00f5i to\u00e0n b\u1ed9 d\u00f2ng \u0111\u1eddi (lineage) c\u1ee7a d\u1eef li\u1ec7u v\u00e0 cho ph\u00e9p b\u1ea1n ki\u1ec3m th\u1eed ch\u1ea5t l\u01b0\u1ee3ng d\u1eef li\u1ec7u ngay trong pipeline.<\/li>\n<\/ul>\n\n\n\n<p><strong>\u27a1\ufe0f<\/strong> D\u00f9ng <strong>Airflow<\/strong> khi b\u1ea1n ch\u1ee7 y\u1ebfu c\u1ea7n <em>ch\u1ea1y<\/em> c\u00e1c quy tr\u00ecnh. D\u00f9ng <strong>Dagster<\/strong> khi b\u1ea1n mu\u1ed1n <em>qu\u1ea3n l\u00fd v\u00e0 \u0111\u1ea3m b\u1ea3o ch\u1ea5t l\u01b0\u1ee3ng<\/em> c\u1ee7a ch\u00ednh d\u1eef li\u1ec7u \u0111\u1ea7u ra (v\u00ed d\u1ee5: ki\u1ec3m th\u1eed d\u1eef li\u1ec7u, theo d\u00f5i ngu\u1ed3n g\u1ed1c d\u1eef li\u1ec7u).<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-7.png\" alt=\"So s\u00e1nh nhanh Airflow v\u1edbi c\u00e1c c\u00f4ng c\u1ee5 kh\u00e1c (2025)\" class=\"wp-image-120766\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-7.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-7-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>So s\u00e1nh nhanh Airflow v\u1edbi c\u00e1c c\u00f4ng c\u1ee5 kh\u00e1c <\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"Airflow_vs._Luigi\"><strong>Airflow vs. Luigi<\/strong><\/h3>\n\n\n\n<p>\u0110\u00e2y l\u00e0 cu\u1ed9c chi\u1ebfn gi\u1eefa m\u1ed9t &#8220;n\u1ec1n t\u1ea3ng to\u00e0n di\u1ec7n&#8221; v\u00e0 m\u1ed9t &#8220;th\u01b0 vi\u1ec7n chuy\u00ean d\u1ee5ng&#8221;.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Luigi<\/strong> (\u0111\u01b0\u1ee3c t\u1ea1o b\u1edfi Spotify) r\u1ea5t gi\u1ecfi trong vi\u1ec7c qu\u1ea3n l\u00fd c\u00e1c pipeline ph\u1ee5 thu\u1ed9c ph\u1ee9c t\u1ea1p. Tri\u1ebft l\u00fd c\u1ee7a Luigi l\u00e0 &#8220;target-based&#8221;: m\u1ed9t task ch\u1ec9 ch\u1ea1y n\u1ebfu &#8220;m\u1ee5c ti\u00eau&#8221; (target) c\u1ee7a n\u00f3 (v\u00ed d\u1ee5: m\u1ed9t file tr\u00ean S3, m\u1ed9t b\u1ea3ng trong database) ch\u01b0a t\u1ed3n t\u1ea1i. N\u00f3 \u0111\u01a1n gi\u1ea3n, nh\u1eb9 v\u00e0 t\u1eadp trung.<\/li>\n\n\n\n<li><strong>Airflow<\/strong> l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng ho\u00e0n ch\u1ec9nh h\u01a1n nhi\u1ec1u. C\u00f4ng c\u1ee5 n\u00e0y c\u00f3 Scheduler, Web Server (UI), v\u00e0 c\u01a1 s\u1edf d\u1eef li\u1ec7u ri\u00eang. Giao di\u1ec7n UI c\u1ee7a Airflow v\u01b0\u1ee3t tr\u1ed9i so v\u1edbi Luigi, cho ph\u00e9p gi\u00e1m s\u00e1t, ch\u1ea1y l\u1ea1i (backfill) v\u00e0 qu\u1ea3n l\u00fd t\u1ed1t h\u01a1n. Airflow c\u0169ng x\u1eed l\u00fd vi\u1ec7c l\u1eadp l\u1ecbch (scheduling) t\u1ed1t h\u01a1n, trong khi Luigi ch\u1ee7 y\u1ebfu t\u1eadp trung v\u00e0o vi\u1ec7c gi\u1ea3i quy\u1ebft s\u1ef1 ph\u1ee5 thu\u1ed9c.<\/li>\n<\/ul>\n\n\n\n<p><strong>\u27a1\ufe0f<\/strong> D\u00f9ng <strong>Luigi<\/strong> cho c\u00e1c d\u1ef1 \u00e1n ETL chuy\u00ean s\u00e2u, n\u1eb7ng v\u1ec1 x\u1eed l\u00fd batch, n\u01a1i b\u1ea1n ch\u1ec9 quan t\u00e2m \u0111\u1ebfn vi\u1ec7c file \u0111\u1ea7u ra \u0111\u00e3 t\u1ed3n t\u1ea1i hay ch\u01b0a. D\u00f9ng <strong>Airflow<\/strong> khi b\u1ea1n c\u1ea7n m\u1ed9t h\u1ec7 th\u1ed1ng ho\u00e0n ch\u1ec9nh \u0111\u1ec3 l\u1eadp l\u1ecbch, gi\u00e1m s\u00e1t, v\u00e0 qu\u1ea3n l\u00fd h\u00e0ng tr\u0103m pipeline kh\u00e1c nhau.<\/p>\n\n\n\n<h2 id=\"Khi_n\u00e0o_n\u00ean_(v\u00e0_kh\u00f4ng_n\u00ean)_s\u1eed_d\u1ee5ng_Airflow?\"><a id=\"post-120759-_d974tybc1p05\"><\/a>Khi n\u00e0o n\u00ean (v\u00e0 kh\u00f4ng n\u00ean) s\u1eed d\u1ee5ng Airflow?<\/h2>\n\n\n\n<h3 id=\"Khi_n\u00e0o_N\u00caN_s\u1eed_d\u1ee5ng_Airflow?\"><a id=\"post-120759-_vlun03hui08z\"><\/a><strong>Khi n\u00e0o N\u00caN s\u1eed d\u1ee5ng Airflow?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>B\u1ea1n c\u00f3 c\u00e1c quy tr\u00ecnh (pipelines) ph\u1ee9c t\u1ea1p v\u00e0 ph\u1ee5 thu\u1ed9c l\u1eabn nhau: <\/strong>B\u1ea1n c\u00f3 c\u00e1c t\u00e1c v\u1ee5 ph\u1ea3i ch\u1ea1y theo m\u1ed9t tr\u1eadt t\u1ef1 nghi\u00eam ng\u1eb7t (Task A -&gt; Task B -&gt; Task C). Ho\u1eb7c ph\u1ee9c t\u1ea1p h\u01a1n: Task A ph\u1ea3i ch\u1ea1y xong, sau \u0111\u00f3 Task B v\u00e0 C ch\u1ea1y song song, v\u00e0 ch\u1ec9 khi c\u1ea3 B v\u00e0 C ho\u00e0n t\u1ea5t, Task D m\u1edbi \u0111\u01b0\u1ee3c b\u1eaft \u0111\u1ea7u.<\/li>\n\n\n\n<li><strong>B\u1ea1n c\u1ea7n x\u1eed l\u00fd l\u1ed7i m\u1ed9t c\u00e1ch th\u00f4ng minh (T\u1ef1 \u0111\u1ed9ng th\u1eed l\u1ea1i): <\/strong>B\u1ea1n mu\u1ed1n h\u1ec7 th\u1ed1ng t\u1ef1 \u0111\u1ed9ng ch\u1ea1y l\u1ea1i m\u1ed9t t\u00e1c v\u1ee5 b\u1ecb l\u1ed7i (v\u00ed d\u1ee5: do API s\u1eadp, m\u1ea1ng lag) 3 l\u1ea7n, m\u1ed7i l\u1ea7n c\u00e1ch nhau 10 ph\u00fat, tr\u01b0\u1edbc khi n\u00f3 &#8220;b\u1ecf cu\u1ed9c&#8221; v\u00e0 g\u1eedi c\u1ea3nh b\u00e1o. Cron kh\u00f4ng th\u1ec3 l\u00e0m \u0111i\u1ec1u n\u00e0y.<\/li>\n\n\n\n<li><strong>B\u1ea1n c\u1ea7n gi\u00e1m s\u00e1t, c\u1ea3nh b\u00e1o v\u00e0 xem log t\u1eadp trung: <\/strong>B\u1ea1n mu\u1ed1n m\u1ed9t giao di\u1ec7n (UI) duy nh\u1ea5t \u0111\u1ec3 xem ch\u00ednh x\u00e1c t\u00e1c v\u1ee5 n\u00e0o \u0111\u00e3 th\u1ea5t b\u1ea1i l\u00fac 3 gi\u1edd s\u00e1ng, \u0111\u1ecdc log l\u1ed7i c\u1ee7a n\u00f3, v\u00e0 bi\u1ebft \u0111\u01b0\u1ee3c l\u00fd do. Airflow cung c\u1ea5p m\u1ed9t trung t\u00e2m ch\u1ec9 huy, thay v\u00ec ph\u1ea3i ki\u1ec3m tra log tr\u00ean 10 m\u00e1y ch\u1ee7 kh\u00e1c nhau.<\/li>\n\n\n\n<li><strong>B\u1ea1n c\u1ea7n ch\u1ea1y l\u1ea1i d\u1eef li\u1ec7u l\u1ecbch s\u1eed (Backfilling): <\/strong>B\u1ea1n ph\u00e1t hi\u1ec7n m\u1ed9t l\u1ed7i logic trong code v\u00e0 c\u1ea7n x\u1eed l\u00fd l\u1ea1i to\u00e0n b\u1ed9 d\u1eef li\u1ec7u c\u1ee7a 2 tu\u1ea7n qua. Airflow cho ph\u00e9p b\u1ea1n d\u1ec5 d\u00e0ng ra l\u1ec7nh &#8220;ch\u1ea1y l\u1ea1i quy tr\u00ecnh n\u00e0y cho kho\u1ea3ng ng\u00e0y X \u0111\u1ebfn Y&#8221;, v\u00e0 n\u00f3 s\u1ebd t\u1ef1 \u0111\u1ed9ng ch\u1ea1y 14 l\u1ea7n (cho 14 ng\u00e0y) m\u1ed9t c\u00e1ch ch\u00ednh x\u00e1c.<\/li>\n\n\n\n<li><strong>Quy tr\u00ecnh c\u1ee7a b\u1ea1n \u0111\u01b0\u1ee3c &#8220;l\u1eadp l\u1ecbch&#8221; (Scheduled) v\u00e0 ch\u1ea1y theo &#8220;batch&#8221;: <\/strong>Quy tr\u00ecnh c\u1ee7a b\u1ea1n ch\u1ea1y theo m\u1ed9t l\u1ecbch tr\u00ecnh c\u1ed1 \u0111\u1ecbnh (v\u00ed d\u1ee5: m\u1ed7i gi\u1edd, m\u1ed7i ng\u00e0y, m\u1ed7i tu\u1ea7n). Airflow l\u00e0 vua c\u1ee7a x\u1eed l\u00fd <strong>batch<\/strong>.<\/li>\n\n\n\n<li><strong>B\u1ea1n mu\u1ed1n qu\u1ea3n l\u00fd &#8220;Workflows as Code&#8221;: <\/strong>B\u1ea1n mu\u1ed1n l\u01b0u tr\u1eef logic pipeline c\u1ee7a m\u00ecnh trong Git, th\u1ef1c hi\u1ec7n code review, v\u00e0 qu\u1ea3n l\u00fd phi\u00ean b\u1ea3n gi\u1ed1ng nh\u01b0 b\u1ea1n l\u00e0m v\u1edbi ph\u1ea7n m\u1ec1m.<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img decoding=\"async\" width=\"700\" height=\"375\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-8.png\" alt=\"Khi n\u00e0o n\u00ean (v\u00e0 kh\u00f4ng n\u00ean) s\u1eed d\u1ee5ng Airflow?\" class=\"wp-image-120768\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-8.png 700w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/airflow-la-gi-8-300x161.png 300w\" sizes=\"(max-width: 700px) 100vw, 700px\" \/><figcaption class=\"wp-element-caption\"><strong>Khi n\u00e0o n\u00ean (v\u00e0 kh\u00f4ng n\u00ean) s\u1eed d\u1ee5ng Airflow?<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<h3 id=\"Khi_n\u00e0o_KH\u00d4NG_N\u00caN_s\u1eed_d\u1ee5ng_Airflow?\"><a id=\"post-120759-_5zvfldnb0m0m\"><\/a><strong>Khi n\u00e0o KH\u00d4NG N\u00caN s\u1eed d\u1ee5ng Airflow?<\/strong><\/h3>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>T\u00e1c v\u1ee5 \u0111\u01a1n gi\u1ea3n, kh\u00f4ng c\u00f3 ph\u1ee5 thu\u1ed9c ph\u1ee9c t\u1ea1p<\/strong>: V\u00ed d\u1ee5 ch\u1ec9 c\u1ea7n ch\u1ea1y m\u1ed9t script m\u1ed7i ng\u00e0y, Cronjob ho\u1eb7c c\u00e1c c\u00f4ng c\u1ee5 l\u1eadp l\u1ecbch nh\u1eb9 h\u01a1n (nh\u01b0 Prefect, Dagster Lite) s\u1ebd hi\u1ec7u qu\u1ea3 h\u01a1n.<\/li>\n\n\n\n<li><strong>H\u1ec7 th\u1ed1ng nh\u1ecf ho\u1eb7c kh\u00f4ng c\u00f3 \u0111\u1ed9i ng\u0169 k\u1ef9 thu\u1eadt chuy\u00ean s\u00e2u<\/strong>: Airflow c\u1ea7n c\u1ea5u h\u00ecnh, gi\u00e1m s\u00e1t v\u00e0 b\u1ea3o tr\u00ec \u0111\u1ecbnh k\u1ef3. Vi\u1ec7c n\u00e0y c\u00f3 th\u1ec3 t\u1ed1n c\u00f4ng n\u1ebfu h\u1ea1 t\u1ea7ng nh\u1ecf.<\/li>\n\n\n\n<li><strong>C\u1ea7n x\u1eed l\u00fd d\u1eef li\u1ec7u theo th\u1eddi gian th\u1ef1c (real-time)<\/strong>: Airflow \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf cho batch processing (x\u1eed l\u00fd theo l\u00f4), kh\u00f4ng ph\u00f9 h\u1ee3p v\u1edbi c\u00e1c t\u00e1c v\u1ee5 stream li\u00ean t\u1ee5c nh\u01b0 Kafka hay Flink.<\/li>\n\n\n\n<li><strong>M\u00f4i tr\u01b0\u1eddng gi\u1edbi h\u1ea1n t\u00e0i nguy\u00ean<\/strong>: Vi\u1ec7c v\u1eadn h\u00e0nh Airflow y\u00eau c\u1ea7u t\u00e0i nguy\u00ean CPU, RAM v\u00e0 l\u01b0u tr\u1eef log \u0111\u00e1ng k\u1ec3, n\u00ean kh\u00f4ng l\u00fd t\u01b0\u1edfng cho VPS y\u1ebfu ho\u1eb7c chi ph\u00ed th\u1ea5p.<\/li>\n<\/ul>\n\n\n\n<h2 id=\"H\u01b0\u1edbng_d\u1eabn_c\u00e1ch_c\u00e0i_\u0111\u1eb7t_Airflow_v\u1edbi_Docker\"><a id=\"post-120759-_5cc15bgfvjy9\"><\/a>H\u01b0\u1edbng d\u1eabn c\u00e1ch c\u00e0i \u0111\u1eb7t Airflow v\u1edbi Docker<\/h2>\n\n\n\n<p><em>Ph\u1ea7n n\u00e0y gi\u1ea3 \u0111\u1ecbnh b\u1ea1n \u0111\u00e3 c\u00e0i \u0111\u1eb7t s\u1eb5n <\/em><strong><em>Docker<\/em><\/strong><em> v\u00e0 <\/em><strong><em>Docker Compose<\/em><\/strong><em> tr\u00ean m\u00e1y c\u1ee7a m\u00ecnh.<\/em><\/p>\n\n\n\n<p><strong>B\u01b0\u1edbc 1: <\/strong>T\u1ea3i t\u1ec7p docker-compose.yaml ch\u00ednh th\u1ee9c<\/p>\n\n\n\n<p>Apache Airflow cung c\u1ea5p m\u1ed9t t\u1ec7p c\u1ea5u h\u00ecnh docker-compose.yaml c\u1ef1c k\u1ef3 \u0111\u1ea7y \u0111\u1ee7. B\u1ea1n ch\u1ec9 c\u1ea7n t\u1ea3i v\u1ec1:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>curl -LfO \"https:\/\/airflow.apache.org\/docs\/apache-airflow\/latest\/docker-compose.yaml\"<\/code><\/pre>\n\n\n\n<p><strong>B\u01b0\u1edbc 2: <\/strong>Chu\u1ea9n b\u1ecb m\u00f4i tr\u01b0\u1eddng<\/p>\n\n\n\n<p>Tr\u01b0\u1edbc khi kh\u1edfi ch\u1ea1y, b\u1ea1n c\u1ea7n t\u1ea1o c\u00e1c th\u01b0 m\u1ee5c m\u00e0 docker-compose.yaml mong \u0111\u1ee3i. C\u00e1c th\u01b0 m\u1ee5c n\u00e0y s\u1ebd \u0111\u01b0\u1ee3c &#8220;map&#8221; (\u00e1nh x\u1ea1) v\u00e0o b\u00ean trong container, cho ph\u00e9p b\u1ea1n ch\u1ec9nh s\u1eeda file DAG \u1edf m\u00e1y th\u1eadt c\u1ee7a m\u00ecnh.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>mkdir .\/dags .\/logs .\/plugins<\/code><\/pre>\n\n\n\n<p>Ti\u1ebfp theo, b\u1ea1n c\u1ea7n t\u1ea1o m\u1ed9t file .env \u0111\u1ec3 khai b\u00e1o AIRFLOW_UID. \u0110i\u1ec1u n\u00e0y \u0111\u1ec3 tr\u00e1nh c\u00e1c v\u1ea5n \u0111\u1ec1 v\u1ec1 &#8220;permission&#8221; (quy\u1ec1n truy c\u1eadp file) gi\u1eefa m\u00e1y ch\u1ee7 c\u1ee7a b\u1ea1n v\u00e0 container:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>echo -e \"AIRFLOW_UID=$(id -u)\" &gt; .env<\/code><\/pre>\n\n\n\n<p><strong>B\u01b0\u1edbc 3: <\/strong>Kh\u1edfi t\u1ea1o c\u01a1 s\u1edf d\u1eef li\u1ec7u<\/p>\n\n\n\n<p>Airflow c\u1ea7n m\u1ed9t c\u01a1 s\u1edf d\u1eef li\u1ec7u (Metadata Database) \u0111\u1ec3 l\u01b0u tr\u1eef tr\u1ea1ng th\u00e1i c\u1ee7a c\u00e1c DAG, c\u00e1c l\u1ea7n ch\u1ea1y,&#8230; T\u1ec7p compose n\u00e0y s\u1eed d\u1ee5ng Postgres.<\/p>\n\n\n\n<p>L\u1ec7nh sau s\u1ebd ch\u1ea1y m\u1ed9t service t\u00ean l\u00e0 airflow-init \u0111\u1ec3 thi\u1ebft l\u1eadp c\u01a1 s\u1edf d\u1eef li\u1ec7u v\u00e0 t\u1ea1o user admin m\u1eb7c \u0111\u1ecbnh.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-compose up airflow-init<\/code><\/pre>\n\n\n\n<p><strong>B\u01b0\u1edbc 4: <\/strong>Kh\u1edfi \u0111\u1ed9ng Airflow!<\/p>\n\n\n\n<p>Sau khi qu\u00e1 tr\u00ecnh &#8220;init&#8221; ho\u00e0n t\u1ea5t, gi\u1edd b\u1ea1n \u0111\u00e3 c\u00f3 th\u1ec3 kh\u1edfi \u0111\u1ed9ng to\u00e0n b\u1ed9 h\u1ec7 th\u1ed1ng (Scheduler, Webserver, Worker, &#8230;).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>docker-compose up -d<\/code><\/pre>\n\n\n\n<p><strong>B\u01b0\u1edbc 5: <\/strong>Truy c\u1eadp giao di\u1ec7n Airflow<\/p>\n\n\n\n<p>Ch\u1edd kho\u1ea3ng 1-2 ph\u00fat \u0111\u1ec3 c\u00e1c service kh\u1edfi \u0111\u1ed9ng ho\u00e0n to\u00e0n. Sau \u0111\u00f3, m\u1edf tr\u00ecnh duy\u1ec7t c\u1ee7a b\u1ea1n v\u00e0 truy c\u1eadp:<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>URL:<\/strong> http:\/\/localhost:8080<\/li>\n\n\n\n<li><strong>Username:<\/strong> airflow<\/li>\n\n\n\n<li><strong>Password:<\/strong> airflow<\/li>\n<\/ul>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-large\"><img decoding=\"async\" width=\"1024\" height=\"366\" src=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/f6a8d6a0-7259-11ee-a9fe-b97ad03e40ec-Screen-Shot-2023-10-24-at-17.41.21-1024x366.png\" alt=\"Giao di\u1ec7n \u0111\u0103ng nh\u1eadp Airflow\" class=\"wp-image-120769\" title=\"\" srcset=\"https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/f6a8d6a0-7259-11ee-a9fe-b97ad03e40ec-Screen-Shot-2023-10-24-at-17.41.21-1024x366.png 1024w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/f6a8d6a0-7259-11ee-a9fe-b97ad03e40ec-Screen-Shot-2023-10-24-at-17.41.21-300x107.png 300w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/f6a8d6a0-7259-11ee-a9fe-b97ad03e40ec-Screen-Shot-2023-10-24-at-17.41.21-768x274.png 768w, https:\/\/tino.vn\/blog\/wp-content\/uploads\/2025\/11\/f6a8d6a0-7259-11ee-a9fe-b97ad03e40ec-Screen-Shot-2023-10-24-at-17.41.21.png 1493w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><figcaption class=\"wp-element-caption\"><strong>Giao di\u1ec7n \u0111\u0103ng nh\u1eadp Airflow<\/strong><\/figcaption><\/figure>\n<\/div>\n\n\n<p>N\u1ebfu b\u1ea1n th\u1ea5y giao di\u1ec7n \u0111\u0103ng nh\u1eadp, b\u1ea1n \u0111\u00e3 c\u00e0i \u0111\u1eb7t th\u00e0nh c\u00f4ng!<\/p>\n\n\n\n<h3 id=\"K\u1ebft_lu\u1eadn\"><a id=\"post-120759-_2rkfgt8r6020\"><\/a><strong>K\u1ebft lu\u1eadn<\/strong><\/h3>\n\n\n\n<p>D\u00f9 b\u1ea1n l\u00e0 m\u1ed9t Data Engineer \u0111ang v\u1eadt l\u1ed9n v\u1edbi c\u00e1c pipeline ETL, m\u1ed9t Data Scientist mu\u1ed1n t\u1ef1 \u0111\u1ed9ng h\u00f3a m\u00f4 h\u00ecnh c\u1ee7a m\u00ecnh, hay m\u1ed9t DevOps mu\u1ed1n qu\u1ea3n l\u00fd c\u00e1c t\u00e1c v\u1ee5 h\u1ec7 th\u1ed1ng, vi\u1ec7c hi\u1ec3u r\u00f5 Airflow s\u1ebd m\u1edf ra c\u01a1 h\u1ed9i t\u1ed1i \u01b0u h\u00f3a to\u00e0n b\u1ed9 quy tr\u00ecnh x\u1eed l\u00fd d\u1eef li\u1ec7u trong t\u1ed5 ch\u1ee9c.<\/p>\n\n\n\n<h2 id=\"Nh\u1eefng_c\u00e2u_h\u1ecfi_th\u01b0\u1eddng_g\u1eb7p\"><a id=\"post-120759-_wgkploi0f079\"><\/a>Nh\u1eefng c\u00e2u h\u1ecfi th\u01b0\u1eddng g\u1eb7p<\/h2>\n\n\n\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"DAG_(Directed_Acyclic_Graph)_l\u00e0_g\u00ec?\">DAG (Directed Acyclic Graph) l\u00e0 g\u00ec?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>DAG (\u0110\u1ed3 th\u1ecb c\u00f3 h\u01b0\u1edbng kh\u00f4ng tu\u1ea7n ho\u00e0n) l\u00e0 m\u1ed9t t\u1ec7p Python, \u0111\u1ecbnh ngh\u0129a <em>t\u1ea5t c\u1ea3<\/em> c\u00e1c t\u00e1c v\u1ee5 (tasks) trong quy tr\u00ecnh c\u1ee7a b\u1ea1n, th\u1ee9 t\u1ef1 ch\u00fang ch\u1ea1y v\u00e0 l\u1ecbch tr\u00ecnh ch\u1ea1y.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"S\u1ef1_kh\u00e1c_bi\u1ec7t_c\u01a1_b\u1ea3n_nh\u1ea5t_gi\u1eefa_Airflow_v\u00e0_Cron_(Cronjob)_l\u00e0_g\u00ec?_\">S\u1ef1 kh\u00e1c bi\u1ec7t c\u01a1 b\u1ea3n nh\u1ea5t gi\u1eefa Airflow v\u00e0 Cron (Cronjob) l\u00e0 g\u00ec? <\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Cron ch\u1ec9 l\u00e0 m\u1ed9t b\u1ed9 h\u1eb9n gi\u1edd \u0111\u01a1n gi\u1ea3n (fire-and-forget &#8211; &#8220;b\u1eafn v\u00e0 qu\u00ean&#8221;). Airflow l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng \u0111i\u1ec1u ph\u1ed1i (orchestration) ho\u00e0n ch\u1ec9nh, c\u00f3 kh\u1ea3 n\u0103ng qu\u1ea3n l\u00fd c\u00e1c ph\u1ee5 thu\u1ed9c ph\u1ee9c t\u1ea1p (Task B ch\u1edd Task A), t\u1ef1 \u0111\u1ed9ng th\u1eed l\u1ea1i (retry), v\u00e0 cung c\u1ea5p giao di\u1ec7n gi\u00e1m s\u00e1t tr\u1ef1c quan.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Airflow_c\u00f3_ph\u1ea3i_l\u00e0_c\u00f4ng_c\u1ee5_x\u1eed_l\u00fd_d\u1eef_li\u1ec7u_nh\u01b0_Apache_Spark_kh\u00f4ng?\">Airflow c\u00f3 ph\u1ea3i l\u00e0 c\u00f4ng c\u1ee5 x\u1eed l\u00fd d\u1eef li\u1ec7u nh\u01b0 Apache Spark kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Kh\u00f4ng. Airflow l\u00e0 c\u00f4ng c\u1ee5 <em>\u0111i\u1ec1u ph\u1ed1i<\/em>, c\u00f3 ch\u1ee9c n\u0103ng ra l\u1ec7nh cho c\u00e1c c\u00f4ng c\u1ee5 kh\u00e1c (nh\u01b0 Spark) l\u00e0m vi\u1ec7c. Airflow <em>qu\u1ea3n l\u00fd<\/em> quy tr\u00ecnh, c\u00f2n Spark <em>th\u1ef1c thi<\/em> vi\u1ec7c x\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Airflow_c\u00f3_th\u1ec3_x\u1eed_l\u00fd_d\u1eef_li\u1ec7u_streaming_(th\u1eddi_gian_th\u1ef1c)_nh\u01b0_Kafka_hay_Flink_kh\u00f4ng?\">Airflow c\u00f3 th\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u streaming (th\u1eddi gian th\u1ef1c) nh\u01b0 Kafka hay Flink kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>Kh\u00f4ng. Airflow l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng x\u1eed l\u00fd theo <em>l\u00f4 (batch)<\/em>, d\u1ef1a tr\u00ean l\u1ecbch tr\u00ecnh (v\u00ed d\u1ee5: ch\u1ea1y h\u00e0ng gi\u1edd, h\u00e0ng ph\u00fat). C\u00f4ng c\u1ee5 n\u00e0y kh\u00f4ng \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u <em>streaming (th\u1eddi gian th\u1ef1c)<\/em>. \u0110\u1ec3 l\u00e0m vi\u1ec7c \u0111\u00f3, b\u1ea1n n\u00ean d\u00f9ng Kafka, Flink, ho\u1eb7c Spark Streaming.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"&quot;Backfilling&quot;_trong_Airflow_ngh\u0129a_l\u00e0_g\u00ec_v\u00e0_khi_n\u00e0o_n\u00ean_d\u00f9ng?\">&quot;Backfilling&quot; trong Airflow ngh\u0129a l\u00e0 g\u00ec v\u00e0 khi n\u00e0o n\u00ean d\u00f9ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>&#8220;Backfilling&#8221; l\u00e0 h\u00e0nh \u0111\u1ed9ng ch\u1ea1y l\u1ea1i c\u00e1c quy tr\u00ecnh (DAGs) cho m\u1ed9t kho\u1ea3ng th\u1eddi gian trong qu\u00e1 kh\u1ee9. C\u01a1 ch\u1ebf n\u00e0y r\u1ea5t h\u1eefu \u00edch khi b\u1ea1n v\u1eeba s\u1eeda m\u1ed9t l\u1ed7i logic trong code v\u00e0 c\u1ea7n x\u1eed l\u00fd l\u1ea1i d\u1eef li\u1ec7u c\u1ee7a 10 ng\u00e0y tr\u01b0\u1edbc; Airflow s\u1ebd t\u1ef1 \u0111\u1ed9ng ch\u1ea1y l\u1ea1i 10 l\u1ea7n cho 10 ng\u00e0y \u0111\u00f3.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\t\t<section\t\thelp class=\"sc_fs_faq sc_card    \"\n\t\t\t\t>\n\t\t\t\t<h2 id=\"Apache_Airflow_c\u00f3_mi\u1ec5n_ph\u00ed_kh\u00f4ng?\">Apache Airflow c\u00f3 mi\u1ec5n ph\u00ed kh\u00f4ng?<\/h2>\t\t\t\t<div>\n\t\t\t\t\t\t<div class=\"sc_fs_faq__content\">\n\t\t\t\t\n\n<p>C\u00f3. Apache Airflow l\u00e0 m\u1ed9t d\u1ef1 \u00e1n m\u00e3 ngu\u1ed3n m\u1edf 100% (theo gi\u1ea5y ph\u00e9p Apache 2.0) v\u00e0 ho\u00e0n to\u00e0n mi\u1ec5n ph\u00ed. B\u1ea1n ch\u1ec9 ph\u1ea3i tr\u1ea3 chi ph\u00ed cho h\u1ea1 t\u1ea7ng (m\u00e1y ch\u1ee7, cloud) \u0111\u1ec3 ch\u1ea1y n\u00f3.<\/p>\n\n\t\t\t<\/div>\n\t\t<\/div>\n\t\t<\/section>\n\t\t\n<script type=\"application\/ld+json\">\n\t{\n\t\t\"@context\": \"https:\/\/schema.org\",\n\t\t\"@type\": \"FAQPage\",\n\t\t\"mainEntity\": [\n\t\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"DAG (Directed Acyclic Graph) l\u00e0 g\u00ec?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>DAG (\u0110\u1ed3 th\u1ecb c\u00f3 h\u01b0\u1edbng kh\u00f4ng tu\u1ea7n ho\u00e0n) l\u00e0 m\u1ed9t t\u1ec7p Python, \u0111\u1ecbnh ngh\u0129a <em>t\u1ea5t c\u1ea3<\/em> c\u00e1c t\u00e1c v\u1ee5 (tasks) trong quy tr\u00ecnh c\u1ee7a b\u1ea1n, th\u1ee9 t\u1ef1 ch\u00fang ch\u1ea1y v\u00e0 l\u1ecbch tr\u00ecnh ch\u1ea1y.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"S\u1ef1 kh\u00e1c bi\u1ec7t c\u01a1 b\u1ea3n nh\u1ea5t gi\u1eefa Airflow v\u00e0 Cron (Cronjob) l\u00e0 g\u00ec? \",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Cron ch\u1ec9 l\u00e0 m\u1ed9t b\u1ed9 h\u1eb9n gi\u1edd \u0111\u01a1n gi\u1ea3n (fire-and-forget - \\\"b\u1eafn v\u00e0 qu\u00ean\\\"). Airflow l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng \u0111i\u1ec1u ph\u1ed1i (orchestration) ho\u00e0n ch\u1ec9nh, c\u00f3 kh\u1ea3 n\u0103ng qu\u1ea3n l\u00fd c\u00e1c ph\u1ee5 thu\u1ed9c ph\u1ee9c t\u1ea1p (Task B ch\u1edd Task A), t\u1ef1 \u0111\u1ed9ng th\u1eed l\u1ea1i (retry), v\u00e0 cung c\u1ea5p giao di\u1ec7n gi\u00e1m s\u00e1t tr\u1ef1c quan.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Airflow c\u00f3 ph\u1ea3i l\u00e0 c\u00f4ng c\u1ee5 x\u1eed l\u00fd d\u1eef li\u1ec7u nh\u01b0 Apache Spark kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Kh\u00f4ng. Airflow l\u00e0 c\u00f4ng c\u1ee5 <em>\u0111i\u1ec1u ph\u1ed1i<\/em>, c\u00f3 ch\u1ee9c n\u0103ng ra l\u1ec7nh cho c\u00e1c c\u00f4ng c\u1ee5 kh\u00e1c (nh\u01b0 Spark) l\u00e0m vi\u1ec7c. Airflow <em>qu\u1ea3n l\u00fd<\/em> quy tr\u00ecnh, c\u00f2n Spark <em>th\u1ef1c thi<\/em> vi\u1ec7c x\u1eed l\u00fd d\u1eef li\u1ec7u l\u1edbn.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Airflow c\u00f3 th\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u streaming (th\u1eddi gian th\u1ef1c) nh\u01b0 Kafka hay Flink kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>Kh\u00f4ng. Airflow l\u00e0 m\u1ed9t n\u1ec1n t\u1ea3ng x\u1eed l\u00fd theo <em>l\u00f4 (batch)<\/em>, d\u1ef1a tr\u00ean l\u1ecbch tr\u00ecnh (v\u00ed d\u1ee5: ch\u1ea1y h\u00e0ng gi\u1edd, h\u00e0ng ph\u00fat). C\u00f4ng c\u1ee5 n\u00e0y kh\u00f4ng \u0111\u01b0\u1ee3c thi\u1ebft k\u1ebf \u0111\u1ec3 x\u1eed l\u00fd d\u1eef li\u1ec7u <em>streaming (th\u1eddi gian th\u1ef1c)<\/em>. \u0110\u1ec3 l\u00e0m vi\u1ec7c \u0111\u00f3, b\u1ea1n n\u00ean d\u00f9ng Kafka, Flink, ho\u1eb7c Spark Streaming.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"\\\"Backfilling\\\" trong Airflow ngh\u0129a l\u00e0 g\u00ec v\u00e0 khi n\u00e0o n\u00ean d\u00f9ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>\\\"Backfilling\\\" l\u00e0 h\u00e0nh \u0111\u1ed9ng ch\u1ea1y l\u1ea1i c\u00e1c quy tr\u00ecnh (DAGs) cho m\u1ed9t kho\u1ea3ng th\u1eddi gian trong qu\u00e1 kh\u1ee9. C\u01a1 ch\u1ebf n\u00e0y r\u1ea5t h\u1eefu \u00edch khi b\u1ea1n v\u1eeba s\u1eeda m\u1ed9t l\u1ed7i logic trong code v\u00e0 c\u1ea7n x\u1eed l\u00fd l\u1ea1i d\u1eef li\u1ec7u c\u1ee7a 10 ng\u00e0y tr\u01b0\u1edbc; Airflow s\u1ebd t\u1ef1 \u0111\u1ed9ng ch\u1ea1y l\u1ea1i 10 l\u1ea7n cho 10 ng\u00e0y \u0111\u00f3.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t,\t\t\t\t{\n\t\t\t\t\"@type\": \"Question\",\n\t\t\t\t\"name\": \"Apache Airflow c\u00f3 mi\u1ec5n ph\u00ed kh\u00f4ng?\",\n\t\t\t\t\"acceptedAnswer\": {\n\t\t\t\t\t\"@type\": \"Answer\",\n\t\t\t\t\t\"text\": \"<p>C\u00f3. Apache Airflow l\u00e0 m\u1ed9t d\u1ef1 \u00e1n m\u00e3 ngu\u1ed3n m\u1edf 100% (theo gi\u1ea5y ph\u00e9p Apache 2.0) v\u00e0 ho\u00e0n to\u00e0n mi\u1ec5n ph\u00ed. B\u1ea1n ch\u1ec9 ph\u1ea3i tr\u1ea3 chi ph\u00ed cho h\u1ea1 t\u1ea7ng (m\u00e1y ch\u1ee7, cloud) \u0111\u1ec3 ch\u1ea1y n\u00f3.<\/p>\"\n\t\t\t\t\t\t\t\t\t}\n\t\t\t}\n\t\t\t\t\t\t]\n\t}\n<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Trong k\u1ef7 nguy\u00ean Big Data, d\u1eef li\u1ec7u kh\u00f4ng ch\u1ec9 l\u1edbn m\u00e0 c\u00f2n ph\u1ee9c t\u1ea1p, \u0111\u00f2i h\u1ecfi c\u00e1c quy tr\u00ecnh x\u1eed l\u00fd ph\u1ea3i ch\u1ea1y li\u00ean t\u1ee5c v\u00e0 ch\u00ednh x\u00e1c. Nh\u01b0ng \u0111i\u1ec1u g\u00ec x\u1ea3y ra khi m\u1ed9t t\u00e1c v\u1ee5 th\u1ea5t b\u1ea1i l\u00fac 3 gi\u1edd s\u00e1ng? L\u00e0m th\u1ebf n\u00e0o \u0111\u1ec3 b\u1ea1n qu\u1ea3n l\u00fd h\u00e0ng tr\u0103m quy tr\u00ecnh ETL [&hellip;]<\/p>\n","protected":false},"author":23,"featured_media":120770,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5389],"tags":[7453],"class_list":["post-120759","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-kien-thuc-tong-hop","tag-airflow"],"_links":{"self":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/120759","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/users\/23"}],"replies":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/comments?post=120759"}],"version-history":[{"count":4,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/120759\/revisions"}],"predecessor-version":[{"id":122123,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/posts\/120759\/revisions\/122123"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media\/120770"}],"wp:attachment":[{"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/media?parent=120759"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/categories?post=120759"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tino.vn\/blog\/wp-json\/wp\/v2\/tags?post=120759"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}