SphereEx 正式开源 ShardingSphere on Cloud 解决方案

alan_ham
发布于 2022-10-18 11:31
浏览
0收藏

作为 Database Plus 设计哲学的最佳实践,Apache 顶级开源项目 ShardingSphere 通过各行业多年的生产环境检验,受到了众多社区爱好者的关注和追捧。而随着 Kubernetes 成为容器编排的事实标准,其引领的云原生风暴迅速席卷了技术世界。Apache ShardingSphere 作为一个拥有开放生态的数据库增强引擎,其设计理念和 Kubernetes 有着诸多相似之处,而在这股云原生浪潮之下,社区对 ShardingSphere 上云的呼声也越来越高,于是 SphereEx 率先推出了自己对于 ShardingSphere 云上的解决方案 ShardingSphere-on-Cloud,希望以此为 ShardingSphere 飞向未来的翅膀,开启 Database Plus 的云上之旅。

 

shardinsphere-on-cloud 仓库将陆续发布对于 Apache ShardingSphere 在云上的各种配置模板、自动化脚本、部署工具以及 Kubernetes Operator 等最佳实践内容。目前 shardingsphere-on-cloud 已发布 v0.1.0 版本,主要包含了 ShardingSphere Operator 的最小可用版本。

 

ShardingSphere Operator

Kubernetes 能够成为云原生编排工具的事实标准的重要原因之一在于它强大的可扩展性,可以帮助开发人员快速建立平台之上的平台。对于各种尝试运行在 Kubernetes 之上的软件,通过 Kubernetes 的 Operator 模式配合 CustomResourceDefinition 框架可以快速构建自动化维护能力。

 

6 月 17 日,Apache ShardingSphere 在 5.1.2 版本中已经发布了基于 Helm Charts 的包管理能力。如果说 Helm Charts 已经帮我们解决了 ShardingSphere 在 Kubernetes 之上的 Day 1 相关问题,即如何在 Kubernetes 中进行描述 ShardingSphere,并且将其进行部署。

 

而要想要解决 Day 2 关注的如何在 Kubernetes 管理一个有状态的或者复杂的工作负载,就需要一个定制化的管理工具来完成。为了更进一步提升 ShardingSphere 在 Kubernetes 之上的部署和维护能力,SphereEx 的云团队开发了 ShardingSphere Operator

SphereEx 正式开源 ShardingSphere on Cloud 解决方案-鸿蒙开发者社区

面对 Apache ShardingSphere 迁移到 Kubernetes 环境中面临的各种问题,ShardingSphere Operator 做了以下几方面的探索:

 

●  简化启动配置:ShardingSphere 拥有丰富的数据库增强能力,其相应的配置也较为复杂。在当前版本里,ShardingSphere Operator 将配置和配置的挂载行为进行自动化,用户只需要填写最小化启动依赖配置,就可以在集群中快速部署和启动一个 ShardingSphere-Proxy 集群,而运行时的配置都可以通过 DistSQL 进行实现。

●  自动部署治理节点:ShardingSphere 在运行的过程中依赖治理中心对元数据进行持久化,并实现集群节点间的元数据广播。为了优化用户体验,做到开箱即用,ShardingSphere Operator 可以根据用户需要将治理节点同计算节点一起部署,并配置依赖关系。

●  高可用:在云环境中为了简化维护,希望尽可能实现去状态的部署。ShardingSphere-Proxy 作为无状态的计算节点,配合 ShardingSphere Operator 可以实现多种维度的健康状态探测和故障恢复能力。

●  水平扩容:利用 Kubernetes 的 HPA,可以实现基于 CPU 和内存的 ShardingSphere-Proxy 水平扩缩容。而 ShardingSphere Operator 将逐步支持多种自定义指标,为 ShardingSphere-Proxy 实现更智能、更稳定的高级自动扩容能力。

具体来说在 v0.1.0 版本中,ShardingSphere Operator 主要提供了以下能力:

 

Helm 部署

●  ShardingSphere-Operator Chart

    ◆  支持部署 ShardingSphere-Operator

●  ShardingSphere-Cluster Chart

    ◆  支持部署 ShardingSphere-Proxy 集群

    ◆  支持通过 Bitnami 部署 ZooKeeper 集群

    ◆  支持 ShardingSphere-Proxy 自动配置并连接治理节点

●  使用 Github Pages 托管 Charts 并可以使用 helm repo add 进行添加仓库

新特性

 

●  支持使用 shardingsphereproxy CRD 进行描述 ShardingSphere-Proxy 集群信息

●  支持原生的 ShardingSphere-Proxy server.yaml 配置进行启动

●  支持基于 CPU 指标的 HPA 配置自动扩容

●  支持自动下载 MySQL 驱动

其余配置信息详见项目 ReadMe:https://github.com/SphereEx/shardingsphere-on-cloud/blob/main/README.md

 

快速体验

可以通过以下命令快速体验:

kubectl create ns sharding
helm repo add shardingspherecloud https://sphereex.github.io/shardingsphere-on-cloud/ 
helm install operator shardingspherecloud/shardingsphere-operator -n sharding
helm install cluster shardingspherecloud/shardingsphere-cluster -n sharding

上述命令会按照默认配置在 sharding 这个 Namespace 中安装 ShardingSphere Operator,ShardingSphere-Proxy 集群以及 ZooKeeper 集群,通过 Service 即可在集群中访问 ShardingSphere-Proxy。然后通过 MySQL 客户端,使用 DistSQL 创建逻辑库,添加数据源和创建相对应的规则表,即可开始享受运行在 Kubernetes 上的 ShardingSphere-Proxy 服务。

 

未来规划

未来 ShardingSphere Operator 会逐步优化 ShardingSphere-Proxy 的部署方式,提高自动化维护能力,不断打磨在高可用和灾难恢复场景中的表现,力求给用户最佳的云原生体验。而 shardingsphere-on-cloud 仓库则会持续吸收来自社区的云上各种实践方案,打造一个面向云、得益于云、增强云上数据库能力的开放解决方案生态。

 

如果你有任何内容想和我们交流,欢迎通过微信交流群、GitHub Issue 或 Apache ShardingSphere 官方 Slack 联系到我们。

 

相关链接

SphereEx 官网:https://sphere-ex.com

 

Apache ShardingSphere 官网:https://shardingsphere.apache.org

 

Apache ShardingSphere GitHub: https://github.com/apache/shardingsphere

 

ShardingSphere Operator GitHub:https://github.com/SphereEx/shardingsphere-on-cloud

 

Apache ShardingSphere Slack Channel:https://apacheshardingsphere.slack.com

 

作者

 

SphereEx 云团队,主要负责 ShardingSphere 上云解决方案、Database Mesh 开源社区以及 SphereEx Cloud 业务。

 


本文转载自公众号ShardingSphere官微

分类
已于2022-10-18 11:31:34修改
收藏
回复
举报
回复
    相关推荐