【JAVA】dubbo

2018-04-19  本文已影响11人  Y了个J

zookeeper注册中心安装

centerOS下 载zookeeper
wget http://mirrors.hust.edu.cn/apache/zookeeper/stable/zookeeper-3.4.10.tar.gz
tar zxvf zookeeper-3.4.10.tar.gz
cd zookeeper-3.4.10/conf
cp zoo_sample.cfg ./zoo.cfg

修改conf/zoo.cfg

zookeeper 下面有个bin、conf等目录,创建个 mkdir data目录
vi 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=/tmp/zookeeper
# 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
~                                

修改上面的dataDir=创建的data目录的地址

dataDir=/developer/zookeeper-3.4.10/data

启动

./bin/zkServer.sh start
./bin/zkServer.sh status
./bin/zkServer.sh stop

dubbo监测中心

把dubbo-admin-2.5.4.war拷贝到tomcat/webaps目录下,然后启动tomcat
tail -f logs/catalina.out #查看日志

zookeeper集群

在/usr/local下解压多份zookeeper-3.4.10.tar.gz
分别命名为zookeeper1、zookeeper2、zookeeper3
在每个zookeeper目录里 mkdir data
然后在data目录下 touch myid
vi myid
第一个输入1,第二个输入2,第三个输入3
cp zoo_sample.cfg ./zoo.cfg

zookeeper1里的zoo.cfg修改

dataDir=/Users/luosa/Desktop/JavaServer/solr-cloud/zookeeper1/data
clientPort=2181
server.1=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3882
server.3=127.0.0.1:2883:3883

zookeeper2里的zoo.cfg修改

dataDir=/Users/luosa/Desktop/JavaServer/solr-cloud/zookeeper2/data 
clientPort=2182
server.1=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3882
server.3=127.0.0.1:2883:3883

zookeeper3里的zoo.cfg修改

dataDir=/Users/luosa/Desktop/JavaServer/solr-cloud/zookeeper3/data 
clientPort=2183
server.1=127.0.0.1:2881:3881
server.2=127.0.0.1:2882:3882
server.3=127.0.0.1:2883:3883

vim start-zookeeper.sh
输入

cd zookeeper1/bin
./zkServer.sh start
cd ../../
cd zookeeper2/bin
./zkServer.sh start
cd ../../
cd zookeeper3/bin
./zkServer.sh start
cd ../../

esc :wq保存
chmod u+x start-zookeeper.sh
./start-zookeeper.sh 启动

上一篇下一篇

猜你喜欢

热点阅读