DubboZookeeper
192.168.3.71Zookeeper:
1 /etc/hosts
# zookeeper servers
192.168.3.71 edu-provider-01
2 http://apache.fayea.com/zookeeper/ zookeeper-3.4.6
$ wget http://apache.fayea.com/zookeeper/zookeeper-3.4.6/zookeeper-3.4.6.tar.gz
3 zookeeper
$ tar -zxvf zookeeper-3.4.6.tar.gz
4 /home/wusc/zookeeper-3.4.6
$ cd /home/wusc/zookeeper-3.4.6
$ mkdir data
$ mkdir logs
5 zookeeper-3.4.6/conf zoo_sample.cfg
zoo.cfg
$ cp zoo_sample.cfg zoo.cfg
6 zoo.cfg
$ vi 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=/home/wusc/zookeeper-3.4.6/data
dataLogDir=/home/wusc/zookeeper-3.4.6/logs
# the port at which the clients will connect
clientPort=2181
#2888,3888 are election port
Dubbo--
Dubbo--wu-sc@foxmail.com
soa dubbo 367211134
server.1=edu-provider-01:2888:3888
2888 zookeeper
3888zookeeper
edu-provider-01hostsIP
initLimit Zookeeper Zookeeper Zookeeper
Leader Follower 10 tickTime Zookeeper
5*2000=10
syncLimit Leader Follower tickTime 2*2000=4
server.A=B:C:D A B IP/etc/hostsIPC Leader D Leader Leader B Zookeeper
7 dataDir=/home/wusc/zookeeper-3.4.6/datamyid myid IPzookeepermyid 1server.1
$ vi myid
1
8 wuscvi /home/wusc/.bash_profilezookeeper
# zookeeper env
export ZOOKEEPER_HOME=/home/wusc/zookeeper-3.4.6
export PATH=$ZOOKEEPER_HOME/bin:$PATH
$ source /home/wusc/.bash_profile
9 218128883888 root
# chkconfig iptables on
Dubbo--
Dubbo--wu-sc@foxmail.com
soa dubbo 367211134
# service iptables start /etc/sysconfig/iptables
# vi /etc/sysconfig/iptables 3
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2181 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 2888 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3888 -j ACCEPT
# service iptables restart
# service iptables status
Table: filter
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0 state RELATED,ESTABLISHED
2 ACCEPT icmp -- 0.0.0.0/0 0.0.0.0/0
3 ACCEPT all -- 0.0.0.0/0 0.0.0.0/0
4 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:22
5 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:2181
6 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:2888
7 ACCEPT tcp -- 0.0.0.0/0 0.0.0.0/0 state NEW tcp dpt:3888
8 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain FORWARD (policy ACCEPT)
num target prot opt source destination
1 REJECT all -- 0.0.0.0/0 0.0.0.0/0 reject-with icmp-host-prohibited
Chain OUTPUT (policy ACCEPT)
num target prot opt source destination
10 zookeeper wuscroot:
(1) wusc/home/wusc/zookeeper-3.4.6/bin
$ zkServer.sh start
(2) jps
$ jps
1456 QuorumPeerMain
1475 Jps
QuorumPeerMain zookeeper
(3)
Dubbo--
Dubbo--wu-sc@foxmail.com
soa dubbo 367211134
$ zkServer.sh status
(4) zookeeper /home/wusc/zookeeper-3.4.6/bin/zookeeper.out
$ tail -500f zookeeper.out
11 zookeeper
$ zkServer.sh stop
12 zookeeperwusc /etc/rc.local
su - wusc -c '/home/wusc/zookeeper-3.4.6/bin/zkServer.sh start'
apache