rocketmq源码调试-图文详细 想看rocketmq源码?不知道怎么断点调试?这篇图文详细描述整个调试过程。尽情享受驾驭源码的乐趣吧。
idea拉取rocketmq代码 1 git clone https://gitee.com/apache/rocketmq.git
设置路径
切换分支
刷新项目
配置目录 在根目录下设置config目录
分别配置conf、logs、store目录
拷贝distribution下的三个文件
到conf目录下
修改broker.conf如下 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance with # the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH #nameserver的地址,也可以指定真实ip namesrvAddr=127.0.0.1:9876 #brokerIp,也可以指定真实ip brokerIP1=127.0.0.1 #消息存储根路径 storePathRootDir=C:/Users/27338/IdeaProjects/rocketmq/config/store #commitLog文件的存储路径 storePathCommitLog=C:/Users/27338/IdeaProjects/rocketmq/config/store/commitlog #consume queue文件的存储路径 storePathConsumeQueue=C:/Users/27338/IdeaProjects/rocketmq/config/store/consumequeue #消息索引文件的存储路径 storePathIndex=C:/Users/27338/IdeaProjects/rocketmq/config/store/index #checkpoint文件的存储路径 storeCheckpoint=C:/Users/27338/IdeaProjects/rocketmq/config/store/checkpoint #abort文件的存储路径 abortFile=C:/Users/27338/IdeaProjects/rocketmq/config/store/abort
修改日志文件的配置 1、将logback_namesrv.xml和logback_broker.xml配置文件中的所有${user.home}都替换为自己的ROCKETMQ_HOME的目录,例如
{user.home}/logs/rocketmqlogs/namesrv_default.log,我会替换为C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/namesrv_default.log;
2、将所有的${brokerLogDir}都替换为broker
logback_namesrv.xml参考文件如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <configuration> <appender name="DefaultAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/namesrv_default.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/namesrv_default.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>5</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqNamesrvAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/namesrv.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/namesrv.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>5</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqNamesrvAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqNamesrvAppender_inner"/> <discardingThreshold>0</discardingThreshold> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <append>true</append> <encoder> <pattern>%d{yyy-MM-dd HH\:mm\:ss,SSS} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <logger name="RocketmqNamesrv" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqNamesrvAppender"/> </logger> <logger name="RocketmqCommon" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqNamesrvAppender"/> </logger> <logger name="RocketmqRemoting" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqNamesrvAppender"/> </logger> <logger name="RocketmqNamesrvConsole" additivity="false"> <level value="INFO"/> <appender-ref ref="STDOUT"/> </logger> <root> <level value="INFO"/> <appender-ref ref="DefaultAppender"/> </root> </configuration>
logback_broker.xml参考文件如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 <?xml version="1.0" encoding="UTF-8"?> <!-- Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <configuration> <appender name="DefaultAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/broker_default.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/broker_default.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqBrokerAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/broker.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/broker.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>20</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>128MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqBrokerAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqBrokerAppender_inner"/> </appender> <appender name="RocketmqProtectionAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/protection.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/protection.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqProtectionAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqProtectionAppender_inner"/> </appender> <appender name="RocketmqWaterMarkAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/watermark.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/watermark.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqWaterMarkAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqWaterMarkAppender_inner"/> </appender> <appender name="RocketmqStoreAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/store.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/store.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>128MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqStoreAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqStoreAppender_inner"/> </appender> <appender name="RocketmqRemotingAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/remoting.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/remoting.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqRemotingAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqRemotingAppender_inner"/> </appender> <appender name="RocketmqStoreErrorAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/storeerror.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/storeerror.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqStoreErrorAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqStoreErrorAppender_inner"/> </appender> <appender name="RocketmqTransactionAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/transaction.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/transaction.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqTransactionAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqTransactionAppender_inner"/> </appender> <appender name="RocketmqRebalanceLockAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/lock.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/lock.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>5</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqRebalanceLockAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqRebalanceLockAppender_inner"/> </appender> <appender name="RocketmqFilterAppender_inner" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/filter.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/filter.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqFilterAppender" class="ch.qos.logback.classic.AsyncAppender"> <appender-ref ref="RocketmqFilterAppender_inner"/> </appender> <appender name="RocketmqStatsAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/stats.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/stats.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>5</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>100MB</maxFileSize> </triggeringPolicy> <encoder> <pattern>%d{yyy-MM-dd HH:mm:ss,GMT+8} %p - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <appender name="RocketmqCommercialAppender" class="ch.qos.logback.core.rolling.RollingFileAppender"> <file>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/broker/commercial.log</file> <append>true</append> <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy"> <fileNamePattern>C:/Users/27338/IdeaProjects/rocketmq/config/logs/rocketmqlogs/otherdays/broker/commercial.%i.log.gz</fileNamePattern> <minIndex>1</minIndex> <maxIndex>10</maxIndex> </rollingPolicy> <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy"> <maxFileSize>500MB</maxFileSize> </triggeringPolicy> </appender> <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender"> <append>true</append> <encoder> <pattern>%d{yyy-MM-dd HH\:mm\:ss,GMT+8} %p %t - %m%n</pattern> <charset class="java.nio.charset.Charset">UTF-8</charset> </encoder> </appender> <logger name="RocketmqBroker" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqBrokerAppender"/> </logger> <logger name="RocketmqProtection" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqProtectionAppender"/> </logger> <logger name="RocketmqWaterMark" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqWaterMarkAppender"/> </logger> <logger name="RocketmqCommon" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqBrokerAppender"/> </logger> <logger name="RocketmqStore" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqStoreAppender"/> </logger> <logger name="RocketmqStoreError" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqStoreErrorAppender"/> </logger> <logger name="RocketmqTransaction" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqTransactionAppender"/> </logger> <logger name="RocketmqRebalanceLock" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqRebalanceLockAppender"/> </logger> <logger name="RocketmqRemoting" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqRemotingAppender"/> </logger> <logger name="RocketmqStats" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqStatsAppender"/> </logger> <logger name="RocketmqCommercial" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqCommercialAppender"/> </logger> <logger name="RocketmqFilter" additivity="false"> <level value="INFO"/> <appender-ref ref="RocketmqFilterAppender"/> </logger> <logger name="RocketmqConsole" additivity="false"> <level value="INFO"/> <appender-ref ref="STDOUT"/> </logger> <root> <level value="INFO"/> <appender-ref ref="DefaultAppender"/> </root> </configuration>
启动namesrv 找到namesrv启动类
尝试启动
提示报错
编辑配置
添加如下环境变量 1 ROCKETMQ_HOME=C:/Users/27338/IdeaProjects/rocketmq/config
再次启动,可以看到启动成功
启动broker 同样设置环境变量
1 ROCKETMQ_HOME=C:/Users/27338/IdeaProjects/rocketmq/config
多了一个参数配置
1 -c C:/Users/27338/IdeaProjects/rocketmq/config/conf/broker.conf
找到启动类,启动
看到启动成功
也可以从启动日志中看
启动rocketmq-dashboard idea同样拉取rocketmq-dashboard代码 1 git clone https://github.com/apache/rocketmq-dashboard.git
修改application.yml配置文件中的namesrvAddrs配置,改为本地namesrv地址:
启动
看到启动成功
浏览器访问 输入localhost:8080
测试 找到测试代码,修改生产者配置,启动
可以看到消息发送成功
尝试消费
消费成功
控制台可以看到消费情况