ACTIVEMQ ZOOKEEPER安装标准文档
1. 安装环境
ACTIVEMQ: 5.9.1
ZOOKEEPER 3.4.5
LEVELDB 1.15.0
JDK: 1.6.0_27
2. Sun JDK安装
参考 http://wiki.tomshopping.com/pages/viewpage.action?pageId=14288188
3. ACTIVEMQ安装
mkdir -p /data/postmall/activemq/data &&chown -R web.users /data/postmall/activemq/data
mkdir -p /data/logs/activemq&&chown -R web.users /data/logs/activemq
3.1. 下载并安装activemq
# cd /data/postmall/steve
# wget http://archive.apache.org/dist/activemq/5.9.1/apache-activemq-5.9.1-bin.tar.gz
# tar zxvf apache-activemq-5.9.1-bin.tar.gz
# cd /usr/local
# cp -r /data/postmall/steve/apache-activemq-5.9.1activemq
# chown -R web.users /usr/local/activemq
3.2. 配置activemq
目前邮乐平台采用的activemq,均使用levelDB连接方式
# vi /usr/local/activemq/conf/activemq.xml
找到
注释掉kahadb这段,如下:
添加
directory="/usr/local/leveldb"
replicas="5"
zkAddress="192.168.112.58:2181,192.168.112.39:2181,192.168.112.153:2181,192.168.112.27:2181,192.168.112.63:2181"
zkPassword="password"
sync="local_disk"
zkPath="/home/activemq/leveldb-stores"
hostname="192.168.112.63"
/>
如有必要,修改activemq启动监听端口
修改日志位置
vi /usr/local/activemq/conf/log4j.properties
文件所有${activemq.base}改为 /data/logs/activemq
4. ZOOKEEPER安装
mkdir -p /data/postmall/zookeeper/data &&chown -R web.users /data/postmall/zookeeper/data
mkdir -p /data/logs/zookeeper&&chown -R web.users /data/logs/zookeeper
4.1. 下载并安装ZOOKEEPER
# cd /data/postmall/steve
# wget https://archive.apache.org/dist/zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz
# tar zxvfzookeeper-3.4.5.tar.gz
# cd /usr/local
# cp -r /data/postmall/steve/zookeeper-3.4.5zookeeper
# chown -R web.users /usr/local/zookeeper
4.2. 配置zookeeper
# cp /usr/local/zookeeper/conf/zoo_sample.cfg /usr/local/zookeeper/conf/zoo.cfg
# vi /usr/local/zookeeper/conf/zoo.cfg
修改dataDir= /usr/local/zookeeper/data
添加继续节点,例如:
Server.X=IP:2888:3888
server.1=192.168.112.58:2888:3888
server.2=192.168.112.39:2888:3888
server.3=192.168.112.153:2888:3888
server.4=192.168.112.63:2888:3888
server.5=192.168.112.27:2888:3888
新建一个文件myid在/usr/local/zookeeper/data/ 下
内容上面的Server.X=IP:2888:3888中的X
例如:server.3=192.168.112.153:2888:3888
内容为 3
保存推出
4.3. 修改日志位置
vi /usr/local/zookeeper/conf/log4j.properties
文件所有zookeeper.log.dir=.改为zookeeper.log.dir=/data/logs/zookeeper/
文件所有zookeeper.tracelog.dir=.改为zookeeper.tracelog.dir==/data/logs/zookeeper/
5. LEVELDB安装
5.1. 下载并安装LEVELDB
# cd /data/postmall/steve
# wget https://leveldb.googlecode.com/files/leveldb-1.15.0.tar.gz
# tar zxvfleveldb-1.15.0.tar.gz
# cd /usr/local
# cp -r /data/postmall/steve/leveldb-1.15.0.tar.gzleveldb
# chown -R web.users /usr/local/leveldb
# cd/usr/local/leveldb
# make
6. 检查启动状态
启动 zookeeper activemq
# /usr/local/zookeeper/bin/zkServer.sh start
# /usr/local/activemq/bin/activemq start
查看zoookeractivemq是否启动正常
# /usr/local/zookeeper/bin/zkServer.sh status
出现
Using config: /home/activemq/zookeeper/zookeeper-3.4.5/bin/../conf/zoo.cfg
Mode: follower/leader
表示 zookeeper 启动成功
# /usr/local/activemq/bin/activemqstatus
出现ActiveMQ is running 表示已启动