zookeeper activemq 搭建

ACTIVEMQ   ZOOKEEPER安裝標準文檔web

 

1.   安裝環境apache

ACTIVEMQ:        5.9.1tcp

ZOOKEEPER        3.4.5ide

LEVELDB             1.15.0post

JDK:                     1.6.0_27google

 2.  Sun JDK安裝

參考 http://wiki.tomshopping.com/pages/viewpage.action?pageId=14288188spa

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/activemqcode

3.1.   下載並安裝activemqserver

# 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

找到

<persistenceAdapter>

<kahaDB directory="${activemq.data}/kahadb"/>

</persistenceAdapter>

註釋掉kahadb這段,以下:

<!--
<kahaDB directory="${activemq.base}/data/kahadb"/>

-->

添加

<replicatedLevelDB

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啓動監聽端口

<transportConnectors>
<transportConnector name="openwire" uri="tcp://0.0.0.0:61616"/>
</transportConnectors>

修改日誌位置

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 表示已啓動

相關文章
相關標籤/搜索