{"id":651,"date":"2023-03-23T21:42:05","date_gmt":"2023-03-23T13:42:05","guid":{"rendered":""},"modified":"2023-03-23T21:42:05","modified_gmt":"2023-03-23T13:42:05","slug":"SpringCloud Bus","status":"publish","type":"post","link":"https:\/\/bianchenghao6.com\/651.html","title":{"rendered":"SpringCloud Bus"},"content":{"rendered":"
\n
\r\n{\"maximum\"<\/span>:222,\"minimum\"<\/span>:2}\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u6211\u4eec\u6b63\u5728\u4ece
\n limits-service-qa.properties <\/strong>\u6587\u4ef6\u4e2d\u83b7\u53d6\u8fd9\u4e9b\u503c\uff0c\u56e0\u4e3a\u6211\u4eec\u5df2\u5c06\u8be5\u6587\u4ef6\u914d\u7f6e\u4e3a
\n bootstrap.properties <\/strong>\u6587\u4ef6\u4e2d> limits-service \u3002\n <\/div>\n\n \u5728\u4e0b\u4e00\u6b65\u4e2d\uff0c\u6211\u4eec\u5c06\u518d\u521b\u5efa\u4e00\u4e2a
\n LimitsServiceApplication\u5b9e\u4f8b\u3002<\/strong>\n <\/div>\n\n \u6b65\u9aa44: <\/strong>\u521b\u5efa
\n LimitsServiceApplication\u7684\u5b9e\u4f8b\u3002<\/strong>\n <\/div>\n\n \u53f3\u952e\u5355\u51fb
\n limits-service <\/strong>\u9879\u76ee->\u8fd0\u884c\u65b9\u5f0f->\u8fd0\u884c\u914d\u7f6e\u2026->\u53f3\u952e\u5355\u51fb
\n LimitsServiceApplication <\/strong>->\u590d\u5236->\u5c06\u5e94\u7528\u7a0b\u5e8f\u540d\u79f0\u91cd\u547d\u540d\u4e3a
\n LimitsServiceApplication8081 <\/strong>->\u5355\u51fb
\n Arguments <\/strong>\u9009\u9879\u5361->\u63d0\u4f9bVM\u53c2\u6570:
\n -Dserver.port = 8081 <\/strong>->\u8fd0\u884c
\n \u3002<\/strong>\n <\/div>\n
<\/p>\n
\n LimitsServiceApplicat\u7684\u5b9e\u4f8bion\u5c06\u5728\u7aef\u53e3
\n 8081 <\/strong>\u4e0a\u8fd0\u884c\u3002\n <\/div>\n\n \u6b65\u9aa45: <\/strong>\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8c03\u7528URL http:\/\/locahost: 8081\/limits \u3002\u5b83\u8fd4\u56de\u4e0e\u539f\u59cb\u9650\u5236\u670d\u52a1\u53d1\u9001\u7684\u54cd\u5e94\u76f8\u540c\u7684\u54cd\u5e94\u3002\n <\/div>\n\n\r\n{\"maximum\"<\/span>:222,\"minimum\"<\/span>:2}\r\n<\/pre>\n<\/code>\n <\/div>\n
\n limits-service\u7684\u4e24\u4e2a\u5b9e\u4f8b\u5df2\u542f\u52a8\u5e76\u6b63\u5728\u8fd0\u884c\u3002\n <\/div>\n\n \u6b65\u9aa46: <\/strong>\u5728
\n limits-service-qa.properties\u4e2d\u8fdb\u884c\u66f4\u6539\uff0c<\/strong>\u6211\u4eec\u5df2\u5c06\u6700\u5c0f\u503c\u4ece
\n 2 <\/strong>\u66f4\u6539\u4e3a
\n 22 <\/strong>\u3002\n <\/div>\n\n limits-service-qa.properties <\/strong>\n <\/div>\n\n\r\nlimits-service.minimum=22\r\nlimits-service.maximum=222\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u6211\u4eec\u9700\u8981
\n \u63d0\u4ea4<\/strong>\u66f4\u6539\u3002\n <\/div>\n\n \u6b65\u9aa47: <\/strong>\u6253\u5f00
\n Git Bash <\/strong>\u5e76\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4:\n <\/div>\n\n\r\n$ cd git-localconfig-repo\r\n$ git add *\r\n$ git commit –m \"qa minimum to 22\"<\/span><\/span>\r\n<\/pre>\n<\/code>\n <\/div>\n
<\/p>\n
\n \u518d\u6b21\uff0c\u8c03\u7528URLs http:\/\/localhost:8080\/limits \u548c http:\/\/localhost:8081\/limits \u3002\u8fd9\u4e24\u4e2aURL\u90fd\u8fd4\u56de\u65e7\u503c\uff0c\u800c\u6211\u4eec\u5df2\u7ecf\u5728Git\u5b58\u50a8\u5e93\u4e2d\u63d0\u4ea4\u4e86\u8fd9\u4e9b\u503c\u3002\u5b83\u4e0d\u53cd\u6620
\n limits-service <\/strong>\u4e2d\u7684\u503c\u3002\u8981\u66f4\u6539\u9650\u989d\u670d\u52a1\uff0c\u6211\u4eec\u5c06\u4f7f\u7528
\n \u90ae\u9012\u5458\u3002<\/strong>\n <\/div>\n\n \u6ce8\u610f: <\/span>\u5728\u8fdb\u884c\u4e0b\u4e00\u6b65\u4e4b\u524d\uff0c\u8bf7\u4eceLimits-service\u4e2d\u5220\u9664\u5b89\u5168\u6027\u3002\n <\/div>\n\n \u6b65\u9aa48: <\/strong>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u6253\u5f00
\n limits-service.properties <\/strong>\u6587\u4ef6\u5e76\u7981\u7528
\n \u5b89\u5168\u6027<\/strong>\u58f0\u660e\u3002\n <\/div>\n\n\r\nmanagement.security.enabled=false\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u518d\u6b21\uff0c\u5728
\n limits-service-qa.properties <\/strong>\u6587\u4ef6\u4e2d\u8bbe\u7f6e\u65e7\u503c\uff0c\u7136\u540e\u63d0\u4ea4\u66f4\u6539\u3002\n <\/div>\n\n <\/div>\n\n \u6b65\u9aa49: <\/strong>\u6253\u5f00
\n \u90ae\u9012\u5458<\/strong>\uff0c\u5e76\u53d1\u9001\u5e26\u6709URL http\u7684
\n POST <\/strong>\u8bf7\u6c42\u3002 : \/\/localhost:8080\/application\/refresh \u3002\n <\/div>\n\n \u6ce8\u610f: <\/span>\u5982\u679c\u60a8\u6b63\u5728\u8c03\u7528URL http:\/\/localhost:8080\/limits\uff0c\u5e76\u4e14\u5b83\u4e0d\u8fd4\u56de\u65b0\u503c\u3002\u56e0\u6b64\uff0c\u8981\u83b7\u53d6\u6709\u5173\u8c03\u7528URL http:\/\/localhost:8081\/limits\u7684\u65b0\u503c\uff0c\u60a8\u5fc5\u987b\u6267\u884c\u4ee5\u4e0b\u64cd\u4f5c: \u6253\u5f00\u90ae\u9012\u5458\u5e76\u53d1\u9001URL\u4e3ahttp:\/\/localhost:8081\/application\/refresh\u7684POST\u8bf7\u6c42\u3002\n <\/div>\n\n \u6b65\u9aa410: <\/strong>\u3002\u8c03\u7528URL http:\/\/localhost:8080\/limits \u548c http:\/\/localhost:8081\/limits \u3002\u73b0\u5728\uff0c\u4e24\u4e2aURL\u90fd\u8fd4\u56de\u66f4\u6539\u540e\u7684\u503c\u3002\n <\/div>\n\n\r\n{\"maximum\"<\/span>:222,\"minimum\"<\/span>:22}\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u6211\u4eec\u521b\u5efa\u4e86limits-service\u7684\u4e24\u4e2a\u5b9e\u4f8b\u3002\u5047\u8bbe\u6709\u4e00\u767e\u4e2a\u5e76\u884c\u8fd0\u884c\u7684\u6781\u9650\u670d\u52a1\u5b9e\u4f8b\u3002\u6211\u4eec\u9700\u8981\u8c03\u7528100\u4e2aURL\u624d\u80fd\u4eceGit\u5b58\u50a8\u5e93\u4e2d\u5237\u65b0\u914d\u7f6e\u3002\n <\/div>\n\n \u8c03\u7528100\u4e2aURL\u5e76\u4e0d\u50cf\u9650\u5236\u670d\u52a1\u6570\u91cf\u7684\u589e\u52a0\u90a3\u6837\u5bb9\u6613\u3002\u968f\u4e4b\u800c\u6765\u7684\u662f\uff0c\u670d\u52a1\u7684\u7ef4\u62a4\u9ebb\u70e6\u4e5f\u8d8a\u6765\u8d8a\u5927\u3002\n <\/div>\n\n \u6bcf\u5f53\u6211\u4eec\u5bf9\u914d\u7f6e\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u5b83\u90fd\u5fc5\u987b\u53cd\u6620\u5fae\u670d\u52a1\u4e2d\u7684\u66f4\u6539\u3002\u5728\u8fd9\u91cc\uff0c
\n Spring Cloud Bus <\/strong>\u63d0\u4f9b\u4e86\u89e3\u51b3\u65b9\u6848\uff0c\u56e0\u6b64\u6211\u4eec\u4e0d\u9700\u8981\u8c03\u7528\u6570\u767e\u4e2aURL\u3002\n <\/div>\n\n Spring Cloud Bus\u63d0\u4f9b\u4e86\u6240\u6709\u4e00\u767e\u4e2a\u5b9e\u4f8b\u7684URL\u3002\u5f53\u6211\u4eec\u8c03\u7528\u8be5URL\u65f6\uff0c\u5c06\u4f7f\u7528Git\u914d\u7f6e\u4e2d\u7684\u6700\u65b0\u503c\u6765\u66f4\u65b0\u5fae\u670d\u52a1\u7684\u6240\u6709\u5b9e\u4f8b\u3002\n <\/div>\n\n \u5728\u4e0b\u4e00\u6b65\u4e2d\uff0c\u6211\u4eec\u5c06\u5b9e\u73b0Spring Cloud Bus\u3002\n <\/div>\n
\n\u5b9e\u73b0Spring Cloud Bus <\/h2>\n\n \u5728\u672c\u8282\u4e2d\uff0c\u5f53\u6211\u4eec\u5728Git\u5b58\u50a8\u5e93\u4e2d\u8fdb\u884c\u66f4\u6539\u65f6\uff0c\u6211\u4eec\u5fc5\u987b\u547d\u4e2d
\n limits-service <\/strong>\u7684\u591a\u4e2a\u5b9e\u4f8b>\u5237\u65b0\u914d\u7f6e\u3002\n <\/div>\n\n \u6211\u4eec\u5c06\u8c03\u7528\u4e00\u4e2aURL\uff0c\u5b83\u5c06\u53cd\u6620\u5fae\u670d\u52a1\u7684\u6240\u6709\u4e00\u767e\u4e2a\u5b9e\u4f8b\u3002\u5728\u8fd9\u91cc\uff0c\u6211\u4eec\u5c06\u4f7f\u7528
\n Spring Cloud Bus <\/strong>\u3002 Spring Cloud Bus\u4e2d\u6709\u8bb8\u591a\u53ef\u7528\u7684\u9009\u9879:
\n Apache <\/strong>
\n Kafka\uff0cRabbitMQ <\/strong>\u7b49\u3002\u5728\u672c\u90e8\u5206\u4e2d\uff0c\u6211\u4eec\u5c06\u4f7f\u7528
\n RabbitMQ <\/strong>\u3002\n <\/div>\n\n \u6ce8\u610f: <\/strong>\u5728\u7ee7\u7eed\u4e0b\u4e00\u6b65\u4e4b\u524d\uff0c\u8bf7\u786e\u4fdd
\n RabbitMQ <\/strong>\u670d\u52a1\u5668\u5728\u540e\u53f0\u8fd0\u884c\u3002\n <\/div>\n\n \u8ba9\u6211\u4eec\u5728
\n limits-service <\/strong>\u548c
\n spring-cloud-config-server <\/strong>\u4e2d\u5b9e\u73b0Spring Cloud Bus\u3002\n <\/div>\n\n \u6b65\u9aa41: <\/strong>\u6253\u5f00
\n limits-service <\/strong>\u548c
\n spring-cloud-config-server\u7684 pom.xml <\/strong>\u6587\u4ef6<\/strong>\u9879\u76ee
\n \u3002 <\/strong>\u6dfb\u52a0
\n amqp <\/strong>\u4f9d\u8d56\u6027\u5e76\u4fdd\u5b58\u6587\u4ef6\u4ee5\u53cd\u6620\u66f4\u6539\u3002\n <\/div>\n\n\r\n<dependency>\r\n<groupId>org.springframework.cloud<\/groupId>\r\n<artifactId>spring-cloud-starter-bus-amqp<\/artifactId>\r\n<\/dependency>\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u6b65\u9aa42: <\/strong>\u6253\u5f00
\n bootstrap.properties <\/strong>\u6587\u4ef6\u5e76\u901a\u8fc7\u6dfb\u52a0\u4ee5\u4e0b\u8bed\u53e5\u6765\u7981\u7528\u7ba1\u7406\u5b89\u5168\u6027:\n <\/div>\n\n \u4f9d\u8d56\u6027\u5e76\u4fdd\u5b58\u6587\u4ef6\u4ee5\u53cd\u6620\u66f4\u6539\u3002\n <\/div>\n\n\r\nmanagement.security.enabled=false\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u6b65\u9aa43: <\/strong>\u9996\u5148\uff0c\u8fd0\u884c
\n SpringCloudConfigServerApplication.java <\/strong>\u6587\u4ef6\uff0c\u7136\u540e\u8fd0\u884climit-service\u7684\u4e24\u4e2a\u5b9e\u4f8b:
\n LimitsServiceApplication <\/strong>\u548c
\n LimitsServiceApplication8081\u3002 <\/strong>\n <\/div>\n\n \u6b65\u9aa45: <\/strong>\u8c03\u7528\u7f51\u5740 http:\/\/localhost:8080\/limits \u3002\u5b83\u8fd4\u56de\u4ee5\u4e0b\u54cd\u5e94:\n <\/div>\n\n \u4f9d\u8d56\u6027\u5e76\u4fdd\u5b58\u6587\u4ef6\u4ee5\u53cd\u6620\u66f4\u6539\u3002\n <\/div>\n\n\r\n{\"maximum\"<\/span>:222,\"minimum\"<\/span>:22}\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u73b0\u5728\uff0c\u8c03\u7528URL http:\/\/localhost:8081\/limits \u3002\u8fd8\u4f1a\u8fd4\u56de\u76f8\u540c\u7684\u54cd\u5e94\u3002\n <\/div>\n\n \u6b65\u9aa46: <\/strong>\u6253\u5f00
\n limits-service-qa.properties <\/strong>\u6587\u4ef6\uff0c\u5e76\u4ece
\n \u66f4\u6539\u6700\u5c0f\u503c22 <\/strong>\u5230
\n 29 <\/strong>\u3002\n <\/div>\n\n \u73b0\u5728\u6211\u4eec\u5fc5\u987b\u63d0\u4ea4\u66f4\u6539\u3002\n <\/div>\n\n \u6b65\u9aa47: <\/strong>\u6253\u5f00
\n \u90ae\u9012\u5458<\/strong>\u5e76\u4f7f\u7528URL http:\/\/localhost:8080\/bus\/\u53d1\u9001
\n POST <\/strong>\u8bf7\u6c42\u5237\u65b0\u3002\n <\/div>\n\n \u6ce8\u610f: <\/span>\u5982\u679c\u60a8\u4f7f\u7528\u7684\u662fSpring Boot 2.0.0\u6216\u66f4\u9ad8\u7248\u672c\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0bURL: http:\/\/localhost:8080\/actuatror\/bus-refresh\n <\/div>\n\n \u6b65\u9aa48: <\/strong>\u6253\u5f00\u6d4f\u89c8\u5668\u5e76\u8c03\u7528\u4e24\u4e2a\u5b9e\u4f8b( http:\/\/localhost : 8080\/limits \u548c http:\/\/localhost:8081\/limits )\u3002\u8fd9\u4e24\u4e2aURL\u90fd\u8fd4\u56de\u6211\u4eec\u5728
\n limits-service-qa.properties <\/strong>\u6587\u4ef6
\n \u4e2d\u914d\u7f6e\u7684\u66f4\u65b0\u503c\u3002<\/strong>\n <\/div>\n\n\r\n{\"maximum\"<\/span>:222,\"minimum\"<\/span>:29}\r\n<\/pre>\n<\/code>\n <\/div>\n
\n \u6211\u4eec\u5df2\u7ecf\u770b\u5230\u6700\u5c0f\u503c\u66f4\u6539\u4e3a29\u3002\u5728\u8fd9\u91cc\uff0c\u60a8\u53ef\u4ee5\u6ce8\u610f\u5230\u6211\u4eec\u6ca1\u6709\u5728Git\u5b58\u50a8\u5e93\u4e2d\u624b\u52a8\u63d0\u4ea4\u66f4\u6539\uff0c\u4f46\u662f\u66f4\u6539\u53cd\u6620\u5728Limits-service\u7684\u4e24\u4e2a\u5b9e\u4f8b\u4e2d\u3002\n <\/div>\n\n \u6211\u4eec\u6ca1\u6709\u63d0\u4ea4Git\u5b58\u50a8\u5e93\uff0c\u800c\u662f\u8c03\u7528\u4e86URL http:\/\/localhost:8080\/bus\/refresh \u3002\u8fd9\u4e00\u5207\u90fd\u662f\u7531\u4e8e
\n Spring Cloud Bus <\/strong>\u9020\u6210\u7684\u3002\n <\/div>\n\n \u5728\u7279\u5b9a\u60c5\u51b5\u4e0b\uff0c\u6211\u4eec\u5df2\u7ecf\u5728
\n RabbitMQ <\/strong>\u4e0a\u8fd0\u884c\u4e86Spring Cloud Bus\u3002\u5f53\u6211\u4eec\u542f\u52a8\u5e94\u7528\u7a0b\u5e8f\u65f6\uff0c\u5b83\u4e5f\u4ece\u6b64\u5f00\u59cb\u3002\u542f\u52a8Spring Cloud Bus\u4e4b\u540e\uff0c\u6240\u6709\u5fae\u670d\u52a1\u90fd\u4f1a\u5411
\n Bus <\/strong>\u6ce8\u518c\u3002\n <\/div>\n\n \u5f53\u6211\u4eec\u5bf9\u914d\u7f6e\u8fdb\u884c\u66f4\u6539\u5e76\u4e14\u5728\u4efb\u4f55\u5b9e\u4f8b\u4e0a\u8c03\u7528\u66f4\u6539\u65f6\uff0c\u5fae\u670d\u52a1\u90fd\u4f1a\u53d1\u9001
\n Spring Cloud Bus <\/strong>\u4e0a\u7684\u4e8b\u4ef6\u3002 Spring Cloud Bus\u5c06\u8be5\u4e8b\u4ef6\u4f20\u64ad\u5230\u5df2\u5411\u5176\u6ce8\u518c\u7684\u6240\u6709\u5fae\u670d\u52a1\u5b9e\u4f8b\u3002\n <\/div>\n\n \u5728\u672c\u8282\u4e2d\uff0c\u6211\u4eec\u89e3\u51b3\u4e86\u8c03\u7528\u591a\u4e2a\u5fae\u670d\u52a1\u5b9e\u4f8b\u7684\u95ee\u9898\u3002\n <\/div>\n <\/body>
\n<\/html><\/p>\n","protected":false},"excerpt":{"rendered":"SpringCloud Buszh-cn","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[106],"tags":[],"class_list":["post-651","post","type-post","status-publish","format-standard","hentry","category-bc_springcloud_jc"],"_links":{"self":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/651"}],"collection":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/comments?post=651"}],"version-history":[{"count":0,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/posts\/651\/revisions"}],"wp:attachment":[{"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/media?parent=651"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/categories?post=651"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bianchenghao6.com\/wp-json\/wp\/v2\/tags?post=651"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}