{"id":63654,"date":"2026-01-22T07:41:19","date_gmt":"2026-01-21T23:41:19","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/63654.html"},"modified":"2026-01-22T07:41:19","modified_gmt":"2026-01-21T23:41:19","slug":"%e3%80%90%e5%bf%ab%e5%88%b7%e9%9d%a2%e8%af%95-%e9%ab%98%e5%b9%b6%e5%8f%91%e9%94%81%e7%af%87%e3%80%91-%e5%9f%ba%e4%ba%8e%e7%a5%a8%e5%8a%a1%e7%b3%bb%e7%bb%9f%e5%9c%a8%e4%b8%8d%e5%90%8c%e6%9c%8d","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/63654.html","title":{"rendered":"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3"},"content":{"rendered":"<h2>\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668&#xff0c;\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3<\/h2>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121234118-6971641e891b1.png\" alt=\"\u8bf7\u6dfb\u52a0\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<h4>\u5206\u5e03\u5f0f\u573a\u666f\u4e0b\u7684\u9501\u89e3\u51b3\u65b9\u6848<\/h4>\n<p>\u7968\u52a1\u7cfb\u7edf\u5728\u591a\u4e2a\u670d\u52a1\u5668\u90e8\u7f72\u65f6&#xff0c;\u5355\u673a\u9501&#xff08;\u5982Java\u7684synchronized\u6216ReentrantLock&#xff09;\u5931\u6548\u7684\u539f\u56e0\u5f88\u7b80\u5355&#xff1a;\u8fd9\u4e9b\u9501\u53ea\u5728\u5355\u4e2aJVM\u8fdb\u7a0b\u5185\u6709\u6548&#xff0c;\u65e0\u6cd5\u8de8\u670d\u52a1\u5668\u534f\u8c03\u3002\u4e09\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bfb\u53d6i&#061;100\u5e76\u5404\u81ea\u6267\u884ci&#8211;&#xff0c;\u6700\u7ec8\u90fd\u5199\u5165i&#061;99&#xff0c;\u5bfc\u81f4\u8d85\u5356\u3002<\/p>\n<hr \/>\n<h5>\u5206\u5e03\u5f0f\u9501\u7684\u6838\u5fc3\u8981\u6c42<\/h5>\n<p>\u5b9e\u73b0\u5206\u5e03\u5f0f\u9501\u5fc5\u987b\u6ee1\u8db3\u56db\u4e2a\u6761\u4ef6&#xff08;\u4e92\u9632\u53ef\u9ad8&#xff09;&#xff1a;<\/p>\n<li>\u4e92\u65a5\u6027&#xff1a;\u540c\u4e00\u65f6\u523b\u53ea\u6709\u4e00\u4e2a\u5ba2\u6237\u7aef\u80fd\u6301\u6709\u9501<\/li>\n<li>\u9632\u6b7b\u9501&#xff1a;\u9501\u5fc5\u987b\u6709\u81ea\u52a8\u8d85\u65f6\u91ca\u653e\u673a\u5236&#xff0c;\u9632\u6b62\u5ba2\u6237\u7aef\u5d29\u6e83\u5bfc\u81f4\u6c38\u4e45\u963b\u585e<\/li>\n<li>\u53ef\u91cd\u5165\u6027&#xff08;\u53ef\u9009&#xff09;&#xff1a;\u540c\u4e00\u4e2a\u5ba2\u6237\u7aef\u53ef\u591a\u6b21\u83b7\u53d6\u540c\u4e00\u628a\u9501<\/li>\n<li>\u9ad8\u53ef\u7528&#xff1a;\u9501\u670d\u52a1\u4e0d\u80fd\u662f\u5355\u70b9\u6545\u969c\u6e90<\/li>\n<hr \/>\n<h5>\u4e3b\u6d41\u89e3\u51b3\u65b9\u6848\u5bf9\u6bd4<\/h5>\n<table>\n<tr>\u65b9\u6848\u5b9e\u73b0\u539f\u7406\u4f18\u70b9\u7f3a\u70b9\u9002\u7528\u573a\u666f<\/tr>\n<tbody>\n<tr>\n<td>\u6570\u636e\u5e93\u60b2\u89c2\u9501<\/td>\n<td>SELECT &#8230; FOR UPDATE<\/td>\n<td>\u7b80\u5355&#xff0c;\u65e0\u9700\u989d\u5916\u7ec4\u4ef6<\/td>\n<td>\u6027\u80fd\u5dee&#xff0c;\u6613\u6b7b\u9501&#xff0c;\u65e0\u6cd5\u4f18\u96c5\u5904\u7406\u8d85\u65f6<\/td>\n<td>\u5e76\u53d1\u91cf\u6781\u4f4e&#xff08;&lt;10 TPS&#xff09;<\/td>\n<\/tr>\n<tr>\n<td>Redis\u5206\u5e03\u5f0f\u9501<\/td>\n<td>SET NX PX &#043; Lua\u811a\u672c<\/td>\n<td>\u6027\u80fd\u6781\u9ad8&#xff08;\u4e07\u7ea7TPS&#xff09;&#xff0c;\u5b9e\u73b0\u7b80\u6d01<\/td>\n<td>\u8fc7\u671f\u65f6\u95f4\u96be\u8bc4\u4f30&#xff0c;\u4e3b\u4ece\u5207\u6362\u53ef\u80fd\u4e22\u9501<\/td>\n<td>\u7edd\u5927\u591a\u6570\u4e92\u8054\u7f51\u4e1a\u52a1<\/td>\n<\/tr>\n<tr>\n<td>Redisson\u6846\u67b6<\/td>\n<td>Redis &#043; WatchDog\u673a\u5236<\/td>\n<td>\u81ea\u52a8\u7eed\u671f&#xff0c;\u652f\u6301\u53ef\u91cd\u5165&#xff0c;\u6709\u6210\u719f\u6846\u67b6<\/td>\n<td>\u4f9d\u8d56Redis\u96c6\u7fa4\u7a33\u5b9a\u6027<\/td>\n<td>\u5f3a\u70c8\u63a8\u8350<\/td>\n<\/tr>\n<tr>\n<td>ZooKeeper\u4e34\u65f6\u8282\u70b9<\/td>\n<td>\u521b\u5efa\u4e34\u65f6\u987a\u5e8f\u8282\u70b9<\/td>\n<td>\u53ef\u9760\u6027\u9ad8&#xff0c;\u81ea\u52a8\u91ca\u653e&#xff0c;\u65e0\u6b7b\u9501<\/td>\n<td>\u6027\u80fd\u8f83\u4f4e&#xff08;\u5343\u7ea7TPS&#xff09;&#xff0c;\u9700\u7ef4\u62a4ZK\u96c6\u7fa4<\/td>\n<td>\u91d1\u878d\u7ea7\u5f3a\u4e00\u81f4\u573a\u666f<\/td>\n<\/tr>\n<tr>\n<td>Etcd\u79df\u7ea6\u673a\u5236<\/td>\n<td>Lease &#043; Revision<\/td>\n<td>\u5f3a\u4e00\u81f4\u6027&#xff0c;TTL\u81ea\u52a8\u8fc7\u671f<\/td>\n<td>\u8fd0\u7ef4\u590d\u6742&#xff0c;\u793e\u533a\u8f83\u5c0f<\/td>\n<td>Kubernetes\u751f\u6001<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<hr \/>\n<h5>\u5b9e\u6218\u63a8\u8350&#xff1a;Redisson\u5206\u5e03\u5f0f\u9501<\/h5>\n<p>\u5bf9\u4e8e\u7968\u52a1\u7cfb\u7edf\u8fd9\u7c7b\u9ad8\u5e76\u53d1\u3001\u6027\u80fd\u654f\u611f\u7684\u573a\u666f&#xff0c;Redisson\u662f\u6700\u4f73\u5b9e\u8df5&#xff1a;<\/p>\n<p><span class=\"token comment\">\/\/ 1. \u5f15\u5165\u4f9d\u8d56<\/span><br \/>\n<span class=\"token comment\">\/\/ Maven: &lt;artifactId&gt;redisson-spring-boot-starter&lt;\/artifactId&gt;<\/span><\/p>\n<p><span class=\"token comment\">\/\/ 2. \u914d\u7f6eRedis\u96c6\u7fa4<\/span><br \/>\n<span class=\"token annotation punctuation\">&#064;Configuration<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">RedissonConfig<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Bean<\/span><br \/>\n    <span class=\"token keyword\">public<\/span> <span class=\"token class-name\">RedissonClient<\/span> <span class=\"token function\">redissonClient<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token class-name\">Config<\/span> config <span class=\"token operator\">&#061;<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">Config<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        config<span class=\"token punctuation\">.<\/span><span class=\"token function\">useClusterServers<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><br \/>\n            <span class=\"token punctuation\">.<\/span><span class=\"token function\">addNodeAddress<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;redis:\/\/127.0.0.1:7001&#034;<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token string\">&#034;redis:\/\/127.0.0.1:7002&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token keyword\">return<\/span> <span class=\"token class-name\">Redisson<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">create<\/span><span class=\"token punctuation\">(<\/span>config<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<p><span class=\"token comment\">\/\/ 3. \u4e1a\u52a1\u4ee3\u7801\u6539\u9020<\/span><br \/>\n<span class=\"token annotation punctuation\">&#064;Service<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">class<\/span> <span class=\"token class-name\">TicketService<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    <span class=\"token annotation punctuation\">&#064;Autowired<\/span><br \/>\n    <span class=\"token keyword\">private<\/span> <span class=\"token class-name\">RedissonClient<\/span> redissonClient<span class=\"token punctuation\">;<\/span><\/p>\n<p>    <span class=\"token keyword\">public<\/span> <span class=\"token keyword\">boolean<\/span> <span class=\"token function\">sellTicket<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Long<\/span> ticketId<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token comment\">\/\/ \u9501\u7684\u7c92\u5ea6\u8981\u7ec6&#xff0c;\u7528ticketId\u4f5cKey<\/span><br \/>\n        <span class=\"token class-name\">RLock<\/span> lock <span class=\"token operator\">&#061;<\/span> redissonClient<span class=\"token punctuation\">.<\/span><span class=\"token function\">getLock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;ticket_lock:&#034;<\/span> <span class=\"token operator\">&#043;<\/span> ticketId<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5c1d\u8bd5\u52a0\u9501&#xff0c;\u6700\u591a\u7b49\u5f855\u79d2&#xff0c;\u9501\u81ea\u52a8\u91ca\u653e30\u79d2<\/span><br \/>\n            <span class=\"token comment\">\/\/ WatchDog\u4f1a\u81ea\u52a8\u7eed\u671f&#xff08;\u9ed8\u8ba4\u6bcf10\u79d2\u7eed\u4e00\u6b21&#xff09;<\/span><br \/>\n            <span class=\"token keyword\">boolean<\/span> isLocked <span class=\"token operator\">&#061;<\/span> lock<span class=\"token punctuation\">.<\/span><span class=\"token function\">tryLock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">5<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token number\">30<\/span><span class=\"token punctuation\">,<\/span> <span class=\"token class-name\">TimeUnit<\/span><span class=\"token punctuation\">.<\/span>SECONDS<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token operator\">!<\/span>isLocked<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                <span class=\"token keyword\">throw<\/span> <span class=\"token keyword\">new<\/span> <span class=\"token class-name\">RuntimeException<\/span><span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;\u7cfb\u7edf\u7e41\u5fd9&#xff0c;\u8bf7\u91cd\u8bd5&#034;<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><\/p>\n<p>            <span class=\"token comment\">\/\/ \u6267\u884c\u4e1a\u52a1&#xff1a;\u67e5\u8be2\u5e93\u5b58 \u2192 \u51cf\u5e93\u5b58<\/span><br \/>\n            <span class=\"token class-name\">Ticket<\/span> ticket <span class=\"token operator\">&#061;<\/span> ticketMapper<span class=\"token punctuation\">.<\/span><span class=\"token function\">selectById<\/span><span class=\"token punctuation\">(<\/span>ticketId<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>ticket<span class=\"token punctuation\">.<\/span><span class=\"token function\">getStock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&gt;<\/span> <span class=\"token number\">0<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                ticket<span class=\"token punctuation\">.<\/span><span class=\"token function\">setStock<\/span><span class=\"token punctuation\">(<\/span>ticket<span class=\"token punctuation\">.<\/span><span class=\"token function\">getStock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                ticketMapper<span class=\"token punctuation\">.<\/span><span class=\"token function\">updateById<\/span><span class=\"token punctuation\">(<\/span>ticket<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n                <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">true<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">catch<\/span> <span class=\"token punctuation\">(<\/span><span class=\"token class-name\">InterruptedException<\/span> e<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token class-name\">Thread<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">currentThread<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">.<\/span><span class=\"token function\">interrupt<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token keyword\">return<\/span> <span class=\"token boolean\">false<\/span><span class=\"token punctuation\">;<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">finally<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n            <span class=\"token comment\">\/\/ \u5fc5\u987b\u91ca\u653e\u9501&#xff0c;\u4e14\u53ea\u80fd\u91ca\u653e\u81ea\u5df1\u6301\u6709\u7684\u9501<\/span><br \/>\n            <span class=\"token keyword\">if<\/span> <span class=\"token punctuation\">(<\/span>lock<span class=\"token punctuation\">.<\/span><span class=\"token function\">isHeldByCurrentThread<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n                lock<span class=\"token punctuation\">.<\/span><span class=\"token function\">unlock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span><br \/>\n            <span class=\"token punctuation\">}<\/span><br \/>\n        <span class=\"token punctuation\">}<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<hr \/>\n<h5>\u5173\u952e\u8bbe\u8ba1\u8981\u70b9<\/h5>\n<li>\u9501\u7c92\u5ea6&#xff1a;\u6309ticketId\u52a0\u9501&#xff0c;\u907f\u514d\u5168\u5c40\u9501\u963b\u585e\u6240\u6709\u7968\u79cd<\/li>\n<li>Key\u547d\u540d&#xff1a;\u4e1a\u52a1:\u6a21\u5757:\u8d44\u6e90ID&#xff0c;\u5982ticket:stock:12345<\/li>\n<li>\u9632\u8bef\u5220&#xff1a;Redisson\u7684\u9501\u5b9e\u4f8b\u4f1a\u5b58\u50a8\u7ebf\u7a0bID&#xff0c;\u9632\u6b62A\u7ebf\u7a0b\u91ca\u653eB\u7ebf\u7a0b\u7684\u9501<\/li>\n<li>\u8d85\u65f6\u65f6\u95f4&#xff1a;\u5fc5\u987b\u8bbe\u7f6e&#xff0c;\u4e14\u8981\u8fdc\u5927\u4e8e\u4e1a\u52a1\u6267\u884c\u65f6\u95f4&#xff08;WatchDog\u4f1a\u7eed\u671f&#xff09;<\/li>\n<li>\u9501\u91cd\u8bd5&#xff1a;tryLock\u652f\u6301\u7b49\u5f85\u65f6\u95f4&#xff0c;\u907f\u514d\u7acb\u5373\u5931\u8d25<\/li>\n<hr \/>\n<h5>\u4e3a\u4ec0\u4e48\u4e0d\u80fd\u53ea\u7528\u6570\u636e\u5e93&#xff1f;<\/h5>\n<p><span class=\"token comment\">&#8212; \u60b2\u89c2\u9501\u65b9\u6848&#xff08;\u4e0d\u63a8\u8350&#xff09;<\/span><br \/>\n<span class=\"token keyword\">BEGIN<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">SELECT<\/span> stock <span class=\"token keyword\">FROM<\/span> ticket <span class=\"token keyword\">WHERE<\/span> id <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">123<\/span> <span class=\"token keyword\">FOR<\/span> <span class=\"token keyword\">UPDATE<\/span><span class=\"token punctuation\">;<\/span>  <span class=\"token comment\">&#8212; \u963b\u585e\u5176\u4ed6\u4e8b\u52a1<\/span><br \/>\n<span class=\"token keyword\">UPDATE<\/span> ticket <span class=\"token keyword\">SET<\/span> stock <span class=\"token operator\">&#061;<\/span> stock <span class=\"token operator\">&#8211;<\/span> <span class=\"token number\">1<\/span> <span class=\"token keyword\">WHERE<\/span> id <span class=\"token operator\">&#061;<\/span> <span class=\"token number\">123<\/span><span class=\"token punctuation\">;<\/span><br \/>\n<span class=\"token keyword\">COMMIT<\/span><span class=\"token punctuation\">;<\/span><\/p>\n<p>\u95ee\u9898&#xff1a;\u6027\u80fd\u6781\u5dee&#xff0c;TPS\u901a\u5e38&lt;50&#xff0c;\u4e14\u957f\u4e8b\u52a1\u4f1a\u62d6\u57ae\u6570\u636e\u5e93\u3002Redis\u65b9\u6848\u6027\u80fd\u662f\u5176100\u500d\u4ee5\u4e0a\u3002<\/p>\n<hr \/>\n<h5>\u67b6\u6784\u6f14\u8fdb\u5efa\u8bae<\/h5>\n<p>\u5982\u679c\u4f60\u4eec\u7684\u7cfb\u7edf\u5df2\u7ecf\u7528MySQL&#xff0c;\u6700\u5c0f\u6210\u672c\u63a5\u5165Redisson&#xff1a;<\/p>\n<li>\u90e8\u7f72\u4e00\u4e2aRedis\u96c6\u7fa4&#xff08;3\u4e3b3\u4ece&#xff09;<\/li>\n<li>\u5f15\u5165redisson-spring-boot-starter<\/li>\n<li>\u6539\u9020\u6838\u5fc3\u5e93\u5b58\u63a5\u53e3<\/li>\n<p>\u540e\u7eed\u5982\u679c\u5e93\u5b58\u4e89\u62a2\u6781\u5ea6\u6fc0\u70c8&#xff08;\u5982\u6625\u8fd0\u62a2\u7968&#xff09;&#xff0c;\u53ef\u5347\u7ea7\u4e3a\u5206\u6bb5\u9501\u6216\u6d88\u606f\u961f\u5217\u5f02\u6b65\u6263\u5e93\u5b58&#xff0c;\u4f4690%\u7684\u573a\u666f\u4e0bRedisson\u5206\u5e03\u5f0f\u9501\u5df2\u5b8c\u5168\u591f\u7528\u3002<\/p>\n<p>\u603b\u7ed3&#xff1a;\u5206\u5e03\u5f0f\u9501\u7684\u672c\u8d28\u662f\u628a\u591a\u673a\u5e76\u53d1\u8f6c\u4e3a\u5355\u673a\u6392\u961f&#xff0c;Redis&#043;Redisson\u662f\u76ee\u524d\u5de5\u4e1a\u754c\u6700\u6210\u719f\u7684\u65b9\u6848&#xff0c;\u6ca1\u6709\u4e4b\u4e00\u3002<\/p>\n<h2>\u3010\u8be6\u89e3-\u9501\u76844\u5927\u6761\u4ef6\u3011<\/h2>\n<p>\u6211\u7528\u6625\u8fd0\u62a2\u7968\u8fd9\u4e00\u4e2a\u5b8c\u6574\u6545\u4e8b&#xff0c;\u628a\u56db\u4e2a\u6761\u4ef6\u4e32\u8d77\u6765\u7ed9\u4f60\u8bb2\u900f&#xff1a;<\/p>\n<hr \/>\n<h4>\u6545\u4e8b\u80cc\u666f<\/h4>\n<p>2025\u5e74\u6625\u8fd0&#xff0c;10\u4e07\u7528\u6237\u62a2\u6700\u540e1000\u5f20\u706b\u8f66\u7968&#xff0c;\u7cfb\u7edf\u90e8\u7f72\u57285\u53f0\u670d\u52a1\u5668\u4e0a&#xff0c;\u5e93\u5b58\u670d\u52a1\u5171\u7528MySQL\u3002<\/p>\n<hr \/>\n<h5>\u6761\u4ef61&#xff1a;\u4e92\u65a5\u6027&#xff08;\u540c\u4e00\u65f6\u95f4\u53ea\u67091\u4e2a\u4eba\u80fd\u62a2\u5230\u6700\u540e\u7968&#xff09;<\/h5>\n<p>\u573a\u666f&#xff1a;\u7528\u6237\u5f20\u4e09\u548c\u674e\u56db\u540c\u65f6\u770b\u5230&#034;\u6700\u540e1\u5f20\u7968&#034;\u3002<\/p>\n<ul>\n<li>\u65e0\u9501\u707e\u96be&#xff1a;\u4e24\u53f0\u670d\u52a1\u5668\u540c\u65f6\u6267\u884cSELECT stock&#061;1 \u2192 \u90fd\u5224\u65ad\u6709\u7968 \u2192 \u90fd\u6267\u884cstock-1 \u2192 \u5e93\u5b58\u53d8\u6210-1&#xff0c;\u8d85\u53561\u5f20&#xff0c;\u4e24\u4eba\u4ed8\u6b3e\u6210\u529f&#xff0c;\u7cfb\u7edf\u5d29\u6e83\u3002<\/li>\n<li>\u5206\u5e03\u5f0f\u9501\u4ecb\u5165&#xff1a;Redisson\u5728Redis\u4e2d\u521b\u5efaticket_lock:123\u952e&#xff0c;\u53ea\u6709\u4e00\u53f0\u670d\u52a1\u5668\u80fdSET\u6210\u529f&#xff0c;\u53e6\u4e00\u53f0\u7b49\u5f85\u3002\u5f20\u4e09\u7684\u8bf7\u6c42\u5148\u62ff\u5230\u9501&#xff0c;\u674e\u56db\u7684\u8bf7\u6c42\u963b\u585e\u7b49\u5f85\u3002<\/li>\n<\/ul>\n<p>\u53e3\u8bc0&#xff1a;\u9501\u5c31\u662f&#034;\u72ec\u6728\u6865&#034;&#xff0c;\u4e00\u6b21\u53ea\u80fd\u8fc7\u4e00\u4eba\u3002<\/p>\n<hr \/>\n<h5>\u6761\u4ef62&#xff1a;\u9632\u6b7b\u9501&#xff08;\u670d\u52a1\u5668\u8dea\u4e86&#xff0c;\u9501\u5fc5\u987b\u81ea\u52a8\u91ca\u653e&#xff09;<\/h5>\n<p>\u573a\u666f&#xff1a;\u670d\u52a1\u5668A\u62ff\u5230\u9501\u540e&#xff0c;\u521a\u8981\u6263\u51cf\u5e93\u5b58&#xff0c;\u7a81\u7136JVM OOM\u5b95\u673a\u4e86\u3002<\/p>\n<ul>\n<li>\u6b7b\u9501\u707e\u96be&#xff1a;\u9501ticket_lock:123\u6c38\u8fdc\u7559\u5728Redis&#xff0c;\u5176\u4ed6\u670d\u52a1\u5668\u90fd\u4ee5\u4e3a&#034;\u6709\u4eba\u6301\u9501&#034;&#xff0c;\u5168\u90e8\u963b\u585e\u3002\u7968\u5356\u4e0d\u51fa&#xff0c;\u7cfb\u7edf\u5361\u6b7b\u3002<\/li>\n<li>Redisson\u65b9\u6848&#xff1a;\u52a0\u9501\u65f6\u8bbe\u7f6e30\u79d2\u81ea\u52a8\u8fc7\u671f &#043; WatchDog\u6bcf10\u79d2\u7eed\u671f\u3002\u670d\u52a1\u5668A\u5b95\u673a\u540e&#xff0c;WatchDog\u7ebf\u7a0b\u4e00\u8d77\u6b7b&#xff0c;30\u79d2\u540eRedis\u81ea\u52a8\u5220\u9664\u9501&#xff0c;\u5176\u4ed6\u670d\u52a1\u5668\u6062\u590d\u6b63\u5e38\u62a2\u7968\u3002<\/li>\n<\/ul>\n<p>\u53e3\u8bc0&#xff1a;\u9501\u5e26&#034;\u5b9a\u65f6\u70b8\u5f39&#034;&#xff0c;\u6301\u6709\u4eba\u6b7b\u4e86\u5c31\u70b8\u5f00\u9501\u3002<\/p>\n<hr \/>\n<h5>\u6761\u4ef63&#xff1a;\u53ef\u91cd\u5165\u6027&#xff08;\u540c\u4e00\u4e2a\u7528\u6237\u591a\u6b21\u64cd\u4f5c\u540c\u4e00\u8d44\u6e90&#xff09;<\/h5>\n<p>\u573a\u666f&#xff1a;\u5f20\u4e09\u4ed8\u6b3e\u6210\u529f\u540e&#xff0c;\u7cfb\u7edf\u8981\u66f4\u65b0\u8ba2\u5355\u72b6\u6001 &#043; \u53d1\u9001\u77ed\u4fe1\u901a\u77e5&#xff0c;\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u90fd\u9700\u8981\u786e\u8ba4\u5e93\u5b58\u5df2\u6263\u51cf\u3002<\/p>\n<p><span class=\"token comment\">\/\/ \u4f2a\u4ee3\u7801\u5c55\u793a\u5d4c\u5957\u8c03\u7528<\/span><br \/>\n<span class=\"token keyword\">public<\/span> <span class=\"token keyword\">void<\/span> <span class=\"token function\">processPayment<\/span><span class=\"token punctuation\">(<\/span><span class=\"token class-name\">Long<\/span> ticketId<span class=\"token punctuation\">)<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n    lock<span class=\"token punctuation\">.<\/span><span class=\"token function\">lock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u7b2c\u4e00\u6b21\u83b7\u53d6\u9501<\/span><br \/>\n    <span class=\"token keyword\">try<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        <span class=\"token function\">deductStock<\/span><span class=\"token punctuation\">(<\/span>ticketId<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>      <span class=\"token comment\">\/\/ \u6263\u5e93\u5b58<\/span><br \/>\n        <span class=\"token function\">updateOrderStatus<\/span><span class=\"token punctuation\">(<\/span>orderId<span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u5185\u90e8\u4e5f\u9700\u8981\u9501<\/span><br \/>\n        <span class=\"token function\">sendSmsNotification<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span>      <span class=\"token comment\">\/\/ \u5185\u90e8\u4e5f\u9700\u8981\u9501<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span> <span class=\"token keyword\">finally<\/span> <span class=\"token punctuation\">{<\/span><br \/>\n        lock<span class=\"token punctuation\">.<\/span><span class=\"token function\">unlock<\/span><span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">;<\/span> <span class=\"token comment\">\/\/ \u91ca\u653e\u9501<\/span><br \/>\n    <span class=\"token punctuation\">}<\/span><br \/>\n<span class=\"token punctuation\">}<\/span><\/p>\n<ul>\n<li>\u4e0d\u53ef\u91cd\u5165\u707e\u96be&#xff1a;updateOrderStatus\u5185\u90e8\u518d\u6b21\u5c1d\u8bd5\u83b7\u53d6\u540c\u4e00\u628a\u9501&#xff0c;\u53d1\u73b0\u81ea\u5df1\u88ab&#034;\u81ea\u5df1&#034;\u963b\u585e&#xff0c;\u6c38\u8fdc\u5361\u6b7b\u3002<\/li>\n<li>Redisson\u65b9\u6848&#xff1a;\u9501\u8bb0\u5f55\u7ebf\u7a0bID\u548c\u91cd\u5165\u6b21\u6570\u3002\u540c\u7ebf\u7a0b\u53ef\u91cd\u590d\u83b7\u53d6&#xff0c;\u6bcf\u6b21unlock()\u8ba1\u6570\u51cf1&#xff0c;\u8ba1\u6570\u52300\u624d\u771f\u6b63\u91ca\u653e\u3002<\/li>\n<\/ul>\n<p>\u53e3\u8bc0&#xff1a;\u81ea\u5df1\u5bb6\u7684\u94a5\u5319&#xff0c;\u53ef\u4ee5\u53cd\u590d\u5f00\u95e8&#xff0c;\u51fa\u95e8\u65f6\u5173\u51e0\u6b21\u95e8\u624d\u7b97\u771f\u6b63\u9501\u4e0a\u3002<\/p>\n<hr \/>\n<h5>\u6761\u4ef64&#xff1a;\u9ad8\u53ef\u7528&#xff08;\u9501\u670d\u52a1\u4e0d\u80fd\u662f\u5355\u673a&#xff09;<\/h5>\n<p>\u573a\u666f&#xff1a;\u6625\u8fd0\u9ad8\u5cf0\u671f&#xff0c;Redis\u4e3b\u8282\u70b9\u625b\u4e0d\u4f4f10\u4e07\u5e76\u53d1&#xff0c;\u7a81\u7136\u6302\u4e86\u3002<\/p>\n<ul>\n<li>\u5355\u70b9\u6545\u969c\u707e\u96be&#xff1a;\u6240\u6709\u9501\u8bf7\u6c42\u5931\u8d25&#xff0c;\u62a2\u7968\u7cfb\u7edf\u5168\u9762\u762b\u75ea&#xff0c;\u5ba2\u670d\u7535\u8bdd\u88ab\u6253\u7206\u3002<\/li>\n<li>Redisson\u65b9\u6848&#xff1a;\u90e8\u7f723\u4e3b3\u4eceRedis Cluster&#xff0c;\u9501\u6570\u636e\u5206\u7247\u5b58\u50a8\u3002\u4e3b\u8282\u70b9\u6302\u6389&#xff0c;\u4ece\u8282\u70b9\u81ea\u52a8\u63d0\u5347&#xff0c;\u5ba2\u6237\u7aef\u65e0\u611f\u77e5\u5207\u6362\u3002\u914d\u5408\u54e8\u5175\u6a21\u5f0f&#xff0c;\u6545\u969c\u6062\u590d&lt;10\u79d2\u3002<\/li>\n<\/ul>\n<p>\u53e3\u8bc0&#xff1a;\u9501\u670d\u52a1\u8981\u50cf&#034;\u53cc11\u5ba2\u670d&#034;&#xff0c;\u4e00\u4e2a\u5012\u4e0b&#xff0c;\u53e6\u4e00\u4e2a\u7acb\u523b\u9876\u4e0a\u3002<\/p>\n<hr \/>\n<h4>\u56db\u6761\u4ef6\u4e32\u8054\u8bb0\u5fc6\u6a21\u677f&#xff08;\u5feb\u5237\u7528&#xff09;<\/h4>\n<p>\u6545\u4e8b\u7ebf&#xff1a;\u6625\u8fd0\u62a2\u7968 \u2192 \u670d\u52a1\u5668\u5b95\u673a \u2192 \u5d4c\u5957\u8c03\u7528 \u2192 Redis\u96c6\u7fa4\u6545\u969c<\/p>\n<p>\u4e92\u65a5\u6027&#xff1a;10\u4e07\u4eba\u62a21\u5f20\u7968&#xff0c;\u9501\u4fdd\u8bc1\u53ea\u67091\u4eba\u6210\u529f<br \/>\n\u9632\u6b7b\u9501&#xff1a;\u670d\u52a1\u5668A\u62ff\u5230\u9501\u540eOOM&#xff0c;30\u79d2\u81ea\u52a8\u91ca\u653e<br \/>\n\u53ef\u91cd\u5165\u6027&#xff1a;\u5f20\u4e09\u4ed8\u6b3e\u6d41\u7a0b\u5185&#xff0c;\u8ba2\u5355\/\u77ed\u4fe1\u65b9\u6cd5\u590d\u7528\u540c\u4e00\u628a\u9501<br \/>\n\u9ad8\u53ef\u7528&#xff1a;Redis\u4e3b\u8282\u70b9\u6302\u4e86&#xff0c;\u4ece\u8282\u70b9\u79d2\u7ea7\u63a5\u7ba1<\/p>\n<p>\u6280\u672f\u6620\u5c04&#xff1a;<br \/>\n\u4e92\u65a5 \u2192 SET NX\u539f\u5b50\u547d\u4ee4<br \/>\n\u9632\u6b7b\u9501 \u2192 PX\u8fc7\u671f\u65f6\u95f4 &#043; WatchDog\u7eed\u671f<br \/>\n\u53ef\u91cd\u5165 \u2192 Hash\u7ed3\u6784\u8bb0\u5f55threadId &#043; count<br \/>\n\u9ad8\u53ef\u7528 \u2192 Redis Cluster \/ Sentinel<\/p>\n<hr \/>\n<p>\u4e00\u53e5\u8bdd\u603b\u7ed3&#xff1a;\u5206\u5e03\u5f0f\u9501\u5c31\u662f\u7ed9&#034;\u8de8\u670d\u52a1\u5668\u7684\u4e34\u754c\u8d44\u6e90&#034;\u914d\u4e00\u4e2a\u5e26\u81ea\u52a8\u89e3\u9501\u3001\u53ef\u91cd\u590d\u8fdb\u5165\u3001\u96c6\u7fa4\u90e8\u7f72\u7684&#034;\u667a\u80fd\u95e8\u536b&#034;\u3002<\/p>\n<p>\u8fd9\u4e2a\u4e32\u8054\u6545\u4e8b\u4f60\u53ef\u4ee5\u76f4\u63a5\u7528&#xff0c;\u9762\u8bd5\u65f6\u8bb2\u51fa\u6765\u6bd4\u80cc\u516b\u80a1\u6587\u751f\u52a810\u500d\u3002<\/p>\n<h3>\u7b80\u5355\u8d2d\u7968\u793a\u4f8b\u4e00\u53e5\u8bdd\u8bf4\u6e05\u695a<\/h3>\n<p>\u4e00\u53e5\u8bdd\u7248\u672c&#xff1a;<\/p>\n<p>\u5206\u5e03\u5f0f\u9501\u786e\u4fdd&#034;\u6700\u540e1\u5f20\u7968\u53ea\u80fd\u88ab1\u4eba\u6210\u529f\u8d2d\u4e70&#xff0c;\u82e5\u4e70\u5bb6\u670d\u52a1\u5668\u5d29\u6e83\u950130\u79d2\u81ea\u52a8\u91ca\u653e\u9632\u5361\u6b7b&#xff0c;\u540c\u4e70\u5bb6\u4ed8\u6b3e\u6d41\u7a0b\u53ef\u91cd\u590d\u83b7\u53d6\u9501&#xff0c;\u9501\u670d\u52a1\u96c6\u7fa4\u90e8\u7f72\u907f\u514d\u5355\u673a\u6545\u969c\u5bfc\u81f4\u7cfb\u7edf\u762b\u75ea&#034;\u3002<\/p>\n<hr \/>\n<p>\u6781\u7b80\u5173\u952e\u8bcd\u7248&#xff1a;<\/p>\n<p>\u5206\u5e03\u5f0f\u9501\u901a\u8fc7 \u4e92\u65a5\u62a2\u7968\u3001\u5d29\u6e83\u81ea\u6108\u3001\u540c\u7528\u6237\u53ef\u91cd\u5165\u3001\u96c6\u7fa4\u9ad8\u53ef\u7528 \u56db\u5927\u673a\u5236&#xff0c;\u786e\u4fdd10\u4e07\u4eba\u62a2\u6700\u540e1\u5f20\u7968\u65f6\u7edd\u4e0d\u8d85\u5356\u3002<\/p>\n<h3>\u3010\u9762\u8bd5\u7248\u672c\u3011<\/h3>\n<h4>\u9762\u8bd5\u9ad8\u5206\u56de\u7b54\u6a21\u677f&#xff08;\u603b\u5206\u603b\u7ed3\u6784&#xff09;<\/h4>\n<p>\u603b\u8d77&#xff1a;\u5206\u5e03\u5f0f\u9501\u7684\u672c\u8d28\u662f\u89e3\u51b3\u591a\u673a\u73af\u5883\u4e0b\u4e34\u754c\u8d44\u6e90\u7ade\u4e89&#xff0c;\u4ee5\u6625\u8fd0\u62a2\u7968\u7cfb\u7edf\u4e3a\u4f8b&#xff0c;\u5206\u5e03\u5f0f\u9501\u5fc5\u987b\u6ee1\u8db3\u56db\u4e2a\u6761\u4ef6\u624d\u80fd\u4fdd\u969c\u4e1a\u52a1\u6b63\u786e\u6027&#xff1a;<\/p>\n<hr \/>\n<h4>1. \u4e92\u65a5\u6027&#xff08; Mutual Exclusion &#xff09;<\/h4>\n<p>\u5b9a\u4e49&#xff1a;\u540c\u4e00\u65f6\u523b&#xff0c;\u96c6\u7fa4\u4e2d\u4ec5\u6709\u4e00\u4e2a\u8282\u70b9\u80fd\u6301\u6709\u9501\u64cd\u4f5c\u5e93\u5b58\u3002<\/p>\n<p>\u573a\u666f&#xff1a;10\u4e07\u7528\u6237\u62a2\u6700\u540e1\u5f20\u7968&#xff0c;5\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bfb\u5230stock&#061;1\u3002\u82e5\u65e0\u4e92\u65a5&#xff0c;\u6bcf\u53f0\u90fd\u4f1a\u6267\u884cstock-1&#xff0c;\u5bfc\u81f4\u5e93\u5b58\u8d85\u5356\u4e3a-4\u3002<\/p>\n<p>\u5b9e\u73b0&#xff1a;Redis\u7684SET NX\u539f\u5b50\u547d\u4ee4&#xff0c;\u53ea\u6709\u552f\u4e00\u5ba2\u6237\u7aef\u80fd\u521b\u5efaticket_lock:123\u952e\u3002Redisson\u901a\u8fc7Lua\u811a\u672c\u4fdd\u8bc1&#034;\u5224\u65ad\u5b58\u5728&#043;\u8bbe\u7f6e\u503c&#043;\u8bbe\u7f6eTTL&#034;\u7684\u539f\u5b50\u6027&#xff0c;\u907f\u514dSET&#043;EXPIRE\u975e\u539f\u5b50\u5bfc\u81f4\u7684\u6b7b\u9501\u98ce\u9669\u3002<\/p>\n<p>\u7ec6\u8282&#xff1a;\u9501\u7684\u7c92\u5ea6\u5fc5\u987b\u7cbe\u786e\u5230\u8d44\u6e90ID&#xff08;ticket_lock:${ticketId}&#xff09;&#xff0c;\u800c\u975e\u5168\u5c40\u9501&#xff0c;\u5426\u5219\u6240\u6709\u8f66\u6b21\u4e32\u884c\u5316&#xff0c;\u6027\u80fd\u5d29\u6e83\u3002<\/p>\n<hr \/>\n<h4>2. \u9632\u6b7b\u9501&#xff08; Deadlock-Free &#xff09;<\/h4>\n<p>\u5b9a\u4e49&#xff1a;\u6301\u6709\u9501\u7684\u8282\u70b9\u5d29\u6e83\u65f6&#xff0c;\u9501\u5fc5\u987b\u81ea\u52a8\u91ca\u653e&#xff0c;\u9632\u6b62\u5176\u4ed6\u8282\u70b9\u6c38\u4e45\u963b\u585e\u3002<\/p>\n<p>\u573a\u666f&#xff1a;\u670d\u52a1\u5668A\u83b7\u53d6\u9501\u540e&#xff0c;JVM OOM\u5b95\u673a&#xff0c;\u9501\u672a\u91ca\u653e\u2192\u6240\u6709\u670d\u52a1\u5668\u7b49\u5f85\u2192\u7cfb\u7edf\u5361\u6b7b&#xff0c;1000\u5f20\u7968\u65e0\u6cd5\u552e\u5356\u3002<\/p>\n<p>\u5b9e\u73b0&#xff1a;Redisson\u91c7\u7528WatchDog\u673a\u5236&#xff1a;\u9501\u9ed8\u8ba430\u79d2\u8fc7\u671f&#xff0c;\u5ba2\u6237\u7aef\u542f\u52a8\u540e\u53f0\u7ebf\u7a0b\u6bcf10\u79d2\u7eed\u671f\u3002\u82e5\u5ba2\u6237\u7aef\u5b95\u673a&#xff0c;\u7eed\u671f\u505c\u6b62&#xff0c;30\u79d2\u540eRedis\u81ea\u52a8\u5220\u9501\u3002<\/p>\n<p>\u5bf9\u6bd4&#xff1a;ZooKeeper\u7528\u4e34\u65f6\u8282\u70b9&#xff0c;\u4f1a\u8bdd\u65ad\u5f00\u81ea\u52a8\u5220\u9664&#xff0c;\u53ef\u9760\u6027\u66f4\u9ad8\u4f46\u6027\u80fd\u8f83\u5dee\u3002\u6570\u636e\u5e93\u60b2\u89c2\u9501\u65e0\u81ea\u52a8\u8d85\u65f6&#xff0c;\u9700\u989d\u5916\u5fc3\u8df3\u8868&#xff0c;\u5b9e\u73b0\u590d\u6742\u4e14\u4f4e\u6548\u3002<\/p>\n<hr \/>\n<h4>3. \u53ef\u91cd\u5165\u6027&#xff08; Reentrancy &#xff09;<\/h4>\n<p>\u5b9a\u4e49&#xff1a;\u540c\u4e00\u5ba2\u6237\u7aef\u7684\u540c\u4e00\u7ebf\u7a0b\u53ef\u591a\u6b21\u83b7\u53d6\u5df2\u6301\u6709\u7684\u9501&#xff0c;\u907f\u514d\u81ea\u6b7b\u9501\u3002<\/p>\n<p>\u573a\u666f&#xff1a;\u7528\u6237\u4e0b\u8ba2\u5355\u65f6&#xff0c;sellTicket()\u8c03\u7528\u94fe\u5d4c\u5957updateOrder()\u2192sendSms()&#xff0c;\u4e09\u8005\u5747\u9700\u6821\u9a8c\u5e93\u5b58\u3002\u82e5\u4e0d\u53ef\u91cd\u5165&#xff0c;\u7b2c\u4e8c\u6b21lock()\u4f1a\u963b\u585e\u81ea\u5df1\u3002<\/p>\n<p>\u5b9e\u73b0&#xff1a;Redisson\u4f7f\u7528Hash\u7ed3\u6784\u5b58\u50a8threadId\u548ccount\u3002\u540c\u7ebf\u7a0b\u91cd\u590d\u83b7\u53d6\u65f6count&#043;&#043;&#xff0c;\u6bcf\u6b21unlock()\u65f6count&#8211;&#xff0c;\u8ba1\u6570\u5f52\u96f6\u624d\u771f\u6b63\u5220\u9664\u9501\u3002<\/p>\n<p>\u4ef7\u503c&#xff1a;\u63d0\u5347\u4e1a\u52a1\u5c01\u88c5\u7075\u6d3b\u6027&#xff0c;\u907f\u514d\u65b9\u6cd5\u8c03\u7528\u94fe\u56e0\u9501\u95ee\u9898\u8026\u5408\u3002<\/p>\n<hr \/>\n<h4>4. \u9ad8\u53ef\u7528&#xff08; High Availability &#xff09;<\/h4>\n<p>\u5b9a\u4e49&#xff1a;\u9501\u670d\u52a1\u4e0d\u80fd\u662f\u5355\u70b9&#xff0c;\u5fc5\u987b\u652f\u6301\u6545\u969c\u81ea\u52a8\u8f6c\u79fb\u3002<\/p>\n<p>\u573a\u666f&#xff1a;Redis\u5355\u673a\u90e8\u7f72&#xff0c;\u4e3b\u8282\u70b9\u5b95\u673a\u2192\u6240\u6709\u9501\u8bf7\u6c42\u5931\u8d25\u2192\u6625\u8fd0\u9ad8\u5cf0\u671f\u7cfb\u7edf\u762b\u75ea&#xff0c;\u5f15\u53d1P0\u7ea7\u6545\u969c\u3002<\/p>\n<p>\u5b9e\u73b0&#xff1a;Redis Cluster\u96c6\u7fa4&#xff08;3\u4e3b3\u4ece&#xff09;&#043; Sentinel\u54e8\u5175\u3002\u9501\u6570\u636e\u5206\u7247\u5b58\u50a8&#xff0c;\u4e3b\u8282\u70b9\u6545\u969c\u65f6\u4ece\u8282\u70b9\u79d2\u7ea7\u63d0\u5347&#xff0c;Redisson\u5ba2\u6237\u7aef\u81ea\u52a8\u5207\u6362\u8fde\u63a5\u3002<\/p>\n<p>\u6743\u8861&#xff1a;ZooKeeper\u901a\u8fc7ZAB\u534f\u8bae\u4fdd\u8bc1\u5f3a\u4e00\u81f4&#xff0c;\u4f46\u5199\u5165\u6027\u80fd\u4ec5\u4e3aRedis\u76841\/10\u3002Redis\u4e3b\u4ece\u5f02\u6b65\u590d\u5236\u53ef\u80fd\u4e22\u9501&#xff08;\u4e3b\u5b95\u673a\u4ece\u672a\u540c\u6b65&#xff09;&#xff0c;\u9700\u6839\u636e\u4e1a\u52a1\u5bb9\u5fcd\u5ea6\u9009\u578b&#xff1a;\u8d85\u5356\u96f6\u5bb9\u5fcd\u7528ZK&#xff0c;\u6027\u80fd\u4f18\u5148\u7528Redis\u3002<\/p>\n<hr \/>\n<h4>\u603b\u7ed3\u5347\u534e<\/h4>\n<p>\u56db\u4e2a\u6761\u4ef6\u73af\u73af\u76f8\u6263&#xff1a;\u4e92\u65a5\u6027\u662f\u76ee\u6807&#xff0c;\u9632\u6b7b\u9501\u662f\u515c\u5e95&#xff0c;\u53ef\u91cd\u5165\u662f\u5de5\u7a0b\u53cb\u597d&#xff0c;\u9ad8\u53ef\u7528\u662f\u5e95\u7ebf\u3002\u5b9e\u9645\u9009\u578b\u4e2d&#xff0c;Redisson &#043; Redis Cluster\u662f\u4e92\u8054\u7f51\u4e1a\u52a1\u6807\u914d&#xff0c;\u517c\u987e\u6027\u80fd\u4e0e\u53ef\u7528\u6027&#xff1b;\u91d1\u878d\u573a\u666f\u53ef\u63a5\u53d7\u6027\u80fd\u635f\u8017\u5219\u9009ZooKeeper\u3002\u56de\u7b54\u65f6\u53ef\u4e3b\u52a8\u63d0\u53caRedlock\u7b97\u6cd5\u4e89\u8bae&#xff08;Redis\u5b98\u7f51\u5df2\u4e0d\u63a8\u8350&#xff09;&#xff0c;\u4f53\u73b0\u6280\u672f\u89c6\u91ce\u6df1\u5ea6\u3002<\/p>\n<p>\u4e00\u53e5\u8bdd\u6536\u5c3e&#xff1a;\u5206\u5e03\u5f0f\u9501\u7684\u672c\u8d28\u662f\u5c06&#034;\u591a\u673a\u5e76\u884c&#034;\u8f6c\u4e3a&#034;\u5355\u673a\u4e32\u884c&#034;&#xff0c;\u800c\u8fd9\u56db\u4e2a\u6761\u4ef6\u662f\u4fdd\u8bc1\u8be5\u8f6c\u6362\u6b63\u786e\u3001\u53ef\u9760\u3001\u9ad8\u6548\u7684\u57fa\u77f3\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668&#xff0c;\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3\u5206\u5e03\u5f0f\u573a\u666f\u4e0b\u7684\u9501\u89e3\u51b3\u65b9\u6848<br \/>\n\u7968\u52a1\u7cfb\u7edf\u5728\u591a\u4e2a\u670d\u52a1\u5668\u90e8\u7f72\u65f6&#xff0c;\u5355\u673a\u9501&#xff08;\u5982Java\u7684synchronized\u6216ReentrantLock&#xff09;\u5931\u6548\u7684\u539f\u56e0\u5f88\u7b80\u5355&#xff1a;\u8fd9\u4e9b\u9501\u53ea\u5728\u5355\u4e2aJVM\u8fdb\u7a0b\u5185\u6709\u6548&#xff0c;\u65e0\u6cd5\u8de8\u670d\u52a1\u5668\u534f\u8c03\u3002\u4e09\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bfb\u53d6i100\u5e76\u5404\u81ea\u6267\u884ci&#8211;&#xff0c;\u6700\u7ec8\u90fd\u5199\u5165i99&#xff0c;\u5bfc\u81f4\u8d85\u5356\u3002\u5206\u5e03\u5f0f\u9501\u7684\u6838\u5fc3\u8981\u6c42<br \/>\n\u5b9e\u73b0<\/p>\n","protected":false},"author":2,"featured_media":63653,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[664,43,176],"topic":[],"class_list":["post-63654","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-664","tag-43","tag-176"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3 - \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\/63654.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668&#xff0c;\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3\u5206\u5e03\u5f0f\u573a\u666f\u4e0b\u7684\u9501\u89e3\u51b3\u65b9\u6848 \u7968\u52a1\u7cfb\u7edf\u5728\u591a\u4e2a\u670d\u52a1\u5668\u90e8\u7f72\u65f6&#xff0c;\u5355\u673a\u9501&#xff08;\u5982Java\u7684synchronized\u6216ReentrantLock&#xff09;\u5931\u6548\u7684\u539f\u56e0\u5f88\u7b80\u5355&#xff1a;\u8fd9\u4e9b\u9501\u53ea\u5728\u5355\u4e2aJVM\u8fdb\u7a0b\u5185\u6709\u6548&#xff0c;\u65e0\u6cd5\u8de8\u670d\u52a1\u5668\u534f\u8c03\u3002\u4e09\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bfb\u53d6i100\u5e76\u5404\u81ea\u6267\u884ci--&#xff0c;\u6700\u7ec8\u90fd\u5199\u5165i99&#xff0c;\u5bfc\u81f4\u8d85\u5356\u3002\u5206\u5e03\u5f0f\u9501\u7684\u6838\u5fc3\u8981\u6c42 \u5b9e\u73b0\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/63654.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-01-21T23:41:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121234118-6971641e891b1.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=\"4 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63654.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/63654.html\",\"name\":\"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-01-21T23:41:19+00:00\",\"dateModified\":\"2026-01-21T23:41:19+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/63654.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/63654.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/63654.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3\"}]},{\"@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":"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3 - \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\/63654.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668&#xff0c;\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3\u5206\u5e03\u5f0f\u573a\u666f\u4e0b\u7684\u9501\u89e3\u51b3\u65b9\u6848 \u7968\u52a1\u7cfb\u7edf\u5728\u591a\u4e2a\u670d\u52a1\u5668\u90e8\u7f72\u65f6&#xff0c;\u5355\u673a\u9501&#xff08;\u5982Java\u7684synchronized\u6216ReentrantLock&#xff09;\u5931\u6548\u7684\u539f\u56e0\u5f88\u7b80\u5355&#xff1a;\u8fd9\u4e9b\u9501\u53ea\u5728\u5355\u4e2aJVM\u8fdb\u7a0b\u5185\u6709\u6548&#xff0c;\u65e0\u6cd5\u8de8\u670d\u52a1\u5668\u534f\u8c03\u3002\u4e09\u53f0\u670d\u52a1\u5668\u540c\u65f6\u8bfb\u53d6i100\u5e76\u5404\u81ea\u6267\u884ci--&#xff0c;\u6700\u7ec8\u90fd\u5199\u5165i99&#xff0c;\u5bfc\u81f4\u8d85\u5356\u3002\u5206\u5e03\u5f0f\u9501\u7684\u6838\u5fc3\u8981\u6c42 \u5b9e\u73b0","og_url":"https:\/\/www.wsisp.com\/helps\/63654.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-01-21T23:41:19+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/01\/20260121234118-6971641e891b1.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"4 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/63654.html","url":"https:\/\/www.wsisp.com\/helps\/63654.html","name":"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-01-21T23:41:19+00:00","dateModified":"2026-01-21T23:41:19+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/63654.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/63654.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/63654.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u5feb\u5237\u9762\u8bd5-\u9ad8\u5e76\u53d1\u9501\u7bc7\u3011- \u57fa\u4e8e\u7968\u52a1\u7cfb\u7edf\u5728\u4e0d\u540c\u670d\u52a1\u5668\uff0c\u5206\u5e03\u5f0f\u573a\u666f\u4e2d\u8be5\u5982\u4f55\u89e3\u51b3"}]},{"@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\/63654","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=63654"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/63654\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/63653"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=63654"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=63654"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=63654"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=63654"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}