本篇內(nèi)容主要講解“RokcetMq安裝和快速啟動(dòng)的方法”,感興趣的朋友不妨來(lái)看看。本文介紹的方法操作簡(jiǎn)單快捷,實(shí)用性強(qiáng)。下面就讓小編來(lái)帶大家學(xué)習(xí)“RokcetMq安裝和快速啟動(dòng)的方法”吧!
成都創(chuàng)新互聯(lián)長(zhǎng)期為成百上千家客戶(hù)提供的網(wǎng)站建設(shè)服務(wù),團(tuán)隊(duì)從業(yè)經(jīng)驗(yàn)10年,關(guān)注不同地域、不同群體,并針對(duì)不同對(duì)象提供差異化的產(chǎn)品和服務(wù);打造開(kāi)放共贏平臺(tái),與合作伙伴共同營(yíng)造健康的互聯(lián)網(wǎng)生態(tài)環(huán)境。為鄉(xiāng)寧企業(yè)提供專(zhuān)業(yè)的成都做網(wǎng)站、成都網(wǎng)站制作,鄉(xiāng)寧網(wǎng)站改版等技術(shù)服務(wù)。擁有10多年豐富建站經(jīng)驗(yàn)和眾多成功案例,為您定制開(kāi)發(fā)。
訪問(wèn): http://rocketmq.apache.org/dowloading/releases/ 下載最新版本
將下載的最新版本包放在linux服務(wù)器,這里以rocketmq-all-4.5.2-bin-release.zip為例;
[jenkins@test01 rocketmq]$ ll 總用量 12296 -rw-r--r--. 1 jenkins jenkins 12589252 10月 22 15:45 rocketmq-all-4.5.2-bin-release.zip [jenkins@test01 rocketmq]$ unzip rocketmq-all-4.5.2-bin-release.zip Archive: rocketmq-all-4.5.2-bin-release.zip creating: rocketmq-all-4.5.2-bin-release/ creating: rocketmq-all-4.5.2-bin-release/benchmark/ inflating: rocketmq-all-4.5.2-bin-release/benchmark/consumer.sh inflating: rocketmq-all-4.5.2-bin-release/benchmark/runclass.sh inflating: rocketmq-all-4.5.2-bin-release/benchmark/tproducer.sh inflating: rocketmq-all-4.5.2-bin-release/benchmark/producer.sh ........
然后參考官網(wǎng)快速啟動(dòng)文檔: http://rocketmq.apache.org/docs/quick-start/
由于name server和broker默認(rèn)配置為4g到8g的內(nèi)存,如果服務(wù)器內(nèi)存不足需要修改默認(rèn)內(nèi)存;
解決辦法,找到runserver.sh和runbroker.sh,編輯 JAVA_OPT=”${JAVA_OPT} -server -Xms256m -Xmx256m -Xmn125m-XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m”
[jenkins@test01 rocketmq]$ mv rocketmq-all-4.5.2-bin-release rocketmq-all-4.5.2 [jenkins@test01 rocketmq]$ cd rocketmq-all-4.5.2 [jenkins@test01 rocketmq-all-4.5.2]$ ll 總用量 44 drwxr-xr-x. 2 jenkins jenkins 4096 8月 2 10:05 benchmark drwxr-xr-x. 3 jenkins jenkins 4096 7月 31 21:11 bin drwxr-xr-x. 6 jenkins jenkins 4096 7月 31 21:09 conf drwxr-xr-x. 2 jenkins jenkins 4096 8月 2 10:05 lib -rw-r--r--. 1 jenkins jenkins 17336 7月 31 21:09 LICENSE -rw-r--r--. 1 jenkins jenkins 1338 7月 31 21:09 NOTICE -rw-r--r--. 1 jenkins jenkins 4020 7月 31 21:09 README.md [jenkins@test01 rocketmq-all-4.5.2]$ nohup sh bin/mqnamesrv > mqnamesrv.out & [1] 13179 nohup: 忽略輸入重定向錯(cuò)誤到標(biāo)準(zhǔn)輸出端 [jenkins@test01 rocketmq-all-4.5.2]$ tail -500f mqnamesrv.out Java HotSpot(TM) 64-Bit Server VM warning: Using the DefNew young collector with the CMS collector is deprecated and will likely be removed in a future release Java HotSpot(TM) 64-Bit Server VM warning: UseCMSCompactAtFullCollection is deprecated and will likely be removed in a future release. The Name Server boot success. serializeType=JSON
看到The Name Server boot success. serializeType=JSON代表已經(jīng)部署name server成功。
[jenkins@test01 rocketmq-all-4.5.2]$ nohup sh bin/mqbroker -n 10.130.44.165:9876 > mqbroker.out & [8] 13782 [6] Exit 143 nohup sh bin/mqbroker -n 10.130.44.165:9876 > mqbroker.out [jenkins@test01 rocketmq-all-4.5.2]$ nohup: 忽略輸入重定向錯(cuò)誤到標(biāo)準(zhǔn)輸出端 [jenkins@test01 rocketmq-all-4.5.2]$ tail -500f mqbroker.out The broker[test01, 10.130.44.165:10911] boot success. serializeType=JSON and name server is 10.130.44.165:9876
看到The broker[test01, 10.130.44.165:10911] boot success代表Broker已啟動(dòng),并且已經(jīng)連接到name server。
先設(shè)置 NAMESRV_ADDR環(huán)境變量,然后使用消息發(fā)送工具
[jenkins@test01 rocketmq-all-4.5.2]$ export NAMESRV_ADDR=localhost:9876 [jenkins@test01 rocketmq-all-4.5.2]$ sh bin/tools.sh org.apache.rocketmq.example.quickstart.Producer 14:55:28.799 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework RocketMQLog:WARN No appenders could be found for logger (io.netty.util.internal.PlatformDependent0). RocketMQLog:WARN Please initialize the logger system properly. SendResult [sendStatus=SEND_OK, msgId=0A822CA5432112A3A380747FC2A30000, offsetMsgId=0A822CA500002A9F0000000000000000, messageQueue=MessageQueue [topic=TopicTest, brokerName=test01, queueId=0], queueOffset=0] SendResult [sendStatus=SEND_OK, msgId=0A822CA5432112A3A380747FC3120001, offsetMsgId=0A822CA500002A9F00000000000000B2, messageQueue=MessageQueue [topic=TopicTest, brokerName=test01, …………………… SendResult [sendStatus=SEND_OK, msgId=0A822CA5432112A3A380747FD3FD03E7, offsetMsgId=0A822CA500002A9F000000000002BDFE, messageQueue=MessageQueue [topic=TopicTest, brokerName=test01, queueId=3], queueOffset=249] 14:55:34.461 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[127.0.0.1:9876] result: true 14:55:34.470 [NettyClientSelector_1] INFO RocketmqRemoting - closeChannel: close the connection to remote address[10.130.44.165:10911] result: true [jenkins@test01 rocketmq-all-4.5.2]$
啟動(dòng)消息接收工具,消息接收工具會(huì)一直等待消息發(fā)送,不會(huì)自動(dòng)停止
[jenkins@test01 rocketmq-all-4.5.2]$ sh bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer 14:59:55.032 [main] DEBUG i.n.u.i.l.InternalLoggerFactory - Using SLF4J as the default logging framework Consumer Started. …………………… ConsumeMessageThread_2 Receive New Messages: [MessageExt [queueId=2, storeSize=180, queueOffset=485, sysFlag=0, bornTimestamp=1571813940924, bornHost=/10.130.44.165:58852, storeTimestamp=1571813940925, storeHost=/10.130.44.165:10911, msgId=0A822CA500002A9F0000000000055334, commitLogOffset=348980, bodyCRC=1786477042, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message{topic='TopicTest', flag=0, properties={MIN_OFFSET=0, MAX_OFFSET=500, CONSUME_START_TIME=1571813984202, UNIQ_KEY=0A822CA543EA12A3A3807482FABC03AC, WAIT=true, TAGS=TagA}, body=[72, 101, 108, 108, 111, 32, 82, 111, 99, 107, 101, 116, 77, 81, 32, 57, 52, 48], transactionId='null'}]] ConsumeMessageThread_5 Receive New Messages: [MessageExt [queueId=2, storeSize=180, queueOffset=482, sysFlag=0, bornTimestamp=1571813940894, bornHost=/10.130.44.165:58852, storeTimestamp=1571813940895, storeHost=/10.130.44.165:10911, msgId=0A822CA500002A9F0000000000054AC4, commitLogOffset=346820, bodyCRC=855266886, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message{topic='TopicTest', flag=0, properties={MIN_OFFSET=0, MAX_OFFSET=500, CONSUME_START_TIME=1571813984200, UNIQ_KEY=0A822CA543EA12A3A3807482FA9E03A0, WAIT=true, TAGS=TagA}, body=[72, 101, 108, 108, 111, 32, 82, 111, 99, 107, 101, 116, 77, 81, 32, 57, 50, 56], transactionId='null'}]]
至此環(huán)境搭建完成,并通過(guò)測(cè)試。
停止需要先暫停broker,再停止namesrv,具體命令如下:
[jenkins@test01 rocketmq-all-4.5.2]$ sh bin/mqshutdown broker The mqbroker(13790) is running... Send shutdown request to mqbroker(13790) OK [jenkins@test01 rocketmq-all-4.5.2]$ sh bin/mqshutdown namesrv The mqnamesrv(13501) is running... Send shutdown request to mqnamesrv(13501) OK [jenkins@test01 rocketmq-all-4.5.2]$
RocketMq默認(rèn)日志目錄放在當(dāng)前用戶(hù)的logs目錄下。
[jenkins@test01 rocketmqlogs]$ pwd /home/jenkins/logs/rocketmqlogs [jenkins@test01 rocketmqlogs]$ ll 總用量 31220 -rw-rw-r--. 1 jenkins jenkins 5063 10月 23 17:01 broker_default.log -rw-rw-r--. 1 jenkins jenkins 707575 10月 23 18:26 broker.log -rw-rw-r--. 1 jenkins jenkins 0 10月 22 17:03 commercial.log -rw-rw-r--. 1 jenkins jenkins 0 10月 22 17:03 filter.log -rw-rw-r--. 1 jenkins jenkins 0 10月 22 17:03 lock.log -rw-rw-r--. 1 jenkins jenkins 3157 10月 23 17:00 namesrv_default.log -rw-rw-r--. 1 jenkins jenkins 203504 10月 23 18:21 namesrv.log -rw-rw-r--. 1 jenkins jenkins 0 10月 22 17:03 protection.log -rw-rw-r--. 1 jenkins jenkins 157157 10月 23 18:19 remoting.log -rw-rw-r--. 1 jenkins jenkins 1368353 10月 23 18:19 rocketmq_client.log -rw-rw-r--. 1 jenkins jenkins 194451 10月 23 18:26 stats.log -rw-rw-r--. 1 jenkins jenkins 0 10月 22 17:03 storeerror.log -rw-rw-r--. 1 jenkins jenkins 3510867 10月 23 18:25 store.log -rw-rw-r--. 1 jenkins jenkins 1515006 10月 23 18:25 transaction.log -rw-rw-r--. 1 jenkins jenkins 24251040 10月 23 18:26 watermark.log
到此,相信大家對(duì)“RokcetMq安裝和快速啟動(dòng)的方法”有了更深的了解,不妨來(lái)實(shí)際操作一番吧!這里是創(chuàng)新互聯(lián)網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢(xún),關(guān)注我們,繼續(xù)學(xué)習(xí)!
新聞名稱(chēng):RokcetMq安裝和快速啟動(dòng)的方法
URL地址:http://aaarwkj.com/article32/gdigpc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供服務(wù)器托管、網(wǎng)站制作、ChatGPT、建站公司、網(wǎng)頁(yè)設(shè)計(jì)公司、網(wǎng)站導(dǎo)航
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)