ShardingSphere-Proxy 主从读写 入门使用

ShardingSphere-Proxy 主从读写 入门使用


基于ShardingSphere5.0.0Alpha

环境准备

MySQL搭建

    准备MySQL

配置ShardingSphere-Proxy

    这里使用5.0.0版本的

  • 1.下载ShardingSphere-Proxy

  • 2.下载完成后解压放到自己的目录下,比如我这里是放到:D:/temp/ssp

  • 3.下载MySQL-connect.jar

  • 4.将MySQL-connect.jar,放到ShardingSphere-Proxy根目录的lib下,比如我这里是:D:/temp/ssp/lib/

  • 5.写入配置文件,里面本身就有配置文件,这里需要写入的有两份,如果之前存在的就直接替换:server.xml和config-master_slave.yaml

    server.xml 这份感觉不用改,如果和下面的一样就不用改

######################################################################################################
#
# If you want to configure orchestration, authorization and proxy properties, please refer to this file.
#
######################################################################################################

# orchestration:
#  name: orchestration_ds
#  overwrite: true
#  registry:
#    type: zookeeper
#    serverLists: localhost:2181
#    namespace: orchestration

authentication:
  users:
    root:
      password: root
    sharding:
      password: sharding
      authorizedSchemas: test

props:
  max.connections.size.per.query: 1
  acceptor.size: 16  # The default value is available processors count * 2.
  executor.size: 16  # Infinite by default.
  proxy.frontend.flush.threshold: 128  # The default value is 128.
    # LOCAL: Proxy will run with LOCAL transaction.
    # XA: Proxy will run with XA transaction.
  # BASE: Proxy will run with B.A.S.E transaction.
  proxy.transaction.type: LOCAL
  proxy.opentracing.enabled: false
  query.with.cipher.column: true
  sql.show: false

    config-master_slave.yaml,这个文件的配置关键字一定不要安装官方example的那个来,完全不行,要按照官方文档来,比如JDBCURL需要改成url,大致的文件内容如下:

######################################################################################################
# 
# Here you can configure the rules for the proxy.
# This example is configuration of master-slave rule.
#   
# If you want to use master-slave, please refer to this file; 
# if you want to use sharding, please refer to the config-sharding.yaml.
# 
######################################################################################################

schemaName: test

dataSources:
  master_ds:
    url: jdbc:mysql:/
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值