万隆的笔记 万隆的笔记
博文索引
笔试面试
  • 在线学站

    • 菜鸟教程 (opens new window)
    • 入门教程 (opens new window)
    • Coursera (opens new window)
  • 在线文档

    • w3school (opens new window)
    • Bootstrap (opens new window)
    • Vue (opens new window)
    • 阿里开发者藏经阁 (opens new window)
  • 在线工具

    • tool 工具集 (opens new window)
    • bejson 工具集 (opens new window)
    • 文档转换 (opens new window)
  • 更多在线资源
  • Changlog
  • Aboutme
GitHub (opens new window)
博文索引
笔试面试
  • 在线学站

    • 菜鸟教程 (opens new window)
    • 入门教程 (opens new window)
    • Coursera (opens new window)
  • 在线文档

    • w3school (opens new window)
    • Bootstrap (opens new window)
    • Vue (opens new window)
    • 阿里开发者藏经阁 (opens new window)
  • 在线工具

    • tool 工具集 (opens new window)
    • bejson 工具集 (opens new window)
    • 文档转换 (opens new window)
  • 更多在线资源
  • Changlog
  • Aboutme
GitHub (opens new window)
  • ShardingSphere简介
  • ShardingSphere-JDBC
  • 数据分片剖析
  • 读写分离剖析
  • 强制路由剖析
  • 数据脱敏剖析
  • 分布式事务剖析
  • SPI 加载剖析
  • 编排治理剖析
  • ShardingSphere-Proxy
    • 概述
    • 使用过程
  • ShardingSphere-Sidecar(TODO)
  • ShardingShpere
2022-03-26
目录

ShardingSphere-Proxy

# ShardingSphere-Proxy

ShardingSphere > User Manual > Sharding-Proxy > Manual (opens new window)

# 概述

ShardingSphere-Proxy 是 Apache ShardingSphere 的第二个产品。 它定位为透明化的数据库代理端,提供封装了数据库二进制协议的服务端版本,用于完成对异构语言的支持。 目前提供 MySQL 和 PostgreSQL(兼容 openGauss 等基于 PostgreSQL 的数据库)版本,它可以使用任何兼容 MySQL/PostgreSQL 协议的访问客户端(如:MySQL Command Client, MySQL Workbench, Navicat 等)操作数据,对 DBA 更加友好。

  • 向应用程序完全透明,可直接当做 MySQL/PostgreSQL 使用;
  • 适用于任何兼容 MySQL/PostgreSQL 协议的的客户端。

shardingsphere-proxy_v2

ShardingSphere-Proxy 的优势在于对异构语言的支持,以及为 DBA 提供可操作入口。

# 使用过程

ShardingSphere-Proxy主要是进行配置,而这些配置与SharidingSphere-JDBC异曲同工,所以只要你熟悉了SharidingSphere-JDBC,这一切都变得十分简单。使用过程如下:

  1. 下载Sharding-Proxy的最新发行版 (opens new window);
  2. 解压缩后修改conf/server.yaml和以config-前缀开头的文件,进行分片规则、读写分离规则配。编辑%SHARDING_PROXY_HOME%\conf\config-xxx.yaml和%SHARDING_PROXY_HOME%\conf\server.yaml,参考配置手册 (opens new window)
  3. 引入依赖jar:如果后端连接MySQL数据库,需要下载MySQL驱动.jar拷贝到${sharding-proxy}\lib目录。如果后端连接PostgreSQL数据库,不需要引入额外依赖。
  4. Linux操作系统运行bin/start.sh,Windows操作系统请运行bin/start.bat启动Sharding-Proxy。使用默认配置启动,端口号为:3307;指定端口启动:bin\start.sh ${port}。
  5. 使用客户端工具连接。如: mysql -h127.0.0.1 -p3307 -uroot -p

若想使用Sharding-Proxy的数据库治理功能,则需要使用注册中心实现实例熔断和从库禁用功能。Sharding-Proxy默认提供了Zookeeper的注册中心解决方案。只需按照配置规则进行注册中心的配置,即可使用。

注意事项:

  • 默认不支持hint,如需支持,请在conf/server.yaml中,将props的属性proxy.hint.enabled设置为true。在Sharding-Proxy中,HintShardingAlgorithm的泛型只能是String类型。
  • 在conf/server.yaml配置注册中心、认证信息以及公用属性。
  • 支持多逻辑数据源,每个以"config-"做前缀命名yaml配置文件,即为一个逻辑数据源。
上次更新: 5/30/2023, 11:42:20 PM
ShardingSphere-Sidecar(TODO)

ShardingSphere-Sidecar(TODO)→

最近更新
01
2025
01-15
02
Elasticsearch面试题
07-17
03
Elasticsearch进阶
07-16
更多文章>
Theme by Vdoing
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式