目录:
dubbo简介
注册中心介绍
- 注册中心负责服务地址的注册与查找,相当于目录服务,服务提供者和消费者只在启动 时与注册中心交互,注册中心不转发请求,压力较小
- 监控中心负责统计各服务调用次数,调用时间等,统计先在内存汇总后每分钟一次发送 到监控中心服务器,并以报表展示
- 服务提供者向注册中心注册其提供的服务,并汇报调用时间到监控中心,此时间不包含 网络开销
- 服务消费者向注册中心获取服务提供者地址列表,并根据负载算法直接调用提供者,同 时汇报调用时间到监控中心,此时间包含网络开销
- 注册中心,服务提供者,服务消费者三者之间均为长连接,监控中心除外
- 注册中心通过长连接感知服务提供者的存在,服务提供者宕机,注册中心将立即推送事 件通知消费者
- 注册中心和监控中心全部宕机,不影响已运行的提供者和消费者,消费者在本地缓存了 提供者列表
- 注册中心和监控中心都是可选的,服务消费者可以直连服务提供者
注册中心可以自由选择如:redis,zookeeper等,官方推荐zookeeper,这边文章讲解如何在linux上下载安装zookeeper。
下载安装
下载地址 : 官方下载
cd /usr/local/
tar -xzvf zookeeper-3.4.6.tar.gz
cd zookeeper-3.4.6
mkdir data
mkdir logs
cd conf/
cp zoo_sample.cfg zoo.cfg
vi zoo.cfg
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
dataDir=/usr/local/zookeeper-3.4.6/data #数据目录
dataLogDir=/usr/local/zookeeper-3.4.6/logs #日志目录
# 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
配置zookeeper环境变量
vi /etc/profile
增加
export ZOOKEEPER_HOME=/usr/local/zookeeper-3.4.6
export PATH=$ZOOKEEPER_HOME/bin:$PATH
使配置生效
source /etc/profile
ZooKeeper启动命令
cd /usr/local/zookeeper-3.4.6/bin
./zkServer.sh start
#停止zookeeper命令
./zkServer.sh stop
#查看zookeeper状态命令
./zkServer.sh status
#Mode:standalone意思是单节点