安装配置.md

Catalogue
  1. 1. 安装配置
  2. 2. RocketMQ install
    1. 2.1. Require
    2. 2.2. 1、Download
    3. 2.3. 2、配置环境
      1. 2.3.1. 2.1 Maven
      2. 2.3.2. 2.2 替换文件
      3. 2.3.3. 2.3 下载操作脚本
    4. 2.4. 3 启动测试
      1. 2.4.1. 3.1 修改脚本内容
      2. 2.4.2. 3.2 测试服务是否运行正常

安装配置

RocketMQ install

Require

  1. 64bit OS, Linux/Unix/Mac is recommended;
  2. (Windows user see guide below)64bit JDK 1.8+;
  3. Maven 3.2.x;
  4. Git;
  5. 4g+ free disk for Broker server

1、Download

采用编译完好的二进制文件

登录RocketMQ官网,选择download a binary release here,从指定位置下载编译好的二进制Rocketmq

2、配置环境

2.1 Maven

安装Maven

1
sudo apt-get install maven

更换国内源

1
2
cp /usr/share/maven/conf/settings.xml /usr/share/maven/conf/settings.xml.backup
gedit /usr/share/maven/conf/settings.xml

备份后,替换内容如下

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?xml version="1.0" encoding="UTF-8"?>

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">

   <pluginGroups>
   </pluginGroups>

   <proxies>
   </proxies>

   <servers>
   </servers>

   <mirrors>
       <mirror>
           <id>nexus-aliyun</id>
           <mirrorOf>central</mirrorOf>
           <name>Nexus aliyun</name>
           <url>http://maven.aliyun.com/nexus/content/groups/public</url>
       </mirror>
   </mirrors>

   <profiles>
       <profile>
           <id>aliyun</id>
           <!-- repositories and pluginRepositories here-->
           <repositories>
               <repository>
                   <id>nexus-aliyun</id>
                   <name>Nexus aliyun</name>
                   <url>http://maven.aliyun.com/nexus/content/groups/public</url>
                   <releases>
                       <enabled>true</enabled>
                   </releases>
                   <snapshots>
                       <enabled>true</enabled>
                   </snapshots>
               </repository>
           </repositories>
       </profile>
   </profiles>

   <activeProfiles>
       <activeProfile>aliyun</activeProfile>
   </activeProfiles>
</settings>

2.2 替换文件

使用解压后的内容替换RocketMQ/bin文件

bin.zip

2.3 下载操作脚本

RocketMQ.zip

3 启动测试

3.1 修改脚本内容

修改启动脚本StartRocketMQ,sh 中路径,如果未安装可视化客户端需要注释后三行内容。5000表示RocketMQ所使用的端口号,可以根据需要进行修改。

StartRocketMQ.sh

1
2
3
4
5
6
7
8
9
10
#!/bin/bash
#修改为安装路径
cd /home/lightning/Aplications/RocketMQ
#修改为启动脚本所在路径
nohup sh bin/mqnamesrv -c /home/lightning/桌面/RocketMQ/mqnamesrv.properties > /dev/null
2> /dev/null &
nohup sh bin/mqbroker -n localhost:5000 > /dev/null 2> /dev/null &
#export NAMESRV_ADDR=localhost:5000
#cd Tools
#nohup java -jar rocketmq-console-ng-2.0.0.jar --server.port=5002 > /usr/local/bin/RocketMQ/Tools/console.log.txt &

ShutdownRocketMQ.sh

1
2
3
4
5
6
#!/bin/bash

#修改路径为安装目录
cd /home/lightning/Aplications/RocketMQ
bin/mqshutdown broker
bin/mqshutdown namesrv

3.2 测试服务是否运行正常

修改完成后在脚本目录下打开命令行

1
2
./StartRocketMQ.sh
sudo netstat -ap | grep 5000

若返回端口为5000当前的服务,说明运行正常