{"id":237222,"date":"2022-03-20T09:37:12","date_gmt":"2022-03-20T01:37:12","guid":{"rendered":"https:\/\/lrxjmw.cn\/?p=237222"},"modified":"2022-03-07T10:38:27","modified_gmt":"2022-03-07T02:38:27","slug":"linux-rocketmq","status":"publish","type":"post","link":"https:\/\/lrxjmw.cn\/linux-rocketmq.html","title":{"rendered":"Linux \u73af\u5883\u4e0b\u5982\u4f55\u5b89\u88c5\u90e8\u7f72 RocketMQ \u6559\u7a0b"},"content":{"rendered":"\n\n\n
\u5bfc\u8bfb<\/td>\n\u8fd9\u91cc\u662f RocketMQ \u7cfb\u5217\u7684\u7b2c\u4e00\u7bc7\u6587\u7ae0\uff0c\u5de5\u6b32\u5584\u5176\u4e8b\uff0c\u5fc5\u5148\u5229\u5176\u5668\uff0c\u5148\u4e0d\u8bb2\u7406\u8bba\uff0c\u4e5f\u4e0d\u5177\u4f53\u4ecb\u7ecd RocketMQ,\u6211\u4eec\u5148\u628a RocketMQ\u5148\u5b89\u88c5\u4e0a\uff0c\u8ba9\u4f60\u4eec\u5b9e\u5730\u611f\u53d7\u4e0b RocketMQ \u6574\u4e2a\u5b89\u88c5\u6d41\u7a0b\uff0c\u5b89\u88c5\u5b8c\u540e\u6211\u4eec\u518d\u540e\u7eed\u6587\u7ae0\u5bf9 RocketMQ \u624b\u672f\u5200\u5f0f\u4e00\u5c42\u4e00\u5c42\u8fdb\u884c\u5256\u6790\u3002<\/strong><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n
\u4e0b\u8f7d\u5b89\u88c5\u5305<\/strong><\/div>\n

\u76f4\u63a5\u4ece RocketMQ \u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305<\/p>\n

\u4e0b\u8f7d\u5730\u5740\uff1a<\/p>\n

https:\/\/www.apache.org\/dyn\/closer.cgi?path=rocketmq\/4.9.2\/rocketmq-all-4.9.2-bin-release.zip<\/p>\n

\u89e3\u538b\u5b89\u88c5\u5305<\/strong><\/div>\n

\u4e0b\u8f7d\u540e\uff0c\u6211\u4eec\u5c06\u5b83\u653e\u5165linux\u670d\u52a1\u5668\u4e2d\u4efb\u610f\u76ee\u5f55\u5e76\u89e3\u538b\uff0c\u6211\u8fd9\u91cc\u4f7f\u7528\u7684\u662f\u4e91\u670d\u52a1\u5668\uff0c\u653e\u5230\u4e86data\u76ee\u5f55\u4e0b\uff0c\u4f60\u4eec\u4e5f\u53ef\u4ee5\u81ea\u5df1\u642d\u5efa\u670d\u52a1\u5668\u3002<\/p>\n

\/\/ \u89e3\u538b\u5b89\u88c5\u5305<\/p>\n

# unzip rocketmq-all-4.9.2-bin-release.zip<\/pre>\n

\/\/\u89e3\u538b\u540e\u4fee\u6539\u6587\u4ef6\u5939\u540d\u79f0\uff0c\u4e5f\u53ef\u4e0d\u4fee\u6539<\/p>\n

# mv rocketmq-4.9.2\/ rocketmq<\/pre>\n

\u914d\u7f6e\u73af\u5883\u53d8\u91cf<\/p>\n

\u6211\u4eec\u9700\u8981\u5c06\u521a\u521a\u89e3\u538b\u7684 rocketmq \u8def\u5f84\u914d\u7f6e\u5230\u73af\u5883\u53d8\u91cf\u4e2d\u3002
\n\/\/\u4f7f\u521a\u4fee\u6539\u7684\u914d\u7f6e\u6587\u4ef6\u751f\u6548<\/p>\n

# source \/etc\/profile<\/pre>\n

\/\/\u9a8c\u8bc1\u521a\u521a\u7684\u8def\u5f84\u914d\u7f6e\u662f\u5426\u751f\u6548<\/p>\n

# echo $ROCKETMQ_HOME<\/pre>\n

\/\/\u663e\u793a\u51fa\u8def\u5f84\u5730\u5740\u4ee3\u8868\u914d\u7f6e\u6ca1\u6709\u95ee\u9898<\/p>\n

\/data\/rocketmq<\/pre>\n

\u914d\u7f6e\u5b8c\u6210\u540e\uff0c\u9000\u51fa\u4fdd\u5b58\uff0c\u5982\u4f55\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4f7f\u5176\u751f\u6548<\/p>\n

\u542f\u52a8 nameserver<\/p>\n

# nohup sh bin\/mqnamesrv &<\/pre>\n

\u67e5\u770b\u662f\u5426\u542f\u52a8\u6210\u529f<\/p>\n

# nohup sh bin\/mqnamesrv &<\/pre>\n

\u53ef\u4ee5\u770b\u5230 nameServer \u6211\u4eec\u5c31\u5df2\u7ecf\u542f\u52a8\u6210\u529f\u4e86\u3002<\/p>\n

\u914d\u7f6e jvm\u53c2\u6570<\/strong><\/div>\n

RocketMQ Broker \u9ed8\u8ba4\u914d\u7f6e\u7684 jvm \u865a\u62df\u673a\u5185\u5b58\u5927\u5c0f\u53ef\u80fd\u6bd4\u8f83\u5927\uff0c\u5982\u679c\u4e0d\u4fee\u6539\u4f1a\u5bfc\u81f4\u542f\u52a8\u4e0d\u8d77\u6765\uff0c\u8fd9\u91cc\u6211\u4eec\u6839\u636e\u81ea\u5df1\u7684\u5b9e\u9645\u9700\u8981\u8fdb\u884c\u4fee\u6539\u3002<\/p>\n

# vi bin\/runbroker.sh<\/pre>\n

\"\"<\/p>\n

\u9ed8\u8ba4\u6307\u5b9a\u7684\u662f 8g\uff0c\u6211\u8fd9\u91cc\u4fee\u6539\u4e3a 256m\u3002<\/p>\n

\"\"<\/p>\n

\u542f\u52a8 Broker
\n\/\/\u542f\u52a8 NameServer \u547d\u4ee4<\/p>\n

# nohup sh bin\/mqbroker -c conf\/broker.conf &<\/pre>\n

# \u67e5\u770b\u662f\u5426\u542f\u52a8\u6210\u529f<\/p>\n

# jps -l<\/pre>\n

\u6a21\u62df\u53d1\u9001\u6d88\u606f \u548c \u6d88\u8d39\u6d88\u606f<\/p>\n

\u76ee\u524d \u6211\u4eec NameServer \u548c Broker \u90fd\u5df2\u7ecf\u542f\u52a8\u6210\u529f\uff0c\u5c31\u53ef\u4ee5\u8fdb\u884c\u53d1\u9001\u548c\u6d88\u8d39\u6d88\u606f\uff0cRocketMQ \u5b89\u88c5\u5305\u9ed8\u8ba4\u63d0\u4f9b\u4e86\u4e00\u4e2a\u6a21\u62df\u53d1\u9001\u6d88\u606f\u548c\u6d88\u8d39\u6d88\u606f\u7684\u6d4b\u8bd5\u7c7b\uff0c\u6211\u4eec\u6765\u9a8c\u8bc1\u4e00\u4e0b\u3002<\/p>\n

\u53d1\u9001\u6d88\u606f<\/p>\n

\/\/\u521b\u5efa\u751f\u4ea7\u8005\u53d1\u9001\u6d88\u606f<\/p>\n

# sh bin\/tools.sh org.apache.rocketmq.example.quickstart.Producer<\/pre>\n

\u6211\u4eec\u53d1\u73b0\u6ca1\u6709\u542f\u52a8\u8d77\u6765\uff0c\u51fa\u73b0\u4e86\u9519\u8bef\uff0c\u8fd9\u662f\u4e3a\u4ec0\u4e48\u5462?<\/p>\n

RocketMQ NameServer \u9ed8\u8ba4\u7aef\u53e3\u53f7\u662f 9876 \uff0c\u5982\u679c\u4f60\u5f00\u542f\u4e86\u9632\u706b\u5899\uff0c\u4f60\u8981\u4e48\u5173\u95ed\u9632\u706b\u5899\uff0c\u8981\u4e48\u5728\u5b89\u5168\u7ec4\u4e2d\u5c06 9876 \u7aef\u53e3\u53f7\u8bbe\u7f6e\u5141\u8bb8\u8bbf\u95ee\uff0c\u6211\u8fd9\u91cc\u5c31\u8bbe\u7f6e\u4e86\u5141\u8bb8\u8bbf\u95ee\u3002<\/p>\n

\u6b64\u65f6\uff0c\u6a21\u62df\u53d1\u9001\u6210\u529f\u4e86\uff0c\u9ed8\u8ba4\u662f\u53d1\u9001 1000 \u6761\u6d88\u606f\u3002<\/p>\n

\u6d88\u8d39\u6d88\u606f<\/p>\n

# sh bin\/tools.sh org.apache.rocketmq.example.quickstart.Consumer<\/pre>\n

\u901a\u8fc7\u6a21\u62df\u53d1\u9001\u548c\u6d88\u8d39\uff0c\u4e5f\u5c31\u9a8c\u8bc1\u4e86\u6211\u4eec\u6574\u4e2a RocketMQ \u5c31\u642d\u5efa\u6210\u529f\u4e86\u3002<\/p>\n

\u8fd8\u6709\u4e2a NameServer \u548c Broker \u5173\u95ed\u547d\u4ee4\u4e5f\u4ecb\u7ecd\u4e0b\uff1a
\n\/\/ \u5173\u95ed Broker<\/p>\n

sh bin\/mqshutdown broker<\/pre>\n

\/\/ \u5173\u95ed NameServer<\/p>\n

sh bin\/mqshutdown namesrv<\/pre>\n","protected":false},"excerpt":{"rendered":"

\u76f4\u63a5\u4ece RocketMQ \u5b98\u7f51\u4e0b\u8f7d\u6700\u65b0\u7684\u5b89\u88c5\u5305 \u4e0b\u8f7d\u5730\u5740\uff1a https:\/\/www.apache.org\/dy […]<\/p>\n","protected":false},"author":323,"featured_media":216064,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[55],"tags":[],"class_list":["post-237222","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-thread"],"acf":[],"_links":{"self":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/237222","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/users\/323"}],"replies":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/comments?post=237222"}],"version-history":[{"count":7,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/237222\/revisions"}],"predecessor-version":[{"id":237243,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/posts\/237222\/revisions\/237243"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media\/216064"}],"wp:attachment":[{"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/media?parent=237222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/categories?post=237222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/lrxjmw.cn\/wp-json\/wp\/v2\/tags?post=237222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}