ShardingSphere如何实现数据库分片策略?
- 内容介绍
- 文章标签
- 相关推荐
本文共计372个文字,预计阅读时间需要2分钟。
一、说明环境准备:JDK 8 + MySQL 5.x + 官网:https://shardingsphere.apache.org/,下载地址:https://archive.apache.org/dist/shardingsphere/5.0.0/
二、安装步骤
1.解压安装包:`tar -zxvf apache-shardingsphere-5.0.0-bin.tar.gz`
一、说明环境准备:JDK8+ mysql 5.x
官网:shardingsphere.apache.org/
下载地址:archive.apache.org/dist/shardingsphere/5.0.0/
二、安装部署 1、解压tar -zxvf apache-shardingsphere-5.0.0-shardingsphere-proxy-bin.tar.gz 2、下载mysql连接驱动
下载地址:repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/
本人的shardingsphere版本是5.0.0,故mysql 连接驱动使用的是5.1.47 ,需要注意连接驱动的版本问题,否则shardingsphere服务启动失败,曾经踩过这个坑,,,,无语
下载完成之后将jar包放置在shardingsphere解压目录的lib目录下即可
3、修改conf/config-sharding.yaml 文件 4、修改conf/server.yaml文件 5、启动服务进入bin
-- 进入bin目录
cd bin
-- 启动服务
./start.sh
查看日志文件,查看服务是否启动成功 cat apache-shardingsphere-5.0.0-shardingsphere-proxy-bin/logs/stdout.log
如下图,当我们在代理中间件中创建t_product表时,原MyDb数据库会同步创建t_product_0和t_product_1
本文共计372个文字,预计阅读时间需要2分钟。
一、说明环境准备:JDK 8 + MySQL 5.x + 官网:https://shardingsphere.apache.org/,下载地址:https://archive.apache.org/dist/shardingsphere/5.0.0/
二、安装步骤
1.解压安装包:`tar -zxvf apache-shardingsphere-5.0.0-bin.tar.gz`
一、说明环境准备:JDK8+ mysql 5.x
官网:shardingsphere.apache.org/
下载地址:archive.apache.org/dist/shardingsphere/5.0.0/
二、安装部署 1、解压tar -zxvf apache-shardingsphere-5.0.0-shardingsphere-proxy-bin.tar.gz 2、下载mysql连接驱动
下载地址:repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.47/
本人的shardingsphere版本是5.0.0,故mysql 连接驱动使用的是5.1.47 ,需要注意连接驱动的版本问题,否则shardingsphere服务启动失败,曾经踩过这个坑,,,,无语
下载完成之后将jar包放置在shardingsphere解压目录的lib目录下即可
3、修改conf/config-sharding.yaml 文件 4、修改conf/server.yaml文件 5、启动服务进入bin
-- 进入bin目录
cd bin
-- 启动服务
./start.sh
查看日志文件,查看服务是否启动成功 cat apache-shardingsphere-5.0.0-shardingsphere-proxy-bin/logs/stdout.log
如下图,当我们在代理中间件中创建t_product表时,原MyDb数据库会同步创建t_product_0和t_product_1

