Running RocketMQ on Mac M1 with Docker: A Complete Step‑by‑Step Guide
This article provides a detailed tutorial on installing and configuring RocketMQ on a Mac M1 using Docker, covering source‑code and Docker deployments, container setup, broker configuration, dashboard launch, message testing, and common troubleshooting tips.
Running RocketMQ on a Mac M1 can be challenging, especially when using Docker. This guide walks you through both source‑code and Docker approaches, ensuring the message queue starts correctly on macOS and Linux environments.
1. Running RocketMQ from Source
The author initially tried Docker but faced errors, then switched to building from source (version 4.9.2) available at https://github.com/apache/rocketmq . Detailed steps are referenced from a previous article.
2. Running RocketMQ with Docker
Three containers are required: a nameserver, a broker, and a dashboard. The images used are:
Nameserver: rocketmqinc/rocketmq Broker: dyrnq/rocketmq:4.8.0 Dashboard:
apacherocketmq/rocketmq-dashboard:latest2.1 Pull the RocketMQ image
docker pull rocketmqinc/rocketmq2.2 Start the nameserver
docker run -d -p 9876:9876 -v `pwd`/data/namesrv/logs:/root/logs -v `pwd`/data/namesrv/store:/root/store --name rmqnamesrv rocketmqinc/rocketmq sh mqnamesrv2.3 Start the broker
docker run -d -p 10911:10911 -p 10909:10909 -v `pwd`/data/broker/logs:/root/logs -v `pwd`/data/broker/store:/root/store --name rmqbrokerv2 --link rmqnamesrv:namesrv -e "NAMESRV_ADDR=namesrv:9876" dyrnq/rocketmq:4.8.0 sh mqbroker -c ../conf/broker.confEnter the broker container to edit broker.conf: docker exec -it b6b /bin/bash Install vim if missing:
apt-get update
apt-get install vimAdd the line brokerIP1=192.168.10.197 (replace with your host IP). Find your IP with: ifconfig | grep "inet" The final broker.conf is shown in the original article.
3. Launching the RocketMQ Dashboard
The original rocketmq-console-ng has been removed; use the new rocketmq-dashboard repository ( https://github.com/apache/rocketmq-dashboard ).
docker run -d --name rocketmq-dashboard -e "JAVA_OPTS=-Drocketmq.namesrv.addr=172.16.8.62:9876 -Drocketmq.config.isVIPChannel=false" -p 8080:8080 -t apacherocketmq/rocketmq-dashboard:latestAccess the dashboard at http://localhost:8080/. Ensure isVIPChannel=false to retrieve data.
4. Testing Message Sending
Use the dashboard to send a message to test_topic. After sending, the message appears in the Message list, confirming successful delivery.
5. Common Issues and Solutions
Broker cannot connect to NameServer
Update broker.conf with the correct external IP and start the broker with the -c ../conf/broker.conf flag.
Broker startup error
The error Cannot link to a non running container: /rmqnamesrv indicates the nameserver container failed to start; ensure the nameserver is running before launching the broker.
Java code snippet for configuration parsing
if (commandLine.hasOption('c')) {
String file = commandLine.getOptionValue('c');
if (file != null) {
configFile = file;
InputStream in = new BufferedInputStream(new FileInputStream(file));
properties = new Properties();
properties.load(in);
properties2SystemEnv(properties);
MixAll.properties2Object(properties, brokerConfig);
MixAll.properties2Object(properties, nettyServerConfig);
MixAll.properties2Object(properties, nettyClientConfig);
MixAll.properties2Object(properties, messageStoreConfig);
BrokerPathConfigHelper.setBrokerConfigPath(file);
in.close();
}
}Following these steps should allow you to run RocketMQ smoothly on a Mac M1 using Docker.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
IT Services Circle
Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
