mysql——mycat

概要:

项目实现读写分离,可以有两个方式

(1)程序代码实现,但是这种方式耦合性太强

(2)数据库中间件达到读写分离,水平分片等功能,这种方式灵活易配置。

那么,下面来介绍这种数据库中间件mycat

一、安装配置

win7版详情:https://www.cnblogs.com/zuidongfeng/p/7793098.html

二、conf文件详解

https://www.cnblogs.com/chanshuyi/p/head_first_of_mycat.html

https://blog.csdn.net/sds15732622190/article/details/72152562

三、官方例子详解

http://www.cnblogs.com/softidea/archive/2016/04/29/5447566.html

四、springboot

(1)依赖

<dependency><!-- mybatis依赖 -->
			<groupId>org.mybatis.spring.boot</groupId>
			<artifactId>mybatis-spring-boot-starter</artifactId>
			<version>1.1.1</version>
		</dependency>
		
		<dependency><!-- mysql驱动依赖 -->
			<groupId>mysql</groupId>
			<artifactId>mysql-connector-java</artifactId>
			<scope>runtime</scope>
		</dependency>

(2)配置

注意:使用springboot默认数据库连接池配置时,下面配置名称不能变

(3)代码

按照普通的dao,mybatis写就可以

(4)测试

可以实现,官方实例

猜你喜欢

转载自blog.csdn.net/qq_42683700/article/details/82877324