Files
logseq/pages/ShardingSphere.md

37 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
- [[读写分离]]
- [[数据库分片]]
- 实现方式
- 程序代码封装
- 在数据访问层DAO层添加对应的处理逻辑
- 中间件封装
- MyCat
- 对业务来说,访问中间件和数据库没有区别
- Apache ShardingSphere
- ShardingSphere-JDBC
- 在JDBC层提供的额外服务
- ![image.png](../assets/image_1750234767614_0.png)
- ShardingSphere-Proxy
- 透明的数据库代理端
- ![image.png](../assets/image_1750234843093_0.png)
- Sidecar规划中
- 广播表
- 所有分片数据源都存在的表,结构且数据在每个数据库当中完全一致,适用于数据量不大但是需要与海量数据表关联查询的场景(字典表)
- ```properties
#数据节点可不配置,默认情况下,向所有数据源广播
spring.shardingsphere.rules.sharding.tables.t_dict.actual-data-nodes=server-user.t_dict,server-order$->{0..1}.t_dict
# 广播表
spring.shardingsphere.rules.sharding.broadcast-tables[0]=t_dict
```
- 启动方式
- 二进制
- Docker
- 启动镜像
- 上传MySQL驱动
- 修改server.yaml
- 修改config-readwrite-splitting.yaml
- 需要配置垂直分片,水平分片
- 需要配置各个表及其对应的服务器
- Helm
-