1、在idea利用maven工具导入所有的依赖包,失败的话多重复几次就行了
2、在rocketmq代码代码根目录下新建三个目录conf/log/storedata,作用分别是放置配置文件、日志文件和消息相关的存储文件
将./distribution/conf 目录下的broker.conf、logback_broker.xml、logback_namesrv.xml复制到新建的conf目录下,并分别对其进行修改
修改后的broker.conf 文件:
brokerClusterName = DefaultCluster
brokerName = broker-a
brokerId = 0
deleteWhen = 04
fileReservedTime = 48
brokerRole = ASYNC_MASTER
flushDiskType = ASYNC_FLUSH
# brokerIP1,在云服务器上会获取内网ip地址,因此必须显式设置
brokerIP1=localhost
# 将namesrvAddr设置在configfile中
namesrvAddr=localhost:9876
#http 静态服务器寻址:会有个默认设置,但可能访问不了,所以需要设置成本机了
rmqAddressServerDomain=localhost
rmqAddressServerSubGroup=nameServer
#存储路径
storePathRootDir=D:\Users\10256137\Download\github\rocketmq-rocketmq-all-4.8.0\storedata
#commitLog存储路径
storePathCommitLog=D:\Users\10256137\Download\github\rocketmq-rocketmq-all-4.8.0\storedata\commitlog
#消费队列存储路径
storePathConsumeQueue=D:\Users\10256137\Download\github\rocketmq-rocketmq-all-4.8.0\storedata\consumequeue
#消息索引存储路径
storePathIndex=D:\Users\10256137\Download\github\rocketmq-rocketmq-all-4.8.0\storedata\index
#checkpoint 文件存储路径
storeCheckpoint=D:\Users\10256137\Download\github\rocketmq-rocketmq-all-4.8.0\storedata\checkpoint
#abort 文件存储路径
abortFile=D:\Users\10256137\Download\github\rocketmq-rocketmq-all-4.8.0\storedata\abort
修改logback_broker.xml、logback_namesrv.xml中的日志路径
3、依次配置namesrv模块的NamesrvStartup、broker模块下的BrokerStartup、example.quickstart模块下的Producer和Consumer的启动项,并启动
NamesrvStartup和BrokerStartup 都需要配置ROCKETMQ_HOME
Producer和Consumer使用默认配置就可以,但需要修改代码文件中的main函数,