搭建 Apache RocketMQ 单机环境
2021-03-01 08:25
阅读:558
环境需求:
64位操作系统,建议使用Linux / Unix /
-
CentOs7.3
-
64bit JDK 1.8+
-
Maven 3.2.x
一、安装Maven
安装过程请查看:https://blog.51cto.com/qiangsh/1771831
二、安装RocketMQ
1、关闭防火墙
systemctl stop firewalld.service
2、下载和构建
wget http://mirrors.hust.edu.cn/apache/rocketmq/4.2.0/rocketmq-all-4.2.0-source-release.zip
unzip rocketmq-all-4.2.0-source-release.zip
cd rocketmq-all-4.2.0
mvn -Prelease-all -DskipTests clean install -U
mv distribution/target/apache-rocketmq /usr/local/rocketmq
cd /usr/local/rocketmq/
编译成功的响应
3、配置rocketmq的环境变量,在/etc/profile最后添加
export ROCKETMQ_HOME=/usr/local/rocketmq
export PATH=$JAVA_HOME/bin:$ROCKETMQ_HOME/bin:$PATH
4、使rocketmq的环境变量生效
source /etc/profile
5、给下列命令可执行权限
cd /usr/local/rocketmq/bin/
chmod +x mqadmin mqbroker mqfiltersrv mqshutdown mqnamesrv
三、启动Name Server
1、修改runserver,默认 RocketMQ Server 内存需要很大的
vim bin/runserver.sh
--------------------------------------------------------------
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
2、启动 Name Server
mkdir /usr/local/rocketmq/log
nohup mqnamesrv >/usr/local/rocketmq/log/nameserver.log 2>&1 &
tail -10f /usr/local/rocketmq/log/nameserver.log
启动成功信息如下
The Name Server boot success. serializeType=JSON
四、启动broker
1、修改runbroker,默认 RocketMQ Broker 内存需要很大的。
vim bin/runbroker.sh
--------------------------------------------------------------
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m"
2、启动Broker
nohup mqbroker -n "127.0.0.1:9876" >/usr/local/rocketmq/log/mq.log 2>&1 &
tail -10f /usr/local/rocketmq/log/mq.log
启动成功信息如下
2018-10-30 15:26:06 INFO main - Set user specified name server address: 172.17.17.1:9876
2018-10-30 15:26:06 INFO PullRequestHoldService - PullRequestHoldService service started
2018-10-30 15:26:06 INFO main - register broker to name server 172.17.17.1:9876 OK
2018-10-30 15:26:06 INFO main - The broker[env1, 172.17.17.1:10911] boot success. serializeType=JSON and name server is 172.17.17.1:9876
五、查看进程
[root@env1 apache-rocketmq]# jps
2374 BrokerStartup
2350 NamesrvStartup
[root@env1 apache-rocketmq]# netstat -ntlpActive Internet connections (only servers)Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1508/master
tcp6 0 0 :::9876 :::* LISTEN 2350/java
tcp6 0 0 ::1:25 :::* LISTEN 1508/master
tcp6 0 0 :::10909 :::* LISTEN 2374/java
tcp6 0 0 :::10911 :::* LISTEN 2374/java
tcp6 0 0 :::10912 :::* LISTEN 2374/java
[root@node1 apache-rocketmq]#
六、关闭服务
#关闭nameserver
mqshutdown namesrv
#关闭broker
mqshutdown broker
上一篇:Aspose.Words
下一篇:php几种设计模式
评论
亲,登录后才可以留言!