zookeeper一定要提前启动
顺序启动activemq
[root@zk01 bin]# /opt/activemq01/bin/activemq start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)
INFO: Invoke the following command to create a configuration file
/opt/activemq01/bin/activemq setup [ /etc/default/activemq | /root/.activemqrc ]
INFO: Using java '/opt/jdk/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/opt/activemq01/data/activemq-zk01.pid' (pid '4541')
[root@zk02 conf]# /opt/activemq02/bin/activemq start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)
INFO: Invoke the following command to create a configuration file
/opt/activemq02/bin/activemq setup [ /etc/default/activemq | /root/.activemqrc ]
INFO: Using java '/opt/jdk/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/opt/activemq02/data/activemq-zk02.pid' (pid '4492')
[root@zk02 conf]#
[root@zk03 conf]# /opt/activemq03/bin/activemq start
INFO: Using default configuration
(you can configure options in one of these file: /etc/default/activemq /root/.activemqrc)
INFO: Invoke the following command to create a configuration file
/opt/activemq03/bin/activemq setup [ /etc/default/activemq | /root/.activemqrc ]
INFO: Using java '/opt/jdk/bin/java'
INFO: Starting - inspect logfiles specified in logging.properties and log4j.properties to get details
INFO: pidfile created : '/opt/activemq03/data/activemq-zk03.pid' (pid '2296') 7.查看分片以及zookeeper的信息
登录任意一台zookeeper就行
[root@zk02 bin]# pwd
/opt/zk02/bin
[root@zk02 bin]# ./zkCli.sh -server 192.168.56.16:2181
[zk: 192.168.56.16:2181(CONNECTED) 0] ls /
[activemq, dubbo, zookeeper]
[zk: 192.168.56.16:2181(CONNECTED) 1] ls /activemq
[leveldb-stores]
[zk: 192.168.56.16:2181(CONNECTED) 2] ls /activemq/leveldb-stores
[00000000002, 00000000001, 00000000000]
[zk: 192.168.56.16:2181(CONNECTED) 3]
elected值不为空的是消息activemq的master节点
[zk: 192.168.56.16:2181(CONNECTED) 3] get /activemq/leveldb-stores/00000000002
{"id":"dubboedu","container":null,"address":null,"position":-1,"weight":1,"elected":null}
cZxid = 0x400000012
ctime = Sat Dec 31 19:33:44 CST 2016
mZxid = 0x400000012
mtime = Sat Dec 31 19:33:44 CST 2016
pZxid = 0x400000012
cversion = 0
dataVersion = 0
aclVersion = 0
ephemeralOwner = 0x259544b516a0000
dataLength = 89
numChildren = 0
[zk: 192.168.56.16:2181(CONNECTED) 4] get /activemq/leveldb-stores/00000000001
{"id":"dubboedu","container":null,"address":null,"position":-1,"weight":1,"elected":null}
cZxid = 0x400000008
ctime = Sat Dec 31 19:33:16 CST 2016
mZxid = 0x400000015
mtime = Sat Dec 31 19:33:45 CST 2016
pZxid = 0x400000008
cversion = 0
dataVersion = 8
aclVersion = 0
ephemeralOwner = 0x359544bcfbb0001
dataLength = 89
numChildren = 0
[zk: 192.168.56.16:2181(CONNECTED) 5] get /activemq/leveldb-stores/00000000000
{"id":"dubboedu","container":null,"address":"tcp://zk01:62621","position":-1,"weight":1,"elected":"0000000000"}
cZxid = 0x400000005
ctime = Sat Dec 31 19:32:51 CST 2016
mZxid = 0x40000000d
mtime = Sat Dec 31 19:33:17 CST 2016
pZxid = 0x400000005
cversion = 0
dataVersion = 4
aclVersion = 0
ephemeralOwner = 0x359544bcfbb0000
dataLength = 111
numChildren = 0
[zk: 192.168.56.16:2181(CONNECTED) 6] 8 测试高可用activemq