Miss Liu source course notes

Download the source code

Source address github.com/apache/rock…

Fork the source code, just the latest one, clone it locally, and let it go.

Configuration items

Adjust the idea

Change the compile level of the project to 11, or it will not compile and will not start

Configure the conf

Create a conf directory in the project path and copy the broker.conf,logback_broker.xml, and logback_namesrv. XML files from the conf directory in the Distribution module to the conf directory.

Modify the broker. Conf

brokerClusterName = DefaultCluster brokerName = broker-a brokerId = 0 deleteWhen = 04 fileReservedTime = 48 brokerRole = ASYNC_MASTER flushDiskType = ASYNC_FLUSH ############## These are new #D: OneDrive study sourceCode Java RocketMq data. This directory is used to store messages and can be customized. # nameServer address. NamesrvAddr =127.0.0.1:9876 # Storage path storePathRootDir=D:\OneDrive\study\sourceCode\ Java \ RocketMQ \data #commitLog Storage path StorePathCommitLog =D:\OneDrive\study\sourceCode\ Java \ RocketMQ \data\commitlog # Storage path of the consumption queue StorePathConsumeQueue =D:\OneDrive\study\sourceCode\ Java \ RocketMQ \data\ consumeQueue # Message index storage path StorePathIndex =D:\OneDrive\study\sourceCode\ Java \ Rocketmq \data\index #checkpoint file storage path StoreCheckpoint =D: OneDrive\study\sourceCode\ Java \ RocketMQ \data\checkpoint #abort File storage path abortFile=D:\OneDrive\study\sourceCode\java\rocketmq\data\abortCopy the code

Modify logback_broker. XML, logback_namesrv. XML

Change ${user.home} to a path like D: OneDrive study sourceCode Java Rocketmq. If you don’t, you’ll look in the environment variables. Writing to drive C will take up your hard drive.

Start the project

Start the nameserver

The first startup will fail and you need to add an env argument. ROCKETMQ_HOME corresponds to your project path

That’s what startup success looks like

Start the broker

You also need to add an env argument. ROCKETMQ_HOME corresponds to your project path. Conf file -c D:\OneDrive\study\sourceCode\ Java \ Rocketmq \conf\broker.conf

Start-up success

Test project

Under the example module org. Apache. Rocketmq. Example. Quickstart producer and consumer example, you can start to try. You need to add the address of nameserver. The ability to produce and consume messages indicates that the environment is successful.