初知Dubbo
前一段时间,在一次模拟面试中,一个学长告诉我,现在的大学生还是懂一点分布式是比较好的,例如阿里巴巴的Dubbo框架,现在做项目很多公司都会使用这个框架;于是我心心念念这个框架在期末复习的空档时间看了好几次官方文档,都没有太大的作用,今天发了个狠心,决定动手试一下,就像我以前学习SSM框架是一样的,什么都不会,直接上手,所以在下文中,可能涉及到原理讲解的会比较少,很多都是做法是怎样的。
前期准备
1、安装zookeeper(百度百科):
ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是Hadoop和Hbase的重要组件。它是一个为分布式应用提供一致性服务的软件,提供的功能包括:配置维护、域名服务、分布式同步、组服务等。
ZooKeeper的目标就是封装好复杂易出错的关键服务,将简单易用的接口和性能高效、功能稳定的系统提供给用户。
ZooKeeper包含一个简单的原语集,[1] 提供Java和C的接口。
ZooKeeper代码版本中,提供了分布式独享锁、选举、队列的接口,代码在zookeeper-3.4.3\src\recipes。其中分布锁和队列有Java和C两个版本,选举只有Java版本。
我们下载过后把我们的Zookeeper 解压到相应的目录中,进入我们的conf文件夹下,打开 zoo.cfg配置文件:
# The number of milliseconds of each tick# zookeeper中使用的基本时间单位, 毫秒值.tickTime=2000# The number of ticks that the initial # synchronization phase can takeinitLimit=10# The number of ticks that can pass between # sending a request and getting an acknowledgementsyncLimit=5# the directory where the snapshot is stored.# do not use /tmp for storage, /tmp here is just # example sakes.# 数据目录. 可以是任意目录.dataDir=D:\Program Files\zookeeper-3.4.6\dataTmp# the port at which the clients will connect# 监听client连接的端口号.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
2、安装Tomcat(相信大家都有);
3、打包dubbo-admin的war包;
我自己用的IDE是Idea,要是也用这个IED就跟着我的脚步,把dubbo-admin解压到自己喜欢的地方,在idea中直接打开就行,我们设置好后,直接启动Tomcat服务器即可,我们 可以看到登录页面,登陆过后会看到如下我的页面:
01.png
我们的登录的用户名密码为:dubbo-admin/src/webapp/WEB-INF/dubbo-properties配置文件中
# 这里的端口号与上面Zookeeper中配置的端口号一致dubbo.registry.address=zookeeper://localhost:2181dubbo.admin.root.password=root dubbo.admin.guest.password=guest
共同學習,寫下你的評論
評論加載中...
作者其他優質文章