I am Ant carrying an elephant (Apache EventMesh PMC&Committer). If this article is helpful to you, give Rocketmq-rust a star, follow me on GitHub: mxsm, and if there are any inaccuracies, please correct them by creating an ISSUE or submitting a PR~ Thank you! Email: mxsm@apache.com
1. Overview of Rocketmq-rust Name Server
After more than a month of development, a Rust version of the RocketMQ name server component has finally been developed. This component is fully compatible with the RocketMQ Java version and provides the same functionality.
GitHub Project Link: Rocketmq-rust
The advantages of using Rust to develop the RocketMQ name server are as follows:
- Greatly reduced startup time compared to the Java version
It can be seen that the entire RocketMQ name server startup is completed in less than one second.
Cross-platform features (need to be compiled on different platforms)
Memory safety, due to the memory management characteristics of the Rust language
If you usually use RocketMQ and need to start the name server locally, you can consider using this Rust version, which is both convenient and fast. Download Link: rocketmq-rust-all-bin-0.1.0.zip
2. Quick Start with Rocketmq-rust Name Server
There are two ways to quickly use the RocketMQ name server:
- Download the precompiled program
- Install using the cargo command
- Compile using the source code
2.1 Downloading Binary Files
First, download the binary file rocketmq-rust-all-bin-0.1.0.zip from the GitHub release page.
After downloading, unzip the file. You will see two folders as shown below:
There are two folders for Windows and Linux platforms.
Mac version is not provided for now, but it will be provided in future versions.
Next, let's take Windows as an example (Linux users can also try it on their own). In the windows folder, there is an executable file named rocketmq-namesrv-rust.exe
, which is the startup file for the RocketMQ name server.
Double-click to start. As shown in the figure below:
You can view the usage by running the following command:
rocketmq-namesrv-rust.exe --help
RocketMQ Name server (Rust)
Usage: rocketmq-namesrv-rust.exe [OPTIONS]
Options:
-p, --port <PORT> RocketMQ name server port [default: 9876]
-i, --ip <IP> RocketMQ name server IP [default: 127.0.0.1]
-c, --config <FILE> RocketMQ name server config file
-h, --help Print help
-V, --version Print version
markdown
title: "Rocketmq-rust Name Server Implementation"
linkTitle: "Rocketmq-rust Name Server"
sidebar_label: "Rocketmq-rust Name Server"
weight: 202401282245
description: "Rust implementation of RocketMQ Name Server"
I am Ant carrying an elephant (Apache EventMesh PMC&Committer). If this article is helpful to you, give Rocketmq-rust a star, follow me on GitHub: mxsm, and if there are any inaccuracies, please correct them by creating an ISSUE or submitting a PR~ Thank you! Email: mxsm@apache.com
1. Overview of Rocketmq-rust Name Server
After more than a month of development, a Rust version of the RocketMQ name server component has finally been developed. This component is fully compatible with the RocketMQ Java version and provides the same functionality.
GitHub Project Link: Rocketmq-rust
The advantages of using Rust to develop the RocketMQ name server are as follows:
- Greatly reduced startup time compared to the Java version
It can be seen that the entire RocketMQ name server startup is completed in less than one second.
Cross-platform features (need to be compiled on different platforms)
Memory safety, due to the memory management characteristics of the Rust language
If you usually use RocketMQ and need to start the name server locally, you can consider using this Rust version, which is both convenient and fast. Download Link: rocketmq-rust-all-bin-0.1.0.zip
2. Quick Start with Rocketmq-rust Name Server
There are two ways to quickly use the RocketMQ name server:
- Download the precompiled program
- Install using the cargo command
- Compile using the source code
2.1 Downloading Binary Files
First, download the binary file rocketmq-rust-all-bin-0.1.0.zip from the GitHub release page.
After downloading, unzip the file. You will see two folders as shown below:
There are two folders for Windows and Linux platforms.
Mac version is not provided for now, but it will be provided in future versions.
Next, let's take Windows as an example (Linux users can also try it on their own). In the windows folder, there is an executable file named rocketmq-namesrv-rust.exe
, which is the startup file for the RocketMQ name server.
Double-click to start. As shown in the figure below:
You can view the usage by running the following command:
rocketmq-namesrv-rust.exe --help
RocketMQ Name server (Rust)
Usage: rocketmq-namesrv-rust.exe [OPTIONS]
Options:
-p, --port <PORT> RocketMQ name server port [default: 9876]
-i, --ip <IP> RocketMQ name server IP [default: 127.0.0.1]
-c, --config <FILE> RocketMQ name server config file
-h, --help Print help
-V
, --version Print version
Here, you can configure the IP address, port, and configuration file of the RocketMQ name server. Compared to the Java version, I have made some optimizations here.
2.2 Installation via Cargo Command
Install using the rust cargo command. Here is an example using Linux (WSL). Use the following command:
cargo install rocketmq-namesrv
Wait for it to be installed locally.
Then run the command to verify:
rocketmq-namesrv-rust
It can be seen that it runs successfully.
2.3 Compilation from Source Code
Compiling from source code is the same as installing via the cargo command. First, install rust, with a minimum version of 1.75.0. Then clone the source code of rocketmq-rust from GitHub to your local machine, and enter the root directory of the code. Run the following command:
cargo run --bin rocketmq-namesrv-rust
Then you can run the rocketmq name server.
3. Function Verification
How to verify the functionality? First, clone the code of rocketmq-dashboard locally, or if you have the corresponding one locally, you can also use it.
Verification is done using IDEA
1. Start the Rust version of the nameserver
2. Start the rocketmq-dashboard
It can be seen from the logs printed by the name server that it has been connected (at this point, the Broker has not been started yet). Log in to the web and find that there is no data.
3 Start Broker registration
The name server received the broker registration request. Next, let's take a look at the information on the web page.
The data has been registered. From here, we can see that the basic functions have been implemented.
4. Summary
The current rocketmq-rust project basically implements the function of a RocketMQ name server using Rust. There may be some bugs in the functionality, and further testing and fixes will be performed in subsequent versions. If you encounter any problems during use, you can raise an ISSUE. Meanwhile, if you are interested in Rust and RocketMQ, you are welcome to participate in the project.
Top comments (0)