Sharding-jdbc5.2.1分库分表入门-1

Sharding Sphere简介与参考

Apache ShardingSphere 是一款分布式 SQL 事务和查询引擎,可通过数据分片、弹性伸缩、加密等能力对任意数据库进行增强

官网:https://shardingsphere.apache.org/index_zh.html

官方样例:https://shardingsphere.apache.org/blog/cn/material/oct_12_4_updates_and_faq_your_1_minute_quick_start_guide_to_shardingsphere/

Sharding-JDBC使用

目前有三种主流的maven坐标,推荐使用第二种


<dependency>
    <groupId>org.apache.shardingspheregroupId>
    <artifactId>sharding-jdbc-spring-boot-starterartifactId>
    <version>4.1.1version>
dependency>


<dependency>
    <groupId>org.apache.shardingspheregroupId>
    <artifactId>shardingsphere-jdbc-core-spring-boot-starterartifactId>
    <version>5.2.1version>
dependency>


<dependency>
    <groupId>org.apache.shardingspheregroupId>
    <artifactId>shardingsphere-jdbc-coreartifactId>
    <version>5.4.0version>
dependency>

引入坐标

主要组件版本

组件 版本号
spring-boot-starter-parent 2.6.11
shardingsphere-jdbc-core-spring-boot-starter 5.2.1
mybatis-plus-boot-starter 3.4.1
druid-spring-boot-starter 1.2.9

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <parent>
        <groupId>org.springframework.bootgroupId>
        <artifactId>spring-boot-starter-parentartifactId>
        <version>2.6.11version>
        <relativePath/>
    parent>
   
    <modelVersion>4.0.0modelVersion>
    
    <properties>
        <java.version>1.8java.version>
        <maven.compiler.source>8maven.compiler.source>
        <maven.compiler.target>8maven.compiler.target>
        <spring-boot.version>2.6.11spring-boot.version>
    properties>
    
    
    <dependencies>
        <dependency>
            <groupId>org.apache.shardingspheregroupId>
            <artifactId>shardingsphere-jdbc-core-spring-boot-starterartifactId>
            <version>5.2.1version>
        dependency>

        
        <dependency>
            

你可能感兴趣的:(分库分表,sharding-jdbc5,分库分表,大数据)