{"id":72016,"date":"2026-02-04T18:48:58","date_gmt":"2026-02-04T10:48:58","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72016.html"},"modified":"2026-02-04T18:48:58","modified_gmt":"2026-02-04T10:48:58","slug":"apache-flink-%e5%bf%ab%e9%80%9f%e5%85%a5%e9%97%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72016.html","title":{"rendered":"Apache Flink \u5feb\u901f\u5165\u95e8"},"content":{"rendered":"<h2 id=\"ldEDH\">\u76ee\u6807<\/h2>\n<p id=\"u01c5f8a5\">\u5e0c\u671b\u901a\u8fc7\u8fd9\u4efd\u5185\u5bb9\u629b\u7816\u5f15\u7389\uff0c\u8ba9\u4f60\u5728\u9605\u8bfb\u540e\u4e0d\u4ec5\u80fd\u72ec\u7acb\u7f16\u5199 WordCount\u3001\u63a5\u5165 Kafka\u3001\u4f7f\u7528 MySQL\/Redis\uff0c\u5bf9 Flink \u4f5c\u4e1a\u6709\u4e00\u4e2a\u6574\u4f53\u3001\u6e05\u6670\u7684\u8ba4\u8bc6\u3002<\/p>\n<h2 id=\"Be7qO\">\u4e00\u3001\u7b2c\u4e00\u90e8\u5206\uff1aFlink \u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4e3a\u4ec0\u4e48\u8981\u7528\u5b83\uff1f<\/h2>\n<h3 id=\"qYFgT\">1.1 \u4e00\u53e5\u8bdd\u5b9a\u4e49<\/h3>\n<p id=\"u82d79f86\">Flink \u662f\u4e00\u4e2a\u201c\u771f\u00b7\u5b9e\u65f6\u201d\u6d41\u8ba1\u7b97\u5f15\u64ce\uff0c\u4e13\u95e8\u7528\u6765\u5728\u6570\u636e\u4e0d\u65ad\u4ea7\u751f\u7684\u65f6\u5019\u5c31\u7acb\u523b\u7b97\u51fa\u7ed3\u679c\u3002<\/p>\n<p id=\"u7c232142\">\n<p id=\"udfdc252e\">Flink\u6838\u5fc3\u76ee\u6807\uff0c\u662f\u201c\u6570\u636e\u6d41\u4e0a\u7684\u6709\u72b6\u6001\u8ba1\u7b97\u201d(Stateful Computations over Data Streams )\u5177\u4f53\u8bf4\u660e:Apache Flink\u662f\u4e00\u4e2a\u6846\u67b6\u548c\u5206\u5e03\u5f0f\u5904\u7406\u5f15\u64ce\uff0c\u7528\u4e8e\u5bf9\u65e0\u754c\u548c\u6709\u754c\u6570\u636e\u6d41\u8fdb\u884c\u6709\u72b6\u6001\u8ba1\u7b97\u3002\uff08\u53ef\u4ee5\u63d0\u4e00\u5634\uff0c\u6d41\u6279\u4e00\u4f53\uff09<\/p>\n<p id=\"uecac2874\">\n<h3 id=\"n07oi\">1.2 \u6d41\u5904\u7406\u7684\u4e09\u4e2a\u5386\u53f2\u9636\u6bb5<\/h3>\n<table id=\"yuAEq\">\n<tbody>\n<tr>\n<td>\n<p id=\"u29e1cec7\">\u9636\u6bb5<\/p>\n<\/td>\n<td>\n<p id=\"uc08e7db5\">\u4ee3\u8868\u6846\u67b6<\/p>\n<\/td>\n<td>\n<p id=\"u7256ad32\">\u5ef6\u8fdf<\/p>\n<\/td>\n<td>\n<p id=\"u1571c25e\">\u72b6\u6001\u7ba1\u7406<\/p>\n<\/td>\n<td>\n<p id=\"u109819aa\">Exactly-once<\/p>\n<\/td>\n<td>\n<p id=\"ufcca40b1\">\u5178\u578b\u95ee\u9898<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uc17de188\">\u7b2c\u4e00\u4ee3<\/p>\n<\/td>\n<td>\n<p id=\"u52ebd2cc\">Storm \/ Heron<\/p>\n<\/td>\n<td>\n<p id=\"ud4eaa4b6\">\u6beb\u79d2\u7ea7<\/p>\n<\/td>\n<td>\n<p id=\"u8b51e3fb\">\u975e\u5e38\u5f31<\/p>\n<\/td>\n<td>\n<p id=\"u29e6be47\">\u975e\u5e38\u9ebb\u70e6<\/p>\n<\/td>\n<td>\n<p id=\"u38f9fdca\">\u72b6\u6001\u5c0f\u3001\u6545\u969c\u6062\u590d\u96be<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u89952776\">\u7b2c\u4e8c\u4ee3<\/p>\n<\/td>\n<td>\n<p id=\"u784746ff\">Spark Streaming<\/p>\n<\/td>\n<td>\n<p id=\"uc5c433ec\">\u79d2\u7ea7\uff08\u5fae\u6279\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u2e844609\">\u6709\u72b6\u6001<\/p>\n<\/td>\n<td>\n<p id=\"ue4a17b72\">\u6709\uff08\u4f46\u590d\u6742\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u975cbae0\">\u5ef6\u8fdf\u9ad8\u3001\u4e0d\u80fd\u771f\u6beb\u79d2\u7ea7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u488a30a2\">\u7b2c\u4e09\u4ee3\uff08\u5f53\u524d\u6700\u4f18\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u482aeed2\">Apache Flink<\/p>\n<\/td>\n<td>\n<p id=\"u882c9abd\">\u6beb\u79d2\u7ea7<\/p>\n<\/td>\n<td>\n<p id=\"ued17c909\">\u8d85\u5927\u72b6\u6001<\/p>\n<\/td>\n<td>\n<p id=\"u8a51c853\">\u539f\u751f\u652f\u6301<\/p>\n<\/td>\n<td>\n<p id=\"ubaa96543\">\u51e0\u4e4e\u6ca1\u6709\u77ed\u677f<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"ucec0c747\">\u7ed3\u8bba\uff1aFlink \u662f\u76ee\u524d\u552f\u4e00\u4e00\u4e2a\u540c\u65f6\u6ee1\u8db3\u4e0b\u9762 5 \u4e2a\u8981\u6c42\u7684\u5f00\u6e90\u5f15\u64ce<\/p>\n<li id=\"u93b8c176\">\u6beb\u79d2\u7ea7\u5ef6\u8fdf<\/li>\n<li id=\"u7b535c9a\">\u9ad8\u541e\u5410<\/li>\n<li id=\"u11365fca\">\u8d85\u5927\u72b6\u6001\uff08\u51e0\u5341 TB \u90fd\u884c\uff09<\/li>\n<li id=\"u81d51655\">\u539f\u751f Exactly-once<\/li>\n<li id=\"u0d62fc24\">\u4e8b\u4ef6\u65f6\u95f4 + \u6c34\u5370\uff08\u5904\u7406\u4e71\u5e8f\uff09<\/li>\n<p id=\"udd5a19ef\">\u6240\u4ee5\u4e00\u53e5\u8bdd\uff1a\u73b0\u5728\u516c\u53f8\u91cc\u53ea\u8981\u662f\u201c\u5b9e\u65f6\u201d\u4e24\u4e2a\u5b57\uff0c\u57fa\u672c\u9ed8\u8ba4\u5c31\u7528 Flink\u3002<\/p>\n<p id=\"u2c2971b9\">\n<h3 id=\"M2eil\">1.3 Exactly-once<\/h3>\n<p id=\"u91b3400c\">Exactly-once\uff08\u7cbe\u786e\u4e00\u6b21\uff09\u662f\u6d41\u5904\u7406\u7cfb\u7edf\u4e2d\u6700\u4e25\u683c\u3001\u6700\u91cd\u8981\u7684\u201c\u6570\u636e\u5904\u7406\u8bed\u4e49\u201d\u4fdd\u8bc1\u3002 \u7b80\u5355\u6765\u8bf4\uff0c\u5c31\u662f\uff1a\u4e0d\u7ba1\u7a0b\u5e8f\u6302\u4e86\u591a\u5c11\u6b21\u3001\u91cd\u542f\u591a\u5c11\u6b21\u3001\u673a\u5668\u5b95\u673a\u591a\u5c11\u6b21\uff0c\u6700\u7ec8\u6bcf\u4e00\u6761\u6570\u636e\u90fd\u6070\u597d\u88ab\u6b63\u786e\u5904\u7406\u4e00\u6b21\uff0c\u65e2\u4e0d\u591a\u4e5f\u4e0d\u5c11\u3002<\/p>\n<p id=\"u7baa3204\">\n<p id=\"ucaaa9a3d\">\u901a\u4fd7\u7684\u6bd4\u55bb\u89e3\u91ca<\/p>\n<table id=\"f3EKF\">\n<tbody>\n<tr>\n<td>\n<p id=\"u3b957305\">\u5904\u7406\u8bed\u4e49<\/p>\n<\/td>\n<td>\n<p id=\"ue3440857\">\u6bd4\u55bb\uff08\u4f60\u7ed9\u5973\u670b\u53cb\u53d1\u5fae\u4fe1\u201c\u5230\u5bb6\u4e86\u201d\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u02a87bcd\">\u540e\u679c<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ub343f50e\">At-most-once<\/p>\n<\/td>\n<td>\n<p id=\"ube336ec8\">\u53d1\u4e86\u5c31\u4e0d\u7ba1\u4e86\uff0c\u7f51\u7edc\u65ad\u4e86\u5973\u670b\u53cb\u4e5f\u6536\u4e0d\u5230<\/p>\n<\/td>\n<td>\n<p id=\"u47aea292\">\u6570\u636e\u4e22\u4e86\uff08\u6700\u8f7b\u677e\uff0c\u4f46\u4e0d\u80fd\u63a5\u53d7\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ue35b8f76\">At-least-once<\/p>\n<\/td>\n<td>\n<p id=\"u0ea31a7e\">\u6015\u4e22\u4e86\u5c31\u72c2\u53d1\uff0c\u53d1 100 \u6b21\u786e\u8ba4\u5979\u4e00\u5b9a\u6536\u5230<\/p>\n<\/td>\n<td>\n<p id=\"ua746cb23\">\u6570\u636e\u91cd\u590d\u4e86\uff08\u5973\u670b\u53cb\u70b8\u4e86\uff1a\u4f60\u53d1 100 \u6b21\u5e72\u561b\uff09<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u90653a7c\">Exactly-once<\/p>\n<\/td>\n<td>\n<p id=\"ubf81f273\">\u4e0d\u7ba1\u7f51\u7edc\u600e\u4e48\u6296\u3001\u91cd\u8fde\u591a\u5c11\u6b21\uff0c\u5973\u670b\u53cb\u624b\u673a\u4e0a\u6c38\u8fdc\u53ea\u51fa\u73b0\u4e00\u6b21\u201c\u5230\u5bb6\u4e86\u201d<\/p>\n<\/td>\n<td>\n<p id=\"u32a0de4b\">\u5b8c\u7f8e\uff08\u65e2\u4e0d\u4e22\u4e5f\u4e0d\u91cd\uff09<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"ue1498678\">\n<p id=\"u6a7e94eb\">\n<h2 id=\"boBMb\">\u4e8c\u3001\u7b2c\u4e8c\u90e8\u5206\uff1aFlink \u6838\u5fc3\u6982\u5ff5<\/h2>\n<h3 id=\"QafJo\">Flink\u5206\u5c42API<\/h3>\n<p id=\"u7ba1726c\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"209\" id=\"u43c42d7f\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104856-698324185412e.png\" width=\"1167\"><\/p>\n<p id=\"u5aa247e7\">\u6709\u72b6\u6001\u6d41\u5904\u7406\uff1a\u901a\u8fc7\u5e95\u5c42API(\u5904\u7406\u51fd\u6570)\uff0c\u5bf9\u6700\u539f\u59cb\u6570\u636e\u52a0\u5de5\u5904\u7406\u3002\u5e95\u5c42API\u4e0eDdaSteamAPI\u76f8\u96c6\u6210\uff0c\u53ef\u4ee5\u5904\u7406\u590d\u6742\u7684\u8ba1\u7b97\u3002<\/p>\n<p id=\"ubccfe475\">DataSteamAPI(\u6d41\u5904\u7406) \u548c DataSetAPI(\u6279\u5904\u7406)\u5c01\u88c5\u4e86\u5e95\u5c42\u5904\u7406\u51fd\u6570\uff0c\u63d0\u4f9b\u4e86\u901a\u7528\u7684\u6a21\u5757\uff0c\u6bd4\u5982\u8f6c\u6362(tansfonmations\uff0c\u5305\u62ecfatmap\u7b49)\uff0c\u8fde\u63a5(joins)\uff0c\u805a\u5408(aggregations)\uff0c\u7a97\u53e3(windows)\u64cd\u4f5c\u7b49\u3002\u6ce8\u610f:Fnk1.12\u4ee5\u540e\uff0cDataSteamAPI\u5df2\u7ecf\u5b9e\u73b0map\u3001\u771f\u6b63\u7684\u6d41\u6279\u4e00\u4f53\uff0c\u6240\u4ee5DataSetAPI\u5df2\u7ecf\u8fc7\u65f6\u3002<\/p>\n<p id=\"ucaba5bcd\">TableAPI\u662f\u4ee5\u8868\u4e3a\u4e2d\u5fc3\u7684\u58f0\u660e\u5f0f\u7f16\u7a0b\uff0c\u5176\u4e2d\u8868\u53ef\u80fd\u4f1a\u52a8\u6001\u53d8\u5316\u3002TableAPI\u9075\u5faa\u5173\u7cfb\u6a21\u578b:\u8868\u6709\u4e8c\u7ef4\u6570\u636e\u7ed3\u6784\uff0c\u7c7b\u4f3c\u4e8e\u5173\u7cfb\u6570\u636e\u5e93\u4e2d\u7684\u8868; \u540c\u65f6API\u63d0\u4f9b\u53ef\u6bd4\u8f83\u7684\u64cd\u4f5c\uff0c\u4f8b\u5982select\u3001project\u3001join\u3001group-by\u3001aggregate\u7b49\u3002\u6211\u4eec\u53ef\u4ee5\u5728\u8868\u4e0e DataSteamDataset\u4e4b\u95f4\u65e0\u7f1d\u5207\u6362\uff0c\u4ee5\u5141\u8bb8\u7a0b\u5e8f\u5c06 TableAPl\u4e0eDataStream \u4ee5\u53ca DataSet \u6df7\u5408\u4f7f\u7528\u3002<\/p>\n<p id=\"ufc413554\">SOL\u8fd9\u4e00\u5c42\u5728\u8bed\u6cd5\u4e0e\u8868\u8fbe\u80fd\u529b\u4e0a\u4e0eTable API\u7c7b\u4f3c\uff0c\u4f46\u662f\u662f\u4ee5SOL\u67e5\u8be2\u8868\u8fbe\u5f0f\u7684\u5f62\u5f0f\u8868\u73b0\u7a0b\u5e8f\u3002SOL\u62bd\u8c61\u4e0etIabe API\u4ea4\u4e92\u5bc6\u5207\uff0c\u540c\u65f6SOL\u67e5\u8be2\u53ef\u4ee5\u76f4\u63a5\u5728Table API\u5b9a\u4e49\u7684\u8868\u4e0a\u6267\u884c.<\/p>\n<p id=\"ufea79d22\">\n<h3 id=\"HiHll\">Flink \u8fd0\u884c\u65f6\u67b6\u6784<\/h3>\n<p id=\"u0c55b264\">\u8fd9\u91cc\u4ee5\u5355\u5217\u90e8\u7f72\u6a21\u5f0f\u4e3a\u5217<\/p>\n<p id=\"u163b70f1\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"527\" id=\"ue5e67c25\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104856-6983241873d43.png\" width=\"1100\"><\/p>\n<h4 id=\"mr3iX\">\u4f5c\u4e1a\u7ba1\u7406\u5668\uff08JobManager\uff09<\/h4>\n<p id=\"ufeda9e80\">JobManager = Flink \u96c6\u7fa4\u91cc\u7684\u5927\u8111 + \u7ba1\u5bb6<\/p>\n<p id=\"ufad701ac\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a JobManager \u662f\u6574\u4e2a Flink \u4f5c\u4e1a\u7684\u201c\u603b\u6307\u6325\u5b98\u201d\uff0c\u8d1f\u8d23\u63a5\u6536\u4f60\u63d0\u4ea4\u7684\u4ee3\u7801\u3001\u628a\u4f5c\u4e1a\u62c6\u6210\u5c0f\u4efb\u52a1\u3001\u7ed9\u6bcf\u4e2a TaskManager \u53d1\u547d\u4ee4\u3001\u534f\u8c03 Checkpoint\u3001\u76d1\u63a7\u6240\u6709\u4efb\u52a1\u7684\u751f\u6b7b\uff0c\u4e00\u65e6\u51fa\u4e8b\u5c31\u8d1f\u8d23\u91cd\u542f\u6062\u590d\u3002<\/p>\n<p id=\"u10fed642\">\u5b83\u5e72\u7684\u4e09\u4ef6\u6700\u6838\u5fc3\u7684\u4e8b\uff1a<\/p>\n<li id=\"ua494c544\">\u628a\u4f60\u7684\u4ee3\u7801\uff08JobGraph\uff09\u53d8\u6210\u53ef\u4ee5\u5e76\u884c\u6267\u884c\u7684\u56fe\uff08ExecutionGraph\uff09<\/li>\n<li id=\"ua0ff9192\">\u51b3\u5b9a\u6bcf\u4e2a\u5c0f\u4efb\u52a1\u8dd1\u5728\u54ea\u4e2a TaskManager \u7684\u54ea\u4e2a slot \u4e0a<\/li>\n<li id=\"u58fc2bcd\">\u5168\u5c40\u534f\u8c03 Checkpoint \u548c\u6545\u969c\u6062\u590d\uff08Exactly-once \u7684\u771f\u6b63\u6307\u6325\u5b98\uff09<\/li>\n<p id=\"uca66a6a5\">\u4e00\u4e2a Flink \u96c6\u7fa4\u6c38\u8fdc\u53ea\u6709\u4e00\u4e2a\u6d3b\u8dc3\u7684 JobManager\uff08\u9ad8\u53ef\u7528\u65f6\u6709 standby\uff09\uff0c\u6240\u6709\u4f5c\u4e1a\u90fd\u5f52\u5b83\u7ba1\uff0c\u5b83\u6302\u4e86 = \u6574\u4e2a\u96c6\u7fa4\u6240\u6709\u4f5c\u4e1a\u5168\u505c\u3002<\/p>\n<p id=\"u9405b547\">\uff08\u7ec6\u8282\u53ef\u4ee5\u53bb\u770b\u5b98\u7f51\u6559\u7a0b\uff0c\u4e3b\u8981\u662f\uff09<\/p>\n<h4 id=\"QE9EI\">\u4efb\u52a1\u7ba1\u7406\u5668\uff08TaskManager\uff09<\/h4>\n<p id=\"uc35c4cd9\">TaskManager \u662f\u771f\u6b63\u6267\u884c\u8ba1\u7b97\u7684 JVM \u8fdb\u7a0b\uff0c\u8d1f\u8d23\u63a5\u6536 JobManager \u6d3e\u53d1\u7684\u5b50\u4efb\u52a1\uff08subtask\uff09\uff0c\u5728\u81ea\u5df1\u7684 Slot \u91cc\u8dd1\u7b97\u5b50\u4ee3\u7801\u3001\u7ba1\u7406\u672c\u5730\u72b6\u6001\u3001\u505a Checkpoint \u5feb\u7167\u3001\u8ddf\u5176\u4ed6 TaskManager \u4ea4\u6362\u6570\u636e\uff0c\u5b83\u662f\u96c6\u7fa4\u91cc\u201c\u5e72\u4f53\u529b\u6d3b\u201d\u7684\u5730\u65b9\u3002<\/p>\n<h3 id=\"a3d27498\">Flink \u6838\u5fc3\u6982\u5ff5<\/h3>\n<h4 id=\"JvCwl\">1. \u5e76\u884c\u5ea6\uff08Parallelism\uff09<\/h4>\n<p id=\"uf3ee5939\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"557\" id=\"u663ec523\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104856-69832418b811e.png\" width=\"1201\"><\/p>\n<h5 id=\"GdED8\">1.1. \u5e76\u884c\u5ea6\uff08Parallelism\uff09\u4e00\u53e5\u8bdd\u6982\u8ff0<\/h5>\n<p id=\"u7d55a43d\">\u5e76\u884c\u5ea6 = \u4e00\u4e2a\u7b97\u5b50\u540c\u65f6\u6709\u591a\u5c11\u4e2a\u5e76\u884c\u5b9e\u4f8b\u5728\u5e72\u6d3b\uff0c\u5b83\u76f4\u63a5\u51b3\u5b9a\u4f60\u7684\u4f5c\u4e1a\u80fd\u591a\u5feb\u3001\u80fd\u5403\u591a\u5c11\u6570\u636e\u3002<\/p>\n<p id=\"ud1f8e9c0\">\u7528\u5927\u767d\u8bdd\uff1a \u60f3\u8c61\u4f60\u8981\u628a 1000 \u4e2a\u82f9\u679c\u524a\u76ae\u3002<\/p>\n<ul>\n<li id=\"u356df0cb\">\u5e76\u884c\u5ea6 = 1 \u2192 \u4f60\u4e00\u4e2a\u4eba\u524a\uff0c\u6162\u6162\u6765<\/li>\n<li id=\"u28140a05\">\u5e76\u884c\u5ea6 = 8 \u2192 8 \u4e2a\u4eba\u4e00\u8d77\u524a\uff0c\u7406\u8bba\u4e0a\u5feb 8 \u500d Flink \u91cc\u6bcf\u4e00\u4e2a\u7b97\u5b50\uff08source\u3001map\u3001keyBy\/window\u3001sink\uff09\u90fd\u53ef\u4ee5\u5355\u72ec\u8bbe\u7f6e\u5e76\u884c\u5ea6\u3002<\/li>\n<\/ul>\n<h5 id=\"UFnCJ\">1.2. \u5e76\u884c\u5ea6\u5230\u5e95\u51b3\u5b9a\u4ec0\u4e48\uff1f<\/h5>\n<li id=\"u79fe99c0\">\u4f5c\u4e1a\u6574\u4f53\u5e76\u884c\u5ea6 = \u6240\u6709\u7b97\u5b50\u4e2d\u6700\u5927\u7684\u5e76\u884c\u5ea6<\/li>\n<li id=\"u64a09f75\">\u5e76\u884c\u5ea6\u8d8a\u9ad8\uff0c\u541e\u5410\u8d8a\u5927\uff08\u524d\u63d0\u662f\u4e0b\u6e38\u8ddf\u5f97\u4e0a\u3001\u96c6\u7fa4 slot \u591f\uff09<\/li>\n<li id=\"u613eec53\">\u5e76\u884c\u5ea6\u5fc5\u987b \u2264 \u96c6\u7fa4\u603b slot \u6570\uff0c\u5426\u5219\u4f5c\u4e1a\u8d77\u4e0d\u6765<\/li>\n<h5 id=\"zVLcX\">1.3. \u5b9e\u9645\u751f\u4ea7\u4e2d\u6700\u5e38\u7528\u7684 4 \u79cd\u8bbe\u7f6e\u65b9\u5f0f\uff08\u4f18\u5148\u7ea7\u4ece\u9ad8\u5230\u4f4e\uff09<\/h5>\n<table id=\"HYaum\">\n<tbody>\n<tr>\n<td>\n<p id=\"u1e7c5272\">\u8bbe\u7f6e\u65b9\u5f0f<\/p>\n<\/td>\n<td>\n<p id=\"u634ae5a1\">\u4ee3\u7801\/\u547d\u4ee4\u793a\u4f8b<\/p>\n<\/td>\n<td>\n<p id=\"udc835511\">\u9002\u7528\u573a\u666f<\/p>\n<\/td>\n<td>\n<p id=\"u4ce7450b\">\u4f18\u5148\u7ea7<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uc7a36ec1\">1. \u7b97\u5b50\u7ea7\u522b\u5355\u72ec\u8bbe\u7f6e<\/p>\n<\/td>\n<td>\n<p id=\"uc0886749\">.keyBy(&#8230;).window(&#8230;).sum(0).setParallelism(16) \u6700\u5e38\u7528\uff01<\/p>\n<\/td>\n<td>\n<p id=\"u26dca48a\">\u67d0\u4e2a\u7b97\u5b50\u662f\u70ed\u70b9\uff0c\u60f3\u5355\u72ec\u7ed9\u4ed6\u5f00\u591a\u7ebf\u7a0b<\/p>\n<\/td>\n<td>\n<p id=\"ua4e410e7\">\u2605\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u2bf9ec8d\">2. \u63d0\u4ea4\u4f5c\u4e1a\u65f6\u7528 -p \u6307\u5b9a<\/p>\n<\/td>\n<td>\n<p id=\"u3a0dedfb\">flink run -p 128 wordcount.jar<\/p>\n<\/td>\n<td>\n<p id=\"u023d8e19\">\u5feb\u901f\u8c03\u6574\u4f53\u5e76\u884c\u5ea6\uff0c\u4e0d\u60f3\u6539\u4ee3\u7801<\/p>\n<\/td>\n<td>\n<p id=\"ud0a777e3\">\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u1e4d2bd8\">3. \u4ee3\u7801\u91cc\u5168\u5c40\u8bbe\u7f6e<\/p>\n<\/td>\n<td>\n<p id=\"udd313283\">env.setParallelism(64)<\/p>\n<\/td>\n<td>\n<p id=\"u4a8dadc3\">\u5f00\u53d1\u6d4b\u8bd5\u65f6\u7528\uff0c\u751f\u4ea7\u4e0d\u63a8\u8350<\/p>\n<\/td>\n<td>\n<p id=\"u5d6be9e1\">\u2605\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u3b7cc72a\">4. flink-conf.yaml \u9ed8\u8ba4<\/p>\n<\/td>\n<td>\n<p id=\"u0acfed22\">parallelism.default: 64<\/p>\n<\/td>\n<td>\n<p id=\"uc3f62c8b\">\u6574\u4e2a\u96c6\u7fa4\u9ed8\u8ba4\u503c\uff0c\u6700\u540e\u624b\u6bb5<\/p>\n<\/td>\n<td>\n<p id=\"ub63640ff\">\u2605\u2605<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5 id=\"IMNJ5\">1.4. \u771f\u5b9e\u751f\u4ea7\u63a8\u8350\u505a\u6cd5<\/h5>\n<li id=\"ufa566f85\">\u4ee3\u7801\u91cc\u53ea\u7ed9\u70ed\u70b9\u7b97\u5b50\u5355\u72ec setParallelism\uff08\u6bd4\u5982 window\u3001join\u3001sink\uff09Java<\/li>\n<p>stream<br \/>\n.keyBy(&#8230;)<br \/>\n.window(TumblingEventTimeWindows.of(Time.minutes(1)))<br \/>\n.sum(0)<br \/>\n.setParallelism(32)    \/\/ \u7a97\u53e3\u805a\u5408\u662f\u70ed\u70b9\uff0c\u5f00 32<br \/>\n.addSink(new ClickHouseSink())<br \/>\n.setParallelism(8);    \/\/ ClickHouse \u5199\u538b\u529b\u5927\uff0c\u5f00 8 \u5c31\u591f <\/p>\n<li id=\"u31781a3d\">\u63d0\u4ea4\u4f5c\u4e1a\u65f6\u7528 -p \u7edf\u4e00\u63a7\u5236\u6574\u4f53\u5e76\u884c\u5ea6Bash<\/li>\n<p>flink run -p 200 -c com.xxx.MyJob myjob.jar <\/p>\n<h5 id=\"pKmdd\">1.5. \u8bb0\u4f4f\u8fd9\u51e0\u4e2a\u9ec4\u91d1\u6570\u5b57\uff08\u751f\u4ea7\u5e38\u89c1\u503c\uff09<\/h5>\n<ul>\n<li id=\"ua2e42501\">Kafka Source\uff1a\u4e00\u822c\u548c\u5206\u533a\u6570\u5bf9\u9f50\uff08\u6bd4\u5982 24 \u5206\u533a \u2192 \u5e76\u884c\u5ea6 24\uff09<\/li>\n<li id=\"ud1b72e1b\">\u7a97\u53e3\u805a\u5408\uff1aCPU \u6838\u5fc3\u6570\u7684 2~4 \u500d\uff08\u6bd4\u5982 32 \u6838\u673a\u5668\uff0c\u5f00 64~128\uff09<\/li>\n<li id=\"u581bd1a0\">JDBC\/MySQL Sink\uff1a3~12\uff08MySQL \u625b\u4e0d\u4f4f\u592a\u591a\uff09<\/li>\n<li id=\"udea8816e\">ClickHouse\/Doris Sink\uff1a8~32\uff08\u770b\u5e93\u6027\u80fd\uff09<\/li>\n<\/ul>\n<p id=\"u52f1c4ae\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a \u5e76\u884c\u5ea6\u5c31\u662f\u4f60\u7ed9\u7b97\u5b50\u96c7\u4e86\u591a\u5c11\u4e2a\u5de5\u4eba\u5e72\u6d3b\uff0c\u751f\u4ea7\u4e2d\u6c38\u8fdc\u662f\u201c\u70ed\u70b9\u7b97\u5b50\u5355\u72ec setParallelism + \u63d0\u4ea4\u65f6 -p \u6574\u4f53\u63a7\u5236\u201d\u4e24\u62db\u641e\u5b9a 99% \u7684\u6027\u80fd\u95ee\u9898\u3002<\/p>\n<p id=\"u6f7b448b\">\n<h4 id=\"Re2t3\">2. \u7b97\u5b50\u94fe\uff08Operator Chain\uff09<\/h4>\n<p id=\"u937bf6a7\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"564\" id=\"uf18340c8\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104857-698324190cafc.png\" width=\"1180\"><\/p>\n<p id=\"u8af72336\">\u7b97\u5b50\u94fe = Flink \u628a\u5e76\u884c\u5ea6\u76f8\u540c\u3001\u4e14\u662f\u4e00\u5bf9\u4e00\uff08one-to-one\uff09\u5173\u7cfb\u7684\u591a\u4e2a\u7b97\u5b50\u201c\u710a\u63a5\u201d\u6210\u4e00\u4e2a\u4efb\u52a1\uff0c\u653e\u5728\u540c\u4e00\u4e2a\u7ebf\u7a0b\u91cc\u8dd1\uff0c\u4ece\u800c\u7701\u6389\u4e0d\u5fc5\u8981\u7684\u5e8f\u5217\u5316\/\u7f51\u7edc\u4f20\u8f93\u5f00\u9500\uff0c\u662f Flink \u6027\u80fd\u6740\u624b\u950f\u4e4b\u4e00\u3002<\/p>\n<p id=\"u9c53cd3c\">\u7528\u5927\u767d\u8bdd\u6bd4\u55bb\uff1a \u672c\u6765 source \u2192 map \u2192 filter \u2192 map \u8fd9 4 \u4e2a\u5de5\u4eba\u8981 4 \u4e2a\u5de5\u4f4d\u3001\u4e92\u76f8\u6254\u6765\u6254\u53bb\uff08\u5e8f\u5217\u5316 + \u7f51\u7edc\uff09\u3002 Flink \u53d1\u73b0\u4ed6\u4eec\u5e76\u884c\u5ea6\u90fd\u4e00\u6837\u3001\u6570\u636e\u987a\u5e8f\u4e5f\u4e0d\u4e71\uff0c\u5c31\u76f4\u63a5\u628a 4 \u4e2a\u4eba\u710a\u6210\u4e00\u4e2a\u201c\u56db\u5934\u602a\u201d\uff0c\u5728\u4e00\u4e2a\u7ebf\u7a0b\u91cc\u987a\u5e8f\u6267\u884c\uff0c\u7701\u4e86 3 \u6b21\u201c\u6254\u6765\u6254\u53bb\u201d\uff0c\u6027\u80fd\u76f4\u63a5\u8d77\u98de\u3002<\/p>\n<p id=\"u7728c890\">\n<h5 id=\"nzsfr\">2.1. \u4ec0\u4e48\u65f6\u5019\u80fd\u94fe\uff1f\u4ec0\u4e48\u65f6\u5019\u4e0d\u80fd\u94fe\uff1f<\/h5>\n<table id=\"H4aRZ\">\n<tbody>\n<tr>\n<td>\n<p id=\"ue4ea856a\">\u60c5\u51b5<\/p>\n<\/td>\n<td>\n<p id=\"u68ed3c88\">\u662f\u5426\u80fd\u94fe\u5728\u4e00\u8d77<\/p>\n<\/td>\n<td>\n<p id=\"ud2f02f6e\">\u4e3e\u4f8b\u8bf4\u660e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ue1ad5ed8\">\u5e76\u884c\u5ea6\u76f8\u540c<\/p>\n<\/td>\n<td>\n<p id=\"ud8507ae9\">\u80fd<\/p>\n<\/td>\n<td>\n<p id=\"u1aaf6fda\">\u90fd\u662f 64 \u2192 \u80fd\u94fe<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u6b2a84ed\">\u5e76\u884c\u5ea6\u4e0d\u540c<\/p>\n<\/td>\n<td>\n<p id=\"ua7af9cbe\">\u4e00\u5b9a\u4e0d\u80fd\u94fe<\/p>\n<\/td>\n<td>\n<p id=\"udcf559de\">source 64\uff0cmap 32 \u2192 \u5fc5\u987b\u65ad\u5f00<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u79024c71\">one-to-one \u64cd\u4f5c<\/p>\n<\/td>\n<td>\n<p id=\"ua4b6cf10\">\u80fd<\/p>\n<\/td>\n<td>\n<p id=\"u0de926bb\">map\u3001filter\u3001flatMap\u3001select\u3001where<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u00d360ec\">\u9700\u8981\u91cd\u65b0\u5206\u533a\uff08redistribute\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u5d823b28\">\u4e00\u5b9a\u4e0d\u80fd\u94fe<\/p>\n<\/td>\n<td>\n<p id=\"ucf9ed1c0\">keyBy\u3001shuffle\u3001rebalance\u3001broadcast<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u9b9b4080\">\u624b\u52a8\u7981\u7528\u4e86\u94fe<\/p>\n<\/td>\n<td>\n<p id=\"ufc5bf332\">\u4e0d\u80fd<\/p>\n<\/td>\n<td>\n<p id=\"u9e5a8789\">disableChaining()\u3001startNewChain()<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5 id=\"ArgrV\">2.2. \u5b9e\u9645\u751f\u4ea7\u4e2d\u600e\u4e48\u64cd\u4f5c\u7b97\u5b50\u94fe<\/h5>\n<table id=\"Mtfq4\">\n<tbody>\n<tr>\n<td>\n<p id=\"ua73c0ded\">\u64cd\u4f5c\u9700\u6c42<\/p>\n<\/td>\n<td>\n<p id=\"u65914d64\">\u4ee3\u7801\u600e\u4e48\u5199\uff08Java\/Scala \u901a\u7528\uff09<\/p>\n<\/td>\n<td>\n<p id=\"ua1dd139e\">\u751f\u4ea7\u573a\u666f\u4e3e\u4f8b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u3dcc48b8\">1. \u60f3\u8ba9\u67d0\u4e2a\u7b97\u5b50\u8ddf\u524d\u9762\u65ad\u5f00<\/p>\n<\/td>\n<td>\n<p id=\"u49e7cd8f\">.disableChaining()<\/p>\n<\/td>\n<td>\n<p id=\"u93dfa737\">sink \u4e4b\u524d\u52a0 disableChaining()\uff0c\u9632\u6b62 sink \u62d6\u6162\u4e0a\u6e38<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u5098808f\">2. \u4ece\u67d0\u4e2a\u7b97\u5b50\u5f00\u59cb\u91cd\u65b0\u5f00\u4e00\u6761\u94fe<\/p>\n<\/td>\n<td>\n<p id=\"ua40d3355\">.startNewChain()<\/p>\n<\/td>\n<td>\n<p id=\"u1873a3e9\">keyBy \u4e4b\u540e startNewChain()\uff0c\u8ba9\u7a97\u53e3\u5355\u72ec\u6210\u94fe<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uac2c94b8\">3. \u7ed9\u67d0\u4e2a\u7b97\u5b50\u5355\u72ec\u6307\u5b9a slot \u5171\u4eab\u7ec4\uff08\u6700\u5f3a\u63a7\u5236\uff09<\/p>\n<\/td>\n<td>\n<p id=\"uabf7e992\">.slotSharingGroup(\\&#8221;xxx\\&#8221;)<\/p>\n<\/td>\n<td>\n<p id=\"u27ff2550\">\u70ed\u70b9\u7b97\u5b50\u5355\u72ec\u653e\u4e00\u7ec4 slot\uff0c\u9632\u6b62\u4e92\u76f8\u62a2\u8d44\u6e90<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"uf6dedd35\">\u771f\u5b9e\u751f\u4ea7\u4ee3\u7801\u4f8b\u5b50\uff1a<\/p>\n<p>stream<br \/>\n.map(&#8230;)                          \/\/ \u9ed8\u8ba4\u8ddf\u524d\u9762\u94fe\u5728\u4e00\u8d77<br \/>\n.filter(&#8230;)<br \/>\n.map(&#8230;)<\/p>\n<p>.keyBy(&#8230;)                        \/\/ \u8fd9\u91cc\u81ea\u52a8\u65ad\u94fe\uff08\u56e0\u4e3a\u8981 shuffle\uff09<\/p>\n<p>.window(&#8230;)                       \/\/ \u7a97\u53e3\u5f00\u59cb\u65b0\u94fe<br \/>\n.sum(0)<br \/>\n.startNewChain()                   \/\/ \u5f3a\u5236\u4ece\u7a97\u53e3\u5f00\u59cb\u65b0\u94fe\uff08\u53ef\u9009\uff09<\/p>\n<p>.map(new RichMapFunction(&#8230;))     \/\/ Rich \u5f00\u72b6\u6001\uff0c\u81ea\u52a8\u65ad\u94fe<br \/>\n.disableChaining()                 \/\/ \u5f3a\u5236\u8ddf\u524d\u9762\u65ad\u5f00\uff08\u4fdd\u9669\uff09<\/p>\n<p>.addSink(new ClickHouseSink())     \/\/ sink \u4e00\u822c\u90fd\u5355\u72ec\u65ad\u5f00<br \/>\n.setParallelism(8)<br \/>\n.disableChaining();                \/\/ \u751f\u4ea7\u5fc5\u5199\uff01\u9632\u6b62 sink \u53cd\u538b\u62d6\u57ae\u6574\u4e2a\u94fe <\/p>\n<h5 id=\"SC9Xg\">2.3. \u751f\u4ea7\u4e2d\u6700\u5e38\u89c1\u7684 3 \u4e2a\u7b97\u5b50\u94fe\u9ec4\u91d1\u5199\u6cd5<\/h5>\n<table id=\"c3TfE\">\n<tbody>\n<tr>\n<td>\n<p id=\"uc8c38af5\">\u573a\u666f<\/p>\n<\/td>\n<td>\n<p id=\"u85211ad4\">\u63a8\u8350\u5199\u6cd5<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uf555d1b5\">\u5199 MySQL\/Redis\/ES \u7b49\u6162 sink<\/p>\n<\/td>\n<td>\n<p id=\"ude5acd37\">\u4e00\u5b9a\u5728 sink \u524d\u52a0 .disableChaining()<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uf5a92176\">\u7a97\u53e3\u805a\u5408\u662f\u70ed\u70b9<\/p>\n<\/td>\n<td>\n<p id=\"u4b6a5f4b\">.window(&#8230;).sum(&#8230;).startNewChain()<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u412a1662\">\u60f3\u5b8c\u5168\u638c\u63a7\u94fe\u7684\u5212\u5206<\/p>\n<\/td>\n<td>\n<p id=\"ucb67984b\">\u7ed9\u6bcf\u4e2a\u5927\u7b97\u5b50\u90fd\u624b\u52a8\u52a0 slotSharingGroup<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p id=\"uca9d9ee8\">.slotSharingGroup(\\&#8221;source\\&#8221;) \u2192 source \u5355\u72ec\u4e00\u7ec4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p id=\"u717d513d\">.slotSharingGroup(\\&#8221;window\\&#8221;) \u2192 \u7a97\u53e3\u5355\u72ec\u4e00\u7ec4<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td><\/td>\n<td>\n<p id=\"udf2fb8ec\">.slotSharingGroup(\\&#8221;default\\&#8221;) \u2192 \u5176\u4ed6\u9ed8\u8ba4<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"ud55d5172\">\u4e00\u53e5\u8bdd\u603b\u7ed3\uff1a \u7b97\u5b50\u94fe\u662f Flink \u514d\u8d39\u9001\u4f60\u7684\u6027\u80fd\u52a0\u901f\u5668\uff0c\u9ed8\u8ba4\u80fd\u94fe\u5c31\u94fe\uff0c\u4f46\u751f\u4ea7\u4e2d\u6c38\u8fdc\u8bb0\u5f97\u7ed9 sink \u548c\u70ed\u70b9\u7b97\u5b50\u4e3b\u52a8\u65ad\u94fe\uff08disableChaining\uff09\uff0c\u5426\u5219\u4e00\u65e6\u53cd\u538b\uff0c\u6574\u4e2a\u4f5c\u4e1a\u5168\u5361\u6b7b\u3002<\/p>\n<p id=\"u86cc139b\">\n<h4 id=\"FW3cs\">3. \u4efb\u52a1\u69fd\uff08Task Slots\uff09<\/h4>\n<p id=\"u5ae1161e\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"386\" id=\"ue7223ac3\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104857-6983241957d94.png\" width=\"1206\"><\/p>\n<h5 id=\"fJ7X2\">3.1. \u4efb\u52a1\u69fd\uff08Task Slots\uff09\u4e00\u53e5\u8bdd\u6982\u8ff0<\/h5>\n<p id=\"u4fe03d09\">Task Slot = TaskManager \u91cc\u7684\u4e00\u5757\u201c\u5de5\u4f4d\u201d\uff0c\u4e00\u4e2a Slot \u5c31\u662f\u4e00\u4e2a\u7ebf\u7a0b + \u4e00\u4efd\u56fa\u5b9a\u5185\u5b58\uff0c\u51b3\u5b9a\u4e86\u8fd9\u4e2a TaskManager \u540c\u4e00\u65f6\u523b\u6700\u591a\u80fd\u540c\u65f6\u8dd1\u591a\u5c11\u4e2a\u5e76\u884c\u5b50\u4efb\u52a1\uff08subtask\uff09\u3002<\/p>\n<p id=\"u901516cb\">\u7528\u6700\u901a\u4fd7\u7684\u6bd4\u55bb\uff1a \u4e00\u4e2a TaskManager \u5c31\u50cf\u5b66\u6821\u7684\u4e00\u95f4\u6559\u5ba4\uff0cSlot \u5c31\u662f\u6559\u5ba4\u91cc\u7684\u8bfe\u684c\u3002<\/p>\n<ul>\n<li id=\"ua2fc7d25\">\u6559\u5ba4\u6709 8 \u5f20\u8bfe\u684c\uff088 \u4e2a slot\uff09\u2192 \u6700\u591a\u540c\u65f6\u5750 8 \u4e2a\u5b66\u751f\uff088 \u4e2a subtask\uff09<\/li>\n<li id=\"u98c11f0b\">\u5b66\u751f\u53ef\u4ee5\u5171\u4eab\u8bfe\u684c\uff08\u9ed8\u8ba4\u5f00\u542f slot sharing\uff09<\/li>\n<li id=\"ue9f6bb45\">\u4f60\u4e5f\u53ef\u4ee5\u89c4\u5b9a\u67d0\u4e9b\u5b66\u751f\u53ea\u80fd\u5750\u6307\u5b9a\u989c\u8272\u7684\u8bfe\u684c\uff08slotSharingGroup\uff09<\/li>\n<\/ul>\n<h5 id=\"s2twv\">3.2. Task Slot \u548c Parallelism \u7684\u7ec8\u6781\u533a\u522b\uff08\u80cc\u4e0b\u6765\uff09<\/h5>\n<table id=\"vTxSq\">\n<tbody>\n<tr>\n<td>\n<p id=\"ua7cd0a3e\">\u540d\u8bcd<\/p>\n<\/td>\n<td>\n<p id=\"u9a4bf1a3\">\u542b\u4e49<\/p>\n<\/td>\n<td>\n<p id=\"u260583bc\">\u8c01\u51b3\u5b9a<\/p>\n<\/td>\n<td>\n<p id=\"ud3cb5218\">\u4e3e\u4f8b<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u85f7dc29\">Parallelism<\/p>\n<\/td>\n<td>\n<p id=\"ud76a0280\">\u6211\u603b\u5171\u9700\u8981\u591a\u5c11\u4e2a\u5de5\u4eba\u5e72\u6d3b<\/p>\n<\/td>\n<td>\n<p id=\"ud3b1deb7\">\u4f5c\u4e1a\u81ea\u5df1\u51b3\u5b9a<\/p>\n<\/td>\n<td>\n<p id=\"u85908261\">\u6211\u7684 window \u5e76\u884c\u5ea6 64 \u2192 \u9700\u8981 64 \u4e2a\u5de5\u4eba<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uf57ebecf\">Task Slot<\/p>\n<\/td>\n<td>\n<p id=\"u33605213\">\u6bcf\u4e2a\u5de5\u5382\uff08TaskManager\uff09\u6709\u51e0\u4e2a\u5de5\u4f4d<\/p>\n<\/td>\n<td>\n<p id=\"u06209da0\">\u96c6\u7fa4\u7ba1\u7406\u5458\u914d\u7f6e<\/p>\n<\/td>\n<td>\n<p id=\"u11bd0929\">\u6bcf\u53f0\u673a\u5668\u914d 8 \u4e2a slot \u2192 8 \u4e2a\u5de5\u4f4d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u1c5be493\">\u5173\u7cfb<\/p>\n<\/td>\n<td>\n<p id=\"ua87c11a6\">Parallelism \u2264 \u6240\u6709 TaskManager \u7684 Slot \u603b\u6570<\/p>\n<\/td>\n<td>\n<p id=\"u3fd902b6\">\u5426\u5219\u4f5c\u4e1a\u8d77\u4e0d\u6765<\/p>\n<\/td>\n<td>\n<p id=\"u1eec2dfc\">3 \u53f0\u673a \u00d7 8 slot = \u6700\u591a\u652f\u6301 24 \u5e76\u884c\u5ea6<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5 id=\"dGROE\">3.3. \u751f\u4ea7\u4e2d\u6700\u5e38\u7528\u7684 3 \u79cd\u64cd\u4f5c\uff08\u76f4\u63a5\u80cc\u4ee3\u7801\u548c\u547d\u4ee4\uff09<\/h5>\n<table id=\"POEd4\">\n<tbody>\n<tr>\n<td>\n<p id=\"ub39eaf72\">\u64cd\u4f5c\u9700\u6c42<\/p>\n<\/td>\n<td>\n<p id=\"u674f8889\">\u5177\u4f53\u600e\u4e48\u505a\uff08100% \u751f\u4ea7\u771f\u5b9e\u5199\u6cd5\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u1ab8f56f\">\u8bf4\u660e<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u58f8f203\">1. \u6539\u4e00\u53f0\u673a\u5668\u7684 slot \u6570\u91cf\uff08\u6700\u5e38\u7528\uff09<\/p>\n<\/td>\n<td>\n<p id=\"ub8cb12e8\">\u7f16\u8f91 flink-conf.yaml\uff08\u6bcf\u53f0\u673a\u5668\u90fd\u8981\u6539\uff09 taskmanager.numberOfTaskSlots: 16<\/p>\n<\/td>\n<td>\n<p id=\"uc2b002f7\">\u751f\u4ea7\u4e3b\u6d41\u914d\u7f6e\uff1a32\u6838\u673a\u5668\u914d 16~32 \u4e2a slot<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u291aed0b\">2. \u67d0\u4e2a\u7b97\u5b50\u72ec\u5360 slot\uff0c\u4e0d\u8ddf\u522b\u4eba\u5171\u4eab<\/p>\n<\/td>\n<td>\n<p id=\"uf8e484a9\">.slotSharingGroup(\\&#8221;heavy\\&#8221;)<\/p>\n<\/td>\n<td>\n<p id=\"u4d79d353\">\u9632\u6b62\u70ed\u70b9\u7b97\u5b50\u88ab\u8f7b\u91cf\u7ea7\u7b97\u5b50\u62a2\u8d44\u6e90<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u5d277095\">3. \u5b8c\u5168\u5173\u95ed slot \u5171\u4eab\uff08\u6781\u5c11\u7528\uff09<\/p>\n<\/td>\n<td>\n<p id=\"ufab7cece\">\u5168\u5c40\u5173\u95ed\uff08\u4e0d\u63a8\u8350\uff09 taskmanager.slot-sharing.enabled: false<\/p>\n<\/td>\n<td>\n<p id=\"u63a36034\">\u6bcf\u4e2a subtask \u72ec\u5360\u4e00\u4e2a slot\uff0c\u6d6a\u8d39\u8d44\u6e90\uff0c\u57fa\u672c\u6ca1\u4eba\u8fd9\u4e48\u5e72<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5 id=\"Fe4T6\">3.4. \u751f\u4ea7\u9ec4\u91d1\u914d\u7f6e\u6a21\u677f<\/h5>\n<p># flink-conf.yaml\uff08\u6bcf\u53f0 TaskManager \u90fd\u914d\u8fd9\u4e2a\uff09<br \/>\ntaskmanager.numberOfTaskSlots: 24          # 32\u6838\u673a\u5668\u6700\u5e38\u89c1\u914d 24<br \/>\ntaskmanager.memory.process.size: 32g       # \u603b\u5185\u5b58<br \/>\njobmanager.memory.process.size: 4g<\/p>\n<p># \u4ee3\u7801\u91cc\u70ed\u70b9\u7b97\u5b50\u5355\u72ec\u5206\u7ec4\uff08\u5f3a\u70c8\u63a8\u8350\uff09<br \/>\nstream<br \/>\n.source(&#8230;)                                      # \u9ed8\u8ba4\u7ec4<br \/>\n.map(&#8230;)<\/p>\n<p>.keyBy(&#8230;)<br \/>\n.window(&#8230;)                                      # \u70ed\u70b9\uff01<br \/>\n.process(new MyHeavyProcessFunction())<br \/>\n.slotSharingGroup(\\&#8221;window-heavy\\&#8221;)                 # \u5355\u72ec\u4e00\u7ec4 slot<\/p>\n<p>.addSink(new SlowMySQLSink())<br \/>\n.slotSharingGroup(\\&#8221;mysql-sink\\&#8221;)                   # \u6162 sink \u5355\u72ec\u4e00\u7ec4<br \/>\n.setParallelism(6); <\/p>\n<h5 id=\"bu8H2\">3.5. \u751f\u4ea7\u4e2d\u6700\u5e38\u89c1\u7684 3 \u4e2a slot \u914d\u7f6e\u7ecf\u9a8c\u503c<\/h5>\n<table id=\"Ejr3a\">\n<tbody>\n<tr>\n<td>\n<p id=\"uf2fbcc37\">\u673a\u5668\u89c4\u683c<\/p>\n<\/td>\n<td>\n<p id=\"ud3dd9a61\">\u63a8\u8350 slot \u6570<\/p>\n<\/td>\n<td>\n<p id=\"ua66fa253\">\u7406\u7531<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"uddece7d4\">16\u6838 64G<\/p>\n<\/td>\n<td>\n<p id=\"u6c260d76\">12~16<\/p>\n<\/td>\n<td>\n<p id=\"u6b1c50cd\">\u7559\u70b9\u5185\u5b58\u7ed9 RocksDB<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ud5af3b65\">32\u6838 128G<\/p>\n<\/td>\n<td>\n<p id=\"ua42431c6\">20~32<\/p>\n<\/td>\n<td>\n<p id=\"ue7a39832\">\u4e3b\u6d41\u914d\u7f6e\uff0c24 \u6700\u5e38\u89c1<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u85c3771e\">64\u6838 256G+<\/p>\n<\/td>\n<td>\n<p id=\"u8900b01c\">40~64<\/p>\n<\/td>\n<td>\n<p id=\"u5b9235d4\">\u5927\u72b6\u6001\u4f5c\u4e1a\u624d\u8fd9\u4e48\u914d<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h5 id=\"hcAfC\">3.6. \u4e00\u53e5\u8bdd\u603b\u7ed3<\/h5>\n<p id=\"uf22686f7\">Slot \u662f\u8d44\u6e90\uff08\u5de5\u4f4d\uff09\uff0cParallelism \u662f\u9700\u6c42\uff08\u5de5\u4eba\uff09 \u2192 \u5de5\u4eba\u4e0d\u80fd\u6bd4\u5de5\u4f4d\u591a \u2192 \u751f\u4ea7\u6c38\u8fdc\u5148\u770b\u96c6\u7fa4\u603b slot \u591f\u4e0d\u591f\uff0c\u518d\u51b3\u5b9a\u80fd\u5f00\u591a\u5927\u5e76\u884c\u5ea6 \u2192 \u70ed\u70b9\u7b97\u5b50\u4e00\u5b9a\u8981 slotSharingGroup \u5206\u7ec4\uff0c\u5426\u5219\u4e92\u76f8\u62a2 slot \u4e00\u5361\u5168\u5361\u3002<\/p>\n<p id=\"u70171d53\">\u8bb0\u4f4f\u8fd9\u4e09\u884c\u914d\u7f6e\uff0c90% \u7684\u6027\u80fd\u95ee\u9898\u90fd\u89e3\u51b3\u4e86\uff1a<\/p>\n<p>taskmanager.numberOfTaskSlots: 24 <\/p>\n<p id=\"u020e566a\">Java<\/p>\n<p>.window(&#8230;).slotSharingGroup(\\&#8221;heavy-window\\&#8221;)<br \/>\n.addSink(&#8230;).slotSharingGroup(\\&#8221;slow-sink\\&#8221;) <\/p>\n<p id=\"u01521221\">\n<p id=\"ue4692966\">\n<h2 id=\"pzoon\">\u4e09\u3001\u7b2c\u4e09\u90e8\u5206\uff1aDataStreamAPI<\/h2>\n<p id=\"u4d3430e5\">DataStream API \u662fFlink\u7684\u6838\u5fc3\u5c42API\u3002\u4e00\u4e2aFlink\u7a0b\u5e8f\uff0c\u5176\u5b9e\u5c31\u662f\u5bf9 DataStream (\u6570\u636e\u6d41) \u7684\u5404\u79cd\u8f6c\u6362\u3002\u5177\u4f53\u6765\u8bf4\uff0c\u4ee3\u7801\u57fa\u672c\u4e0a\u90fd\u7531\u4ee5\u4e0b\u51e0\u90e8\u5206\u6784\u6210\uff1a<\/p>\n<p id=\"u0af557f4\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"308\" id=\"u1e06304d\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104857-698324198846e.png\" width=\"1215\"><\/p>\n<p>StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();<\/p>\n<p>\/\/ 1. Source\uff08\u4ece\u54ea\u8bfb\uff09<br \/>\nDataStream&lt;String&gt; stream = env<br \/>\n    .fromSource(kafkaSource, WatermarkStrategy.noWatermarks(), \\&#8221;kafka\\&#8221;);<\/p>\n<p>\/\/ 2. Transform\uff08\u600e\u4e48\u7b97<br \/>\nstream<br \/>\n    .map(json -&gt; parse(json))                 \/\/ \u89e3\u6790<br \/>\n    .filter(obj -&gt; obj != null)<br \/>\n    .assignTimestampsAndWatermarks(watermarkStrategy)  \/\/ \u4e8b\u4ef6\u65f6\u95f4 + \u6c34\u5370\uff08\u91cd\u70b9\uff09<br \/>\n    .keyBy(obj -&gt; obj.id)<br \/>\n    .window(TumblingEventTimeWindows.of(Time.minutes(1)))  \/\/ \u7a97\u53e3<br \/>\n    .aggregate(new MyAggFunction())           \/\/ \u805a\u5408\uff08\u6216\u8005 .sum()\/.reduce()\uff09\u7b49\u7b49<\/p>\n<p>\/\/ 3. Sink\uff08\u5199\u5230\u54ea\u53bb\uff09<br \/>\n    .addSink(new ClickHouseSink())<br \/>\n    .setParallelism(8)<br \/>\n    .slotSharingGroup(\\&#8221;ck-sink\\&#8221;);             \/\/ \u751f\u4ea7\u5fc5\u5199 \u9632\u6b62\u53cd\u538b\u4f20\u67d3<\/p>\n<p>env.execute(\\&#8221;my-real-time-job\\&#8221;); <\/p>\n<p id=\"u7b3181af\">\n<h3 id=\"kuA5A\">1\u3001\u6267\u884c\u73af\u5883\uff08\u5fc5\u987b\u7b2c\u4e00\u6b65\uff09<\/h3>\n<p id=\"uf97c5aea\">\u6700\u7b80\u5355\u7684\u65b9\u5f0f\uff0c\u5c31\u662f\u76f4\u63a5\u8c03\u7528getExecutionEnvironment\u65b9\u6cd5\u3002\u5b83\u4f1a\u6839\u636e\u5f53\u524d\u8fd0\u884c\u7684\u4e0a\u4e0b\u6587\u76f4\u63a5\u5f97\u5230\u6b63\u786e\u7684\u7ed3\u679c\uff1a\u5982\u679c\u7a0b\u5e8f\u662f\u72ec\u7acb\u8fd0\u884c\u7684\uff0c\u5c31\u8fd4\u56de\u4e00\u4e2a\u672c\u5730\u6267\u884c\u73af\u5883\uff1b\u5982\u679c\u662f\u521b\u5efa\u4e86jar\u5305\uff0c\u7136\u540e\u4ece\u547d\u4ee4\u884c\u8c03\u7528\u5b83\u5e76\u63d0\u4ea4\u5230\u96c6\u7fa4\u6267\u884c\uff0c\u90a3\u4e48\u5c31\u8fd4\u56de\u96c6\u7fa4\u7684\u6267\u884c\u73af\u5883\u3002\u4e5f\u5c31\u662f\u8bf4\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u4f1a\u6839\u636e\u5f53\u524d\u8fd0\u884c\u7684\u65b9\u5f0f\uff0c\u81ea\u884c\u51b3\u5b9a\u8be5\u8fd4\u56de\u4ec0\u4e48\u6837\u7684\u8fd0\u884c\u73af\u5883\u3002<\/p>\n<p>StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();<br \/>\n\/\/ \u53ef\u9009\uff1a\u8bbe\u7f6e\u5e76\u884c\u5ea6\u3001\u5f00\u542f Checkpoint<br \/>\nenv.setParallelism(1);                          \/\/ \u5168\u5c40\u5e76\u884c\u5ea6\uff08\u751f\u4ea7\u614e\u7528\uff09<br \/>\nenv.enableCheckpointing(10000L);                \/\/ \u5f00\u542f Exactly-once Checkpoint <\/p>\n<p id=\"u3de6aa12\">\uff08\u5982\u679c\u751f\u4ea7\u4f7f\u7528\u7684\u662f\u4e91\u4ea7\u54c1\u90e8\u7f72\uff0c\u8fd9\u91cc\u4ee3\u7801\u91cc\u9762\u5c31\u4e0d\u8981\u5199\u6b7b\u5904\u7406Checkpoint\uff09<\/p>\n<p id=\"u1b029ff8\">\n<p id=\"u4a7a0e93\">\n<h3 id=\"mktUp\">2\u3001Source\uff08\u4ece\u54ea\u513f\u8bfb\u6570\u636e\uff09<\/h3>\n<p id=\"u6248b7ce\">Source \u662f\u6574\u4e2a Flink \u4f5c\u4e1a\u7684\u5165\u53e3\uff0c\u51b3\u5b9a\u4e86\u6570\u636e\u4ece\u54ea\u513f\u6765\u3001\u600e\u4e48\u6765\u3001\u662f\u5426\u5e26\u4e8b\u4ef6\u65f6\u95f4\u3002 \u751f\u4ea7\u4e2d 90% \u7684 Source \u90fd\u662f Kafka\uff0c\u5269\u4e0b 10% \u662f\u6d4b\u8bd5\/\u6587\u4ef6\/\u81ea\u5b9a\u4e49\u3002<\/p>\n<p id=\"ubcb878c9\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"145\" id=\"u774e64f8\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104857-69832419ae901.png\" width=\"1201\"><\/p>\n<p id=\"u32c75f34\">\n<h4 id=\"VLbmK\">1. Source \u5206\u7c7b &amp; \u4f7f\u7528\u9891\u7387<\/h4>\n<table id=\"MrGcX\">\n<tbody>\n<tr>\n<td>\n<p id=\"u438d3ecf\">\u7c7b\u578b<\/p>\n<\/td>\n<td>\n<p id=\"u0b0728b3\">\u4f7f\u7528\u573a\u666f<\/p>\n<\/td>\n<td>\n<p id=\"u79ee38a0\">\u751f\u4ea7\u9891\u7387<\/p>\n<\/td>\n<td>\n<p id=\"u9c0c62ce\">\u63a8\u8350\u5ea6<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u18b81a05\">Kafka<\/p>\n<\/td>\n<td>\n<p id=\"u23edad2a\">\u751f\u4ea7\u5b9e\u65f6\u6570\u636e\u5165\u53e3<\/p>\n<\/td>\n<td>\n<p id=\"u51951f7b\">\u2605\u2605\u2605\u2605\u2605<\/p>\n<\/td>\n<td>\n<p id=\"u5ddd2d93\">\u5fc5\u5b66<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u791a306d\">\u6587\u4ef6\uff08File\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u27deba04\">\u6279\u5904\u7406\u6216\u5c0f\u6570\u636e\u6d4b\u8bd5<\/p>\n<\/td>\n<td>\n<p id=\"u3e29046e\">\u2605\u2605<\/p>\n<\/td>\n<td>\n<p id=\"u7e81aedd\">\u4e86\u89e3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u3f77c4b7\">\u96c6\u5408\uff08Collection\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u2f4d1c23\">\u672c\u5730\u6d4b\u8bd5\u3001\u5355\u5143\u6d4b\u8bd5<\/p>\n<\/td>\n<td>\n<p id=\"uc2e4faca\">\u2605\u2605\u2605<\/p>\n<\/td>\n<td>\n<p id=\"u45192b04\">\u5e38\u7528<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u199317ea\">Socket<\/p>\n<\/td>\n<td>\n<p id=\"uc70cb4d0\">\u5feb\u901f\u9a8c\u8bc1\u3001nc \u6d4b\u8bd5<\/p>\n<\/td>\n<td>\n<p id=\"u188fdcd9\">\u2605\u2605<\/p>\n<\/td>\n<td>\n<p id=\"uc761d6b2\">\u4e86\u89e3<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u02e89178\">DataGen<\/p>\n<\/td>\n<td>\n<p id=\"u7b632696\">\u6027\u80fd\u6d4b\u8bd5\u3001\u538b\u6d4b<\/p>\n<\/td>\n<td>\n<p id=\"u7e4dfe32\">\u2605\u2605\u2605<\/p>\n<\/td>\n<td>\n<p id=\"ueff14d41\">\u63a8\u8350<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u09315063\">\u81ea\u5b9a\u4e49 Source<\/p>\n<\/td>\n<td>\n<p id=\"u5072bbeb\">\u7279\u6b8a\u6570\u636e\u6e90\uff08MySQL\/Redis \u7b49\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u79181d5f\">\u2605\u2605\u2605<\/p>\n<\/td>\n<td>\n<p id=\"uafef8483\">\u8fdb\u9636<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p id=\"u10285784\">\u751f\u4ea7\u63a8\u8350\uff1aKafka + WatermarkStrategy\uff08\u4e8b\u4ef6\u65f6\u95f4 + \u6c34\u5370\uff09\u3002<\/p>\n<p id=\"u1f47d3dc\">\n<h4 id=\"XNhKV\">2. Kafka Source (\u751f\u4ea7\u4e3b\u529b)<\/h4>\n<p>\/\/ \u52a0 flink-connector-kafka \u4f9d\u8d56<br \/>\nKafkaSource&lt;WaterSensor&gt; kafkaSource = KafkaSource.&lt;WaterSensor&gt;builder()<br \/>\n    .setBootstrapServers(\\&#8221;hadoop102:9092,hadoop103:9092\\&#8221;)<br \/>\n    .setTopics(\\&#8221;sensor-topic\\&#8221;)<br \/>\n    .setGroupId(\\&#8221;flink-group-01\\&#8221;)<br \/>\n    .setStartingOffsets(OffsetsInitializer.earliest())     \/\/ \u6216 latest() \/ committedOffsets()<br \/>\n    .setValueOnlyDeserializer(new DeserializationSchema&lt;WaterSensor&gt;() {<br \/>\n        @Override<br \/>\n        public WaterSensor deserialize(byte[] message) throws IOException {<br \/>\n            \/\/ \u81ea\u5df1\u5199 JSON \u89e3\u6790\uff0c\u6bd4\u5982 FastJSON \/ Gson<br \/>\n            return JSON.parseObject(message, WaterSensor.class);<br \/>\n        }<br \/>\n        @Override<br \/>\n        public boolean isEndOfStream(WaterSensor nextElement) { return false; }<br \/>\n        @Override<br \/>\n        public TypeInformation&lt;WaterSensor&gt; getProducedType() {<br \/>\n            return TypeInformation.of(WaterSensor.class);<br \/>\n        }<br \/>\n    })<br \/>\n    .build();<\/p>\n<p>DataStream&lt;WaterSensor&gt; stream = env.fromSource(<br \/>\n    kafkaSource,<br \/>\n    WatermarkStrategy.&lt;WaterSensor&gt;forBoundedOutOfOrderness(Duration.ofSeconds(5))  \/\/ \u6c34\u5370<br \/>\n        .withTimestampAssigner((sensor, ts) -&gt; sensor.ts),<br \/>\n    \\&#8221;kafka-source\\&#8221;<br \/>\n); <\/p>\n<h4 id=\"LbqcC\">3. Source \u5c42\u751f\u4ea7\u5fc5\u9700\u8003\u8651\u7684 3 \u4ef6\u4e8b<\/h4>\n<table id=\"mup8g\">\n<tbody>\n<tr>\n<td>\n<p id=\"u98f46c32\">\u914d\u7f6e\u9879<\/p>\n<\/td>\n<td>\n<p id=\"u26b4371e\">\u4ee3\u7801\u4f4d\u7f6e<\/p>\n<\/td>\n<td>\n<p id=\"uc8b09b62\">\u4e3a\u4ec0\u4e48\u5fc5\u987b\u914d<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"u130bb523\">Checkpoint\uff08Exactly-once\uff09<\/p>\n<\/td>\n<td>\n<p id=\"u1c269de7\">env.enableCheckpointing(10000L, CheckpointingMode.EXACTLY_ONCE);<\/p>\n<\/td>\n<td>\n<p id=\"u412a8748\">Kafka Source \u624d\u80fd\u5b9e\u73b0\u7aef\u5230\u7aef\u7cbe\u786e\u4e00\u6b21<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ua13ea982\">\u6c34\u5370 + \u4e8b\u4ef6\u65f6\u95f4<\/p>\n<\/td>\n<td>\n<p id=\"u9a09c118\">WatermarkStrategy.forBoundedOutOfOrderness(&#8230;) + withTimestampAssigner<\/p>\n<\/td>\n<td>\n<p id=\"u84663d04\">\u7a97\u53e3\u624d\u80fd\u57fa\u4e8e\u4e8b\u4ef6\u65f6\u95f4\u6b63\u786e\u8ba1\u7b97\uff0c\u5904\u7406\u4e71\u5e8f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>\n<p id=\"ue7c44f5d\">\u5e76\u884c\u5ea6\u5bf9\u9f50 Kafka \u5206\u533a<\/p>\n<\/td>\n<td>\n<p id=\"u2d3e957e\">Source \u5e76\u884c\u5ea6 = Kafka \u5206\u533a\u6570<\/p>\n<\/td>\n<td>\n<p id=\"u2e8915ba\">\u5426\u5219\u541e\u5410\u6253\u6298\uff0c\u67d0\u4e9b\u5206\u533a\u6d88\u8d39\u6162<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h4 id=\"hWYzf\">4. \u4e00\u53e5\u8bdd\u603b\u7ed3 Source \u5c42<\/h4>\n<p id=\"u8c5ba8fd\">\u751f\u4ea7\u4f5c\u4e1a 99% \u90fd\u662f\u4ece Kafka Source \u5f00\u59cb&lt;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u6807<br \/>\n\u5e0c\u671b\u901a\u8fc7\u8fd9\u4efd\u5185\u5bb9\u629b\u7816\u5f15\u7389\uff0c\u8ba9\u4f60\u5728\u9605\u8bfb\u540e\u4e0d\u4ec5\u80fd\u72ec\u7acb\u7f16\u5199 WordCount\u3001\u63a5\u5165 Kafka\u3001\u4f7f\u7528 MySQL\/Redis\uff0c\u5bf9 Flink \u4f5c\u4e1a\u6709\u4e00\u4e2a\u6574\u4f53\u3001\u6e05\u6670\u7684\u8ba4\u8bc6\u3002<br \/>\n\u4e00\u3001\u7b2c\u4e00\u90e8\u5206\uff1aFlink \u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4e3a\u4ec0\u4e48\u8981\u7528\u5b83\uff1f<br \/>\n1.1 \u4e00\u53e5\u8bdd\u5b9a\u4e49<br \/>\nFlink \u662f\u4e00\u4e2a\u201c\u771f\u00b7\u5b9e\u65f6\u201d\u6d41\u8ba1\u7b97\u5f15\u64ce\uff0c\u4e13\u95e8\u7528\u6765\u5728\u6570\u636e\u4e0d\u65ad\u4ea7\u751f\u7684\u65f6\u5019\u5c31\u7acb\u523b\u7b97\u51fa\u7ed3\u679c\u3002 Flink\u6838\u5fc3\u76ee\u6807\uff0c\u662f\u201c\u6570\u636e\u6d41\u4e0a\u7684\u6709\u72b6\u6001\u8ba1\u7b97\u201d(Stateful Computations over Data Streams )\u5177\u4f53\u8bf4<\/p>\n","protected":false},"author":2,"featured_media":72009,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[331,1138,323],"topic":[],"class_list":["post-72016","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-apache","tag-flink","tag-323"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Apache Flink \u5feb\u901f\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/72016.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Apache Flink \u5feb\u901f\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u6807 \u5e0c\u671b\u901a\u8fc7\u8fd9\u4efd\u5185\u5bb9\u629b\u7816\u5f15\u7389\uff0c\u8ba9\u4f60\u5728\u9605\u8bfb\u540e\u4e0d\u4ec5\u80fd\u72ec\u7acb\u7f16\u5199 WordCount\u3001\u63a5\u5165 Kafka\u3001\u4f7f\u7528 MySQL\/Redis\uff0c\u5bf9 Flink \u4f5c\u4e1a\u6709\u4e00\u4e2a\u6574\u4f53\u3001\u6e05\u6670\u7684\u8ba4\u8bc6\u3002 \u4e00\u3001\u7b2c\u4e00\u90e8\u5206\uff1aFlink \u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4e3a\u4ec0\u4e48\u8981\u7528\u5b83\uff1f 1.1 \u4e00\u53e5\u8bdd\u5b9a\u4e49 Flink \u662f\u4e00\u4e2a\u201c\u771f\u00b7\u5b9e\u65f6\u201d\u6d41\u8ba1\u7b97\u5f15\u64ce\uff0c\u4e13\u95e8\u7528\u6765\u5728\u6570\u636e\u4e0d\u65ad\u4ea7\u751f\u7684\u65f6\u5019\u5c31\u7acb\u523b\u7b97\u51fa\u7ed3\u679c\u3002 Flink\u6838\u5fc3\u76ee\u6807\uff0c\u662f\u201c\u6570\u636e\u6d41\u4e0a\u7684\u6709\u72b6\u6001\u8ba1\u7b97\u201d(Stateful Computations over Data Streams )\u5177\u4f53\u8bf4\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72016.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-04T10:48:58+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104856-698324185412e.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72016.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72016.html\",\"name\":\"Apache Flink \u5feb\u901f\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-04T10:48:58+00:00\",\"dateModified\":\"2026-02-04T10:48:58+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72016.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72016.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72016.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Apache Flink \u5feb\u901f\u5165\u95e8\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Apache Flink \u5feb\u901f\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/72016.html","og_locale":"zh_CN","og_type":"article","og_title":"Apache Flink \u5feb\u901f\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u6807 \u5e0c\u671b\u901a\u8fc7\u8fd9\u4efd\u5185\u5bb9\u629b\u7816\u5f15\u7389\uff0c\u8ba9\u4f60\u5728\u9605\u8bfb\u540e\u4e0d\u4ec5\u80fd\u72ec\u7acb\u7f16\u5199 WordCount\u3001\u63a5\u5165 Kafka\u3001\u4f7f\u7528 MySQL\/Redis\uff0c\u5bf9 Flink \u4f5c\u4e1a\u6709\u4e00\u4e2a\u6574\u4f53\u3001\u6e05\u6670\u7684\u8ba4\u8bc6\u3002 \u4e00\u3001\u7b2c\u4e00\u90e8\u5206\uff1aFlink \u5230\u5e95\u662f\u4ec0\u4e48\uff1f\u4e3a\u4ec0\u4e48\u8981\u7528\u5b83\uff1f 1.1 \u4e00\u53e5\u8bdd\u5b9a\u4e49 Flink \u662f\u4e00\u4e2a\u201c\u771f\u00b7\u5b9e\u65f6\u201d\u6d41\u8ba1\u7b97\u5f15\u64ce\uff0c\u4e13\u95e8\u7528\u6765\u5728\u6570\u636e\u4e0d\u65ad\u4ea7\u751f\u7684\u65f6\u5019\u5c31\u7acb\u523b\u7b97\u51fa\u7ed3\u679c\u3002 Flink\u6838\u5fc3\u76ee\u6807\uff0c\u662f\u201c\u6570\u636e\u6d41\u4e0a\u7684\u6709\u72b6\u6001\u8ba1\u7b97\u201d(Stateful Computations over Data Streams )\u5177\u4f53\u8bf4","og_url":"https:\/\/www.wsisp.com\/helps\/72016.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-04T10:48:58+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260204104856-698324185412e.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"3 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72016.html","url":"https:\/\/www.wsisp.com\/helps\/72016.html","name":"Apache Flink \u5feb\u901f\u5165\u95e8 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-04T10:48:58+00:00","dateModified":"2026-02-04T10:48:58+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72016.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72016.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72016.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"Apache Flink \u5feb\u901f\u5165\u95e8"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72016","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=72016"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72016\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/72009"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72016"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72016"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72016"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72016"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}