NullPointException2的gravatar头像
NullPointException2 2018-09-09 12:08:01

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

项目描述

本案例用dubbo+zookeeper+springboot+mybatis搭建分布式架构,一个服务消费,两个服务提供,并支持轮询、随机的负载均衡策略。 案例很简单,结构很清晰,适合小白学习。案例没有炫彩的页面,只是单单的访问连接,我们玩的是架构,不是炫彩的前端技术。

运行环境

jdk7+tomcat7+mysql+IntelliJ IDEA+maven

项目技术(必填)

dubbo+zookeeper+springboot+mybatis

  1)dubbo - 高性能的Java RPC 框架

  2)  zookeeper - Dubbo推荐使用的分布式服务注册、服务发现。

  3) springboot - “约定大于配置" , 相对spring框架, boot 减少了相当多的配置,只需一个注解,搞定

  4)mybtis - 持久层orm框架

  5)mavan - 项目托管

数据库文件

链接1:https://pan.baidu.com/s/1UwKXrZ0o1VSYOUlPhX5Auw

链接:https://pan.baidu.com/s/1vPQxu6NHlrWQk9FJMe_LHg 密码:hrws

jar包文件

maven构建,不需要另外提供jar包

是否原创(转载必填原文地址)

原创

项目截图(必填)

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

2. 一些配置文件

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

3. 其中一个服务提供者的业务

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

运行截图(必填)

启动三个服务

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

访问获取到数据

http://localhost:8080/users.json

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡

注意事项

项目启动前,必须先启动zookeeper,不然怎么注册服务?对吧

请自行安装zookeeper, 文件太大了,上传麻烦

下载地址:http://mirrors.hust.edu.cn/apache/zookeeper/

D:\zookeeper-3.4.13\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.
# do not use /tmp for storage, /tmp here is just 
# example sakes.
dataDir=/tmp/zookeeper
# 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

dubbo+zookeeper+spring boot+mybatis配置搭建分布式架构项目实例,一个服务消费,两个服务提供,负载均衡


打赏

已有1人打赏

最代码官方的gravatar头像

文件名:dubbo.zip,文件大小:28.844K 下载
最代码最近下载分享源代码列表最近下载
徐万强  LV9 2023年9月11日
空心菜4  LV9 2023年7月10日
cgp0219  LV6 2022年5月5日
eahity  LV2 2022年4月24日
denliv_hui  LV13 2022年2月11日
Rommel  LV27 2021年10月12日
ewan007  LV29 2021年9月27日
huangxiaoke20  LV17 2021年7月19日
sleepcat88  LV13 2021年5月25日
lebu9527  LV11 2021年3月3日
最代码最近浏览分享源代码列表最近浏览
徐万强  LV9 2023年9月11日
liangge2115  LV27 2023年3月20日
UzumakiHL 2023年2月22日
暂无贡献等级
潇洒明天  LV2 2022年12月25日
无名氏111  LV32 2022年11月3日
何寒衣  LV3 2022年9月23日
暂无贡献等级
annazhang  LV29 2022年7月17日
zxtldw  LV1 2022年6月15日
Lxmzdm123  LV3 2022年6月10日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友