Duboo入門示例(Idea開發環境)
阿新 • • 發佈:2018-07-02
per hot release 點擊 aps 開發環境 .org load cpp
有關Dubbo的概念、概述和簡單的配置文件,可以看官方文檔的簡述
準備工作:
- 下載示例,點擊這裏下載,建議用git管理。
- 下載註冊中心,推薦ZooKeeper,點擊這裏下載
首先完成Zookeeper的安裝配置
- 解壓後,在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. dataDir=D:\\zookeeper-3.4.12\\data dataDirLog=D:\\zookeeper-3.4.12\\log # the port at which the clients will connect clientPort=2181
- 根據你上述配置的目錄(dataDir、dataDirLog),在根目錄中新建它們。
- 點擊bin目錄下的zkServer.cmd啟動
項目配置運行
- 打開項目
- 項目是Maven管理的多模塊項目,首先引入多模塊。
- 找到我們演示的Demo項目
- 將consumer和provider模塊的xml下的註冊中心配置全都換成ZooKeeper
參數用途簡介:
- 先運行Provider.java,再運行Consumer.java(確保打開了Zookeeper註冊中心)
- 運行效果圖
Duboo入門示例(Idea開發環境)