dubbo简单示例
dubbo简单示例
2019-09-06
1 Zookeeper注册中心的搭建(windows单机)
- 下载zookeeper压缩包并解压到 D:\zookeeper\apache-zookeeper-3.5.5-bin,官网地址:http://www.apache.org/dyn/closer.cgi/zookeeper/
- 进入conf目录将 zoo_sample.cfg 改名为 zoo.cfg。
默认配置如下:
# The number of milliseconds of each tick tickTime=2000 # The number of ticks that the initial # synchronization phase can take initLimit=5 # The number of ticks that can pass between # sending a request and getting an acknowledgement syncLimit=2 # the directory where the snapshot is stored. # do not use /tmp for storage, /tmp here is just # example sakes. dataDir=D:\\zookeeper\\data dataLogDir=D:\\zookeeper\\log # 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
- 进入bin目录双击 zkServer.cmd,若启动成功,则windows单机版zookeeper搭建成功
2 dubbo-admin安装与使用
dubbo-admin git: https://github.com/apache/incubator-dubbo-ops下载。
注意:最新的dubbo-admin集成了springboot,可以打包为jar运行。
也可以从 https://gitee.com/jingyang3877/all-examples 直接下载jar包
执行以下命令打jar包:
mvn package -DskipTests=true
在jar包目录下,执行以下命令启动
java -jar dubbo-admin-xxx.jar
注意:dubbo-admin的端口默认是7001,dubbo注册中心的地址是本机的2181端口
图1 dubbo管理