rocketmq linux 安装
时间: 2024-12-27 11:24:12 浏览: 21
### RocketMQ Installation Guide for Linux
#### Prerequisites
Before installing RocketMQ on a Linux system, ensure that the following prerequisites are met:
- Java Development Kit (JDK) version 8 or higher is installed.
- A stable internet connection.
To verify JDK installation, execute:
```bash
java -version
```
If not already present, install OpenJDK using package managers like `yum` or `apt-get`.
For CentOS/RHEL/Fedora systems:
```bash
sudo yum install java-1.8.0-openjdk-devel
```
For Debian/Ubuntu systems:
```bash
sudo apt update && sudo apt install openjdk-8-jdk-headless
```
#### Downloading RocketMQ
Download the latest release of Apache RocketMQ from the official website or via command line tools such as wget or curl. For instance,
```bash
wget http://mirrors.estointernet.in/apache/rocketmq/4.9.3/rocketmq-all-4.9.3-bin-release.zip
unzip rocketmq-all-4.9.3-bin-release.zip -d /opt/
cd /opt/rocketmq
```
Ensure directory permissions allow execution rights where necessary.
#### Configuring Environment Variables
Add environment variables to simplify starting services later on. Edit `/etc/profile`, adding lines at the end:
```bash
export ROCKETMQ_HOME=/opt/rocketmq
export PATH=$ROCKETMQ_HOME/bin:$PATH
```
Apply changes immediately without logging out/in again with source command:
```bash
source /etc/profile
```
#### Starting Name Server and Broker Service
Start the nameserver first since brokers need it running before they can start successfully:
```bash
nohup sh bin/mqnamesrv &
```
Check its status afterward:
```bash
tail -f ~/logs/rocketmq/namesrv.log
```
Once confirmed operational, proceed to launch broker service similarly but specify name server address explicitly through configuration file (`conf/broker.conf`) under property `namesrvAddr`. Then run:
```bash
nohup sh bin/mqbroker -n localhost:9876 autoCreateTopicEnable=true &
```
Verify operation by checking logs located typically within user home folder inside path similar to this one mentioned above regarding nameservers'.
#### Testing Setup
After both components have started properly, test setup completeness utilizing provided scripts found in `$ROCKETMQ_HOME/tools` subdirectory which includes examples demonstrating how messages could be sent/received between producers/consumers over topics created earlier during broker initialization phase when enabling automatic topic creation feature was set true previously while configuring broker properties.
--related questions--
1. What versions of JDK support RocketMQ?
2. How does one configure multiple instances of RocketMQ Brokers?
3. Can you explain more about message persistence options available in RocketMQ configurations?
阅读全文
相关推荐
















