windows server 2008 r2 jar包后台启动_Sharing-Proxy部署&启动(4.0.0-RC3)

本文介绍了如何在Windows Server 2008 R2上下载并部署Apache ShardingSphere的Sharding-Proxy 4.0.0-RC3版本。首先从Apache官网下载tar.gz压缩包,然后通过特定方式避免文件名过长导致的解压问题。接着,解释了目录结构,包括bin目录中的启动脚本和conf目录中的配置文件。重点强调了修改`server.yaml`和`config-proxy.yaml`配置文件以设置数据库连接和权限。添加所需的数据库驱动,如MySQL的jar包。最后,说明了启动Sharding-Proxy的步骤和检查日志以确认启动状态。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

1.进入https://www.apache.org/dyn/closer.cgi?path=incubator/shardingsphere/4.0.0-RC3/apache-shardingsphere-incubating-4.0.0-RC3-sharding-proxy-bin.tar.gz下载压缩包

2.解压缩

Linux下可直接使用tar -zxvf解压。

windows环境,请使用tar zxvf解压,不要使用压缩工具,否则可能出现bin文件夹中的.jar由于名称太长而被截断,如下图所示。

dd545f5afc181aa91e5d96de114ec782.png

导致启动start.bat/start.sh失败。如下图所示

85703432ef2110d161703aa1593b1988.png

3.目录结构

c07f3d8da7610d612eb76b67905126e2.png
  • bin里面包含start/stop脚本
  • conf包含配置文件,其中server
  • lib包含系统及其依赖的jar包(缺少数据库驱动jar)
  • 运行bin里面的start.sh/start.bat后会生成logs,里面包含运行日志

4.修改conf下的配置文件(其中server.yaml必须修改)

  • server.yaml中包含orchestration(注册中心配置),authentication(连接proxy时使用的用户名&密码及其访问权限),props(proxy基本配置)
orchestration:
  name: orchestration_ds
  overwrite: true
  registry:
    type: zookeeper
    serverLists: localhost:2181
    namespace: orchestration

authentication:
  users:
    root:
      password: root
    sharding:
      password: 123
      authorizedSchemas: sharding_db

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
  proxy.hint.enabled: false
  query.with.cipher.column: true
  sql.show: false
  • config-proxy.yaml包含schemaName(proxy对外提供的库名),dataSources(数据源配置),shardingRule(路由配置),这里我已单库单表为例,使用分库分表可自行更改配置文件
schemaName: default_db

dataSources:
  FenqileDB:
      url: jdbc:mysql://127.0.0.1:3306/synchronization_db?serverTimezone=UTC&useSSL=false
      username: root
      password: 123
      connectionTimeoutMilliseconds: 30000
      idleTimeoutMilliseconds: 60000
      maxLifetimeMilliseconds: 1800000
      maxPoolSize: 50
shardingRule:
  tables:
    t_default:
      actualDataNodes: default_db.t_synchronization

5.向lib中加入数据库驱动

我使用的是mysql数据库,故加入mysql驱动jar,如下图所示

5827f0f64070d956405e4a21b2c998c9.png

6.运行

运行start.sh脚本,进入logs查看日志

d6669b1733b844d3049f4d9d5946bd5b.png

ACTIVE表示启动成功

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值