rocketmq linux 部署

1、准备linux 64位jdk1.7及以上版本(如果是在ubuntu虚拟机上部署,可能需要卸载原有jdk,可以参考http://blog.csdn.net/a77nian/article/details/52280951)。


2、下载apache rocketmq,下载地址:https://www.apache.org/dyn/closer.cgi?path=incubator/rocketmq/4.0.0-incubating/rocketmq-all-4.0.0-incubating-bin-release.zip。


3、写入环境变量
     ①、执行vim /etc/profile ,插入jdk与rocketmq的环境变量:    

export JAVA_HOME=/usr/local/jdk
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$JAVA_HOME/bin:$PATH
export ROCKETMQ_HOME=/usr/local/rocketmq
export PATH=$ROCKETMQ_HOME/bin:$PATH 


    ②、执行 . /etc/profile(注意:点与斜杠之间有一个空格;另外jdk的环境变量生效,需要重新登陆ssh)。


4、修改/usr/local/rocketmq/conf/2m-noslave/broker-a.properties 
brokerClusterName=DefaultCluster
brokerName=broker-a
brokerId=0
namesrvAddr=127.0.0.1:9876;192.168.189.130:9876
deleteWhen=04
fileReservedTime=48
brokerRole=ASYNC_MASTER
flushDiskType=ASYNC_FLUSH
autoCreateTopicEnable=true
storePathRootDir=/data/rocketmq/store
storePathCommitLog=/data/rocketmq/store/commitlog

5、如果机器内存不够,可修改/usr/local/rocketmq/bin/runserver.sh 与 /usr/local/rocketmq/bin/runbroker.sh中JAVA_OPT关于内存的设置。
JAVA_OPT="${JAVA_OPT} -server -Xms512m -Xmx512m -Xmn256m -XX:PermSize=128m -XX:MaxPermSize=320m"

6、运行namesrv(需在$ROCKETMQ_HOME/bin下执行)
nohup sh mqnamesrv &

7、运行brokersrv(需在$ROCKETMQ_HOME/bin下执行)
nohup sh mqbroker -c /usr/local/rocketmq/conf/2m-noslave/broker-a.properties >/usr/local/rocketmq/broker.log 2>&1 &

8、关闭命令
sh mqshutdown namesrv  
sh mqshutdown broker

9、查询和添加topic
mqadmin topicList -n 192.168.73.129:9876
mqadmin updateTopic -n 192.168.73.129:9876 -t TopicTest1 -c DefaultCluster -b192.168.73.129:10911

java调用demo后续再补充......

你可能感兴趣的:(rocketmq,rocketmq部署,rocketmq)