zookeeper与metaq集群


/backall/apache/zookeeper-3.4.6.tar.gz
/backall/apache/metaq-server-1.4.6.2.tar.gz

[root@c11-metaq-n01 local]# cat /etc/hosts
10.10.12.203  c11-metaq-n01
10.10.12.204  c11-metaq-n02
10.10.12.205  c11-metaq-n03

mkdir -p /usr/local/metaqCluster
mkdir -p /usr/local/zookeeperCluster
jdk 1.7 64bit : /usr/local/jdk

#############################################################################################################
#############################################################################################################
#############################################################################################################

cd /usr/local/metaqCluster
tar xzvf /backall/apache/zookeeper-3.4.6.tar.gz
[root@c11-metaq-n01 local]# vi zookeeperCluster/zookeeper-2181/conf/zoo.cfg
# The number of milliseconds of each tick
tickTime=2000
# The number of ticks that the initial
# synchronization phase can take
initLimit=10
# The number of ticks that can pass between
# sending a request and getting an acknowledgement
syncLimit=5
# the directory where the snapshot is stored.
# do not use /tmp for storage, /tmp here is just
# example sakes.
dataDir=/usr/local/zookeeperCluster/zookeeper-2181/dataDir
# the port at which the clients will connect
clientPort=2181
# the maximum number of client connections.
# increase this if you need to handle more clients
#maxClientCnxns=60
#
# Be sure to read the maintenance section of the
# administrator guide before turning on autopurge.
#
# http://zookeeper.apache.org/doc/current/zookeeperAdmin.html#sc_maintenance
#
# The number of snapshots to retain in dataDir
#autopurge.snapRetainCount=3
# Purge task interval in hours
# Set to "0" to disable auto purge feature
#autopurge.purgeInterval=1
server.1=c11-metaq-n01:2888:3888
server.2=c11-metaq-n02:2888:3888
server.3=c11-metaq-n03:2888:3888

修改zookeeper服务的myid标签为1
[root@c11-metaq-n01 local]# vi /usr/local/zookeeperCluster/zookeeper-2181/dataDir/myid
1

添加JDK配置:
[root@c11-metaq-n01 local]# vi zookeeperCluster/zookeeper-2181/bin/zkEnv.sh
JAVA_HOME=/usr/local/jdk


#############################################################################################################
#############################################################################################################
#############################################################################################################


cd /usr/local/zookeeperCluster
tar xzvf /backall/apache/metaq-server-1.4.6.2.tar.gz

配置brokerId、端口、zookeeper和topic信息:
[root@c11-metaq-n01 local]# vi ./metaqCluster/taobao-8123/metamorphosis-server-wrapper/conf/server.ini
[system]
brokerId=0
numPartitions=10
serverPort=8123
dataPath=/usr/local/metaqCluster/taobao-8123/data
dashboardHttpPort=8120
unflushThreshold=0
unflushInterval=10000
maxSegmentSize=1073741824
maxTransferSize=1048576
deletePolicy=delete,168
deleteWhen=0 0 3 * * ?
flushTxLogAtCommit=1
stat=true

;; Update consumers offsets to current max offsets when consumers offsets are out of range of current broker‘s messages.
;; It must be false in production.But recommend to be true in development or test.
updateConsumerOffsets=true

[zookeeper]
zk.zkConnect=10.10.12.203:2181,10.10.12.204:2181,10.10.12.205:2181
#zk.zkConnect=10.10.12.203:2181
zk.zkSessionTimeoutMs=30000
zk.zkConnectionTimeoutMs=30000
zk.zkSyncTimeMs=5000

;; Topics section
[topic=test]

[topic=meta-test]

[topic=user-action]


配置JDK环境变量:
[root@c11-metaq-n01 local]# vi ./metaqCluster/taobao-8123/metamorphosis-server-wrapper/bin/env.sh
#!/bin/bash

#Config your java home
JAVA_HOME=/usr/local/jdk/

if [ -z "$JAVA_HOME" ]; then
  export JAVA=`which java`
else
  export JAVA="$JAVA_HOME/bin/java"
fi

#JMX port
meta_home=$BASE_DIR

#Broker JMX port
export JMX_PORT=9123
export CLASSPATH=$CLASSPATH:$BASE_DIR/conf:$(ls $BASE_DIR/lib/*.jar | tr ‘\n‘ :)
echo $CLASSPATH > /tmp/classpath.txt
#Broker jvm args
BROKER_JVM_ARGS="-Xmx512m -Xms512m -server -Dmeta.home=$meta_home -cp $CLASSPATH "
#Tools jvm args,you don‘t have to modify this at all.
TOOLS_JVM_ARGS="-Xmx128m -Xms128m -Dmeta.home=$meta_home -cp $CLASSPATH "

#whether to enable http endpoints
export enableHttp=false

if [ -z "$BROKER_ARGS" ]; then
  export BROKER_ARGS="$BROKER_JVM_ARGS -Dlog4j.configuration=file:$BASE_DIR/bin/log4j.properties"
fi

if [ -z "$TOOLS_ARGS" ]; then
  export TOOLS_ARGS="$TOOLS_JVM_ARGS -Dlog4j.configuration=file:$BASE_DIR/bin/tools_log4j.properties"
fi

[root@c11-metaq-n01 lib]# cp -r /backall/apache/zk&metaq/*.jar /usr/local/metaqCluster/taobao-8123/metamorphosis-server-wrapper/lib/

启动方式:
[root@c11-metaq-n01 local]# ./metaqCluster/taobao-8123/metamorphosis-server-wrapper/bin/metaServer.sh start
查看启动状态:
[root@c11-metaq-n01 local]# ./metaqCluster/taobao-8123/metamorphosis-server-wrapper/bin/metaServer.sh status

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。