Dubbo : ZooKeeper安裝配置(一)

目錄:

dubbo簡介

簡介:
百度百科
官網
GitHub

這裏寫圖片描述

註冊中心介紹

  • 註冊中心負責服務地址的註冊與查找,相當於目錄服務,服務提供者和消費者只在啓動 時與註冊中心交互,註冊中心不轉發請求,壓力較小
  • 監控中心負責統計各服務調用次數,調用時間等,統計先在內存彙總後每分鐘一次發送 到監控中心服務器,並以報表展示
  • 服務提供者向註冊中心註冊其提供的服務,並彙報調用時間到監控中心,此時間不包含 網絡開銷
  • 服務消費者向註冊中心獲取服務提供者地址列表,並根據負載算法直接調用提供者,同 時彙報調用時間到監控中心,此時間包含網絡開銷
  • 註冊中心,服務提供者,服務消費者三者之間均爲長連接,監控中心除外
  • 註冊中心通過長連接感知服務提供者的存在,服務提供者宕機,註冊中心將立即推送事 件通知消費者
  • 註冊中心和監控中心全部宕機,不影響已運行的提供者和消費者,消費者在本地緩存了 提供者列表
  • 註冊中心和監控中心都是可選的,服務消費者可以直連服務提供者

註冊中心可以自由選擇如: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意思是單節點
發佈了41 篇原創文章 · 獲贊 35 · 訪問量 18萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章