Sharding-Sphere新官网今日重装上线

点击上方蓝字关注我们

640?wx_fmt=jpeg

2018年5月10日,Sharding-JDBC正式改名为Sharding-Sphere,预示着它新时代的到来!而今天,全新的Sharding-Sphere官方网站也在万众期待中与大家正式见面~

640?wx_fmt=png

全新上阵

640?wx_fmt=png

全新排版编辑的官方文档、备受关注的源码仓库、积极互动的用户社区尽在全新换装的新域名:http://shardingsphere.io/上。而陪伴我们两年之久的旧域名http://shardingjdbc.io/ 将会继续保留一段时间以供我们的老用户过渡。

在保留原来所有版本文档的同时,我们还重新书写了Sharding-Sphere 3.X的文档,以迎接Sharding-Sphere 3.X时代的到来!3.X的官档不仅新增了很多新功能介绍,还在功能介绍和文档结构上做了大规模的调整,希望能够进一步降低使用门槛,让大家阅读更加简易、流畅。

全新的官网是否能让我们的用户眼前一亮呢?让我们先睹为快吧!

曾经陪伴我们的Sharding-JDBC官方网站是这样的:

640?wx_fmt=png

而全新的官网带着简洁大气、颇具厚重感的风格与大家隆重见面:

640?wx_fmt=png 640?wx_fmt=png

社区共赢

640?wx_fmt=png

除了官方文档的调整,我们还在显著的位置增加了社区的相关话题,用于帮助贡献者快速搭建合作交流的渠道。今后,Sharding-Sphere将会更加关注打造一流的开源社区。借用开源界的一句名言:如果你想走得快,那么你就一个人走;如果你想走得远,那么就一起走。

Sharding-Sphere在发展初期,为了更加专注,采用少量核心开发人员的方案。而现在的Sharding-Sphere已经度过了这一艰难时期,所以我们愿意敞开大门,欢迎对开源有热情的优质贡献者加入我们。

希望在大家的共同努力下,能让Sharding-Sphere走出国门,走得更远。同时,我们也牢记初心:打造分布式数据库中间件解决方案组成的生态圈,为大家提供优质、可靠、轻量、易上手的产品。

640?wx_fmt=png

未来已来

640?wx_fmt=png

如果说Sharding-JDBC代表一段璀璨的曾经,那么Sharding-Sphere就是我们期待并为之努力的未来!

Sharding-Sphere

Sharding-Sphere是一套开源的分布式数据库中间件解决方案组成的生态圈,它由Sharding-JDBC、Sharding-Proxy和Sharding-Sidecar这3款相互独立的产品组成。他们均提供标准化的数据分片、读写分离、柔性事务和数据治理功能,可适用于如Java同构、异构语言、容器、云原生等各种多样化的应用场景。

亦步亦趋,开源不易,您对我们最大支持,就是在github上留下一个star。

项目地址:

https://github.com/sharding-sphere/sharding-sphere/

https://gitee.com/sharding-sphere/sharding-sphere/

更多信息请浏览官网:

http://shardingsphere.io/

或加入Sharding-Sphere官方讨论群

640?wx_fmt=jpeg         640?wx_fmt=jpeg


感谢您的支持与关注

我们将不忘初心,不负众望!

640?wx_fmt=png
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
安装ShardingSphere-PHP 1. 下载ShardingSphere-PHP 从ShardingSphere官网下载ShardingSphere-PHP的源代码,解压到Web服务器的根目录下,例如/var/www/html/sharding-sphere-php。 2. 安装Composer Composer是PHP中最流行的依赖管理工具,需要先安装Composer。 可以使用以下命令在Linux环境中安装: ``` curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer ``` 3. 安装ShardingSphere-PHP依赖 在sharding-sphere-php目录下执行以下命令安装依赖: ``` composer install ``` 配置ShardingSphere-PHP 在ShardingSphere-PHP中,需要配置ShardingSphere-JDBC的数据源和分片规则,然后配置ShardingSphere-PHP的数据源和分片规则。 1. 配置ShardingSphere-JDBC的数据源和分片规则 在ShardingSphere-JDBC的配置文件中,配置数据源和分片规则,例如: ``` # 数据源配置 spring.shardingsphere.datasource.names=ds0,ds1 spring.shardingsphere.datasource.ds0.type=com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.ds0.driver-class-name=com.mysql.jdbc.Driver spring.shardingsphere.datasource.ds0.jdbc-url=jdbc:mysql://localhost:3306/db0?serverTimezone=UTC&useSSL=false spring.shardingsphere.datasource.ds0.username=root spring.shardingsphere.datasource.ds0.password=123456 spring.shardingsphere.datasource.ds1.type=com.zaxxer.hikari.HikariDataSource spring.shardingsphere.datasource.ds1.driver-class-name=com.mysql.jdbc.Driver spring.shardingsphere.datasource.ds1.jdbc-url=jdbc:mysql://localhost:3306/db1?serverTimezone=UTC&useSSL=false spring.shardingsphere.datasource.ds1.username=root spring.shardingsphere.datasource.ds1.password=123456 # 分片规则配置 spring.shardingsphere.sharding.default-database-strategy.inline.sharding-column=id spring.shardingsphere.sharding.default-database-strategy.inline.algorithm-expression=ds${id % 2} spring.shardingsphere.sharding.tables.user.actual-data-nodes=ds${0..1}.user spring.shardingsphere.sharding.tables.user.table-strategy.inline.sharding-column=id spring.shardingsphere.sharding.tables.user.table-strategy.inline.algorithm-expression=user${id % 2} ``` 2. 配置ShardingSphere-PHP的数据源和分片规则 在ShardingSphere-PHP的配置文件中,配置数据源和分片规则,例如: ```php // 数据源配置 $shardingDataSourceConfig = new ShardingDataSourceConfiguration(); $shardingDataSourceConfig->getShardingRuleConfiguration()->getTableRuleConfigs()['user'] = new ShardingTableRuleConfiguration('user', 'ds${0..1}.user', 'id', new InlineShardingAlgorithm('id', 'user${id % 2}')); $shardingDataSourceConfig->getShardingRuleConfiguration()->getDefaultDatabaseShardingStrategyConfig() = new InlineShardingStrategyConfiguration('id', 'ds${id % 2}'); $shardingDataSourceConfig->getDataSourceConfiguration()->getDataSourceConfigs()['ds0'] = new DataSourceConfiguration('mysql:host=localhost;port=3306;dbname=db0', 'root', '123456'); $shardingDataSourceConfig->getDataSourceConfiguration()->getDataSourceConfigs()['ds1'] = new DataSourceConfiguration('mysql:host=localhost;port=3306;dbname=db1', 'root', '123456'); // 创建数据源 $shardingDataSource = new ShardingDataSource($shardingDataSourceConfig); ``` 这里的ShardingDataSourceConfiguration和ShardingDataSource是ShardingSphere-PHP提供的类,用于配置和创建ShardingSphere数据源。 使用ShardingSphere-PHP 配置好ShardingSphere-PHP后,就可以使用ShardingSphere-PHP操作分片数据库了。例如: ```php // 插入数据 $statement = $shardingDataSource->getConnection()->prepare('INSERT INTO user (id, name) VALUES (?, ?)'); $statement->bindValue(1, 1); $statement->bindValue(2, 'Alice'); $statement->execute(); // 查询数据 $statement = $shardingDataSource->getConnection()->prepare('SELECT * FROM user WHERE id = ?'); $statement->bindValue(1, 1); $statement->execute(); $row = $statement->fetch(PDO::FETCH_ASSOC); ``` 这里的$shardingDataSource是ShardingSphere-PHP创建的数据源,可以使用PDO API进行操作。注意,在ShardingSphere-PHP中,对于分片的表,需要使用分片键进行操作,否则会出现数据不一致的情况。

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值