set ROCKETMQ_HOME="F:\rocketmq" set NAMESRV_ADDR="localhost:9876" #指定NAMESRV_ADDR的端口
如果不设置,在运行时就会有下面这样的提示
1 2
F:\rocketmq>bin\mqnamesrv.cmd Please set the ROCKETMQ_HOME variable in your environment!
另外,在配置JDK的环境变量切记不能有空格,否者在启动时也会出现错误
1 2 3 4
F:\rocketmq>bin\mqnamesrv.cmd 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. 错误: 找不到或无法加载主类 org.apache.rocketmq.namesrv.NamesrvStartup
好了,环境已经准备就绪,开始发车了,先启动Name Server
1 2 3 4
F:\rocketmq>bin\mqnamesrv.cmd 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
org.apache.rocketmq.client.exception.MQClientException: Send [3] times, still failed, cost [1076]ms, Topic: TopicTest, BrokersSent: [gf-, gf-, gf-] See http://rocketmq.apache.org/docs/faq/ for further details. at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:674) at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1384) at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.send(DefaultMQProducerImpl.java:1328) at org.apache.rocketmq.client.producer.DefaultMQProducer.send(DefaultMQProducer.java:330) at org.apache.rocketmq.example.quickstart.Producer.main(Producer.java:67) Caused by: org.apache.rocketmq.client.exception.MQBrokerException: CODE: 14 DESC: service not available now. It may be caused by one of the following reasons: the broker's disk is full [CL: 0.96 CQ: 0.96 INDEX: 0.96], messages are put to the slave, message store has been shut down, etc. BROKER: 169.254.224.226:10911 For more information, please visit the url, http://rocketmq.apache.org/docs/faq/ at org.apache.rocketmq.client.impl.MQClientAPIImpl.processSendResponse(MQClientAPIImpl.java:666) at org.apache.rocketmq.client.impl.MQClientAPIImpl.sendMessageSync(MQClientAPIImpl.java:505) at org.apache.rocketmq.client.impl.MQClientAPIImpl.sendMessage(MQClientAPIImpl.java:487) at org.apache.rocketmq.client.impl.MQClientAPIImpl.sendMessage(MQClientAPIImpl.java:431) at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendKernelImpl(DefaultMQProducerImpl.java:863) at org.apache.rocketmq.client.impl.producer.DefaultMQProducerImpl.sendDefaultImpl(DefaultMQProducerImpl.java:593) ... 4 more
F:\rocketmq>bin\mqbroker.cmd -n localhost:9876 autoCreateTopicEnable=true -c conf/broker.conf The broker[gf-xxb-wum, 169.254.224.226:10911] boot success. serializeType=JSON and name server is localhost:9876
G:\迅雷下载\rocketmq-externals-master\rocketmq-console\target>java -jar rocketmq-console-ng-2.0.0.jar --rocketmq.config.namesrvAddr=172.20.8.77:9876 08:51:57,422 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback-test.xml] 08:51:57,423 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Could NOT find resource [logback.groovy] 08:51:57,423 |-INFO in ch.qos.logback.classic.LoggerContext[default] - Found resource [logback.xml] at [jar:file:/G:/迅雷下载/rocketmq-externals-master/rocketmq-console/target/rocketmq-console-ng-2.0.0.jar!/BOOT-INF/classes!/logback.xml] 08:51:57,441 |-INFO in ch.qos.logback.core.joran.spi.ConfigurationWatchList@7591083d - URL [jar:file:/G:/迅雷下载/rocketmq-externals-master/rocketmq-console/target/rocketmq-console-ng-2.0.0.jar!/BOOT-INF/classes!/logback.xml] is not of type file 08:51:57,672 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - debug attribute not set 08:51:57,673 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.ConsoleAppender] 08:51:57,679 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [STDOUT] 08:51:57,684 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:51:57,831 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - About to instantiate appender of type [ch.qos.logback.core.rolling.RollingFileAppender] 08:51:57,836 |-INFO in ch.qos.logback.core.joran.action.AppenderAction - Naming appender as [FILE] 08:51:57,863 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@2007328737 - No compression will be used 08:51:57,864 |-INFO in c.q.l.core.rolling.TimeBasedRollingPolicy@2007328737 - Will use the pattern C:/Users/wmymt/logs/consolelogs/rocketmq-console-%d{yyyy-MM-dd}.%i.log for the active file 08:51:57,866 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@736e9adb - The date pattern is 'yyyy-MM-dd' from file name pattern 'C:/Users/wmymt/logs/consolelogs/rocketmq-console-%d{yyyy-MM-dd}.%i.log'. 08:51:57,866 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@736e9adb - Roll-over at midnight. 08:51:57,871 |-INFO in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@736e9adb - Setting initial period to Thu Aug 12 08:51:57 CST 2021 08:51:57,871 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@736e9adb - SizeAndTimeBasedFNATP is deprecated. Use SizeAndTimeBasedRollingPolicy instead 08:51:57,871 |-WARN in ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP@736e9adb - For more information see http://logback.qos.ch/manual/appenders.html#SizeAndTimeBasedRollingPolicy 08:51:57,872 |-INFO in ch.qos.logback.core.joran.action.NestedComplexPropertyIA - Assuming default type [ch.qos.logback.classic.encoder.PatternLayoutEncoder] for [encoder] property 08:51:57,874 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - Active log file name: C:\Users\wmymt/logs/consolelogs/rocketmq-console.log 08:51:57,874 |-INFO in ch.qos.logback.core.rolling.RollingFileAppender[FILE] - File property is set to [C:\Users\wmymt/logs/consolelogs/rocketmq-console.log] 08:51:57,876 |-INFO in ch.qos.logback.classic.joran.action.RootLoggerAction - Setting level of ROOT logger to INFO 08:51:57,876 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [STDOUT] to Logger[ROOT] 08:51:57,876 |-INFO in ch.qos.logback.core.joran.action.AppenderRefAction - Attaching appender named [FILE] to Logger[ROOT] 08:51:57,876 |-INFO in ch.qos.logback.classic.joran.action.ConfigurationAction - End of configuration. 08:51:57,877 |-INFO in ch.qos.logback.classic.joran.JoranConfigurator@6d21714c - Registering current configuration as safe fallback point
[2021-08-12 08:51:58.603] INFO Starting App v2.0.0 on gf-xxb-wum with PID 42868 (G:\迅雷下载\rocketmq-externals-master\rocketmq-console\target\rocketmq-console-ng-2.0.0.jar started by wmymt in G:\迅雷下载\rocketmq-externals-master\rocketmq-console\target) [2021-08-12 08:51:58.606] INFO No active profile set, falling back to default profiles: default [2021-08-12 08:51:59.976] INFO setNameSrvAddrByProperty nameSrvAddr=172.20.8.77:9876 [2021-08-12 08:52:01.327] INFO Tomcat initialized with port(s): 8080 (http) [2021-08-12 08:52:01.339] INFO Initializing ProtocolHandler ["http-nio-0.0.0.0-8080"] [2021-08-12 08:52:01.340] INFO Starting service [Tomcat] [2021-08-12 08:52:01.340] INFO Starting Servlet engine: [Apache Tomcat/9.0.29] [2021-08-12 08:52:01.553] INFO Initializing Spring embedded WebApplicationContext [2021-08-12 08:52:01.554] INFO Root WebApplicationContext: initialization completed in 2888 ms [2021-08-12 08:52:03.075] INFO Initializing ExecutorService 'applicationTaskExecutor' [2021-08-12 08:52:03.170] INFO Adding welcome page: class path resource [static/index.html] [2021-08-12 08:52:03.286] INFO Initializing ExecutorService 'taskScheduler' [2021-08-12 08:52:03.297] INFO Exposing 2 endpoint(s) beneath base path '/actuator' [2021-08-12 08:52:03.332] INFO Starting ProtocolHandler ["http-nio-0.0.0.0-8080"] [2021-08-12 08:52:03.370] INFO Tomcat started on port(s): 8080 (http) with context path '' [2021-08-12 08:52:03.373] INFO Started App in 5.395 seconds (JVM running for 7.388)