Apache ShardingSphere-On-Cloud 近日迎来了 0.2.0 版本发布。本次 0.2.0 版本主要为 ShardingSphere Operator 引入了全新 CRD ComputeNode,用于完整定义 ShardingSphere 架构中的计算节点。
ComputeNode介绍




ComputeNode实践
快速安装 ShardingSphere Operator
1. 添加 ShardingSphere on Cloud 的 Helm 仓库:
helm repo add shardingsphere https://apache.github.io/shardingsphere-on-cloud

2. 利用 helm install 命令安装 shardingsphere-operator:
说明:目前 ComputeNode 仍然属于 v1alpha1 阶段,需要通过 feature gate 进行启用
helm install shardingsphere-operator shardingsphere/apache-shardingsphere-operator-charts --set operator.featureGates.computeNode=true --set proxyCluster.enabled=false


利用 kubectl get 查看 ShardingSphere Proxy 集群状态
READYINSTANCES:表示当前处于 Ready 状态的 ShardingSphere Pod 数量,如图中为 1 PHASE:表示当前集群状态,如图中为 Ready 状态 CLUSTER-IP:表示当前集群 Service 的 ClusterIP SERVICEPORTS:表示当前集群 Service 的端口列表 AGE:表示当前集群的创建时长 kubectl get computenode

利用 kubectl scale 快速伸缩 ShardingSphere Proxy 集群
为了方便使用,ComputeNode 支持 Scale 子资源,所以可以通过 kubectl scale 配合 --replicas参数进行手动扩容:


自定义 ComputeNode 配置
apiVersion: shardingsphere.apache.org/v1alpha1
kind: ComputeNode
metadata:
labels:
app: foo
name: foo
spec:
storageNodeConnector:
type: mysql
version: 5.1.47
serverVersion: 5.3.1
replicas: 1
selector:
matchLabels:
app: foo
portBindings:
- name: server
containerPort: 3307
servicePort: 3307
protocol: TCP
serviceType: ClusterIP
bootstrap:
serverConfig:
authority:
privilege:
type: ALL_PERMITTED
users:
- user: root%
password: root
mode:
type: Cluster
repository:
type: ZooKeeper
props:
timeToLiveSeconds: "600"
server-lists: shardingsphere-operator-zookeeper.default:2181
retryIntervalMilliseconds: "500"
operationTimeoutMilliseconds: "5000"
namespace: governance_ds
maxRetries: "3"
props:
proxy-frontend-database-protocol-type: MySQL
kubectl apply -f foo.yml


上述示例可以 Github 仓库中的找到:
https://github.com/apache/shardingsphere-on-cloud/blob/main/examples/operator
其他改进
本次发布的其它更新有:
在 ShardingSphereProxy CRD 的 Annotation 中增加对滚动升级参数的支持 #172 修复 ShardingSphereProxy Status 字段中 readyNodes 和 Conditions 在某些场景中错误的问题 #177 向 ComputeNode 引入 scale 子资源以支持 kubectl scale #189 将 ComputeNode 和 ShardingSphereProxy 构造和更新逻辑分离 #182 向 ComputeNode 定义中反写 NodePort #187 修复非 MySQL 类型配置导致空指针异常的问题 #179 重构 Manager 配置逻辑,分离命令行配置 #192 修复 CI 中 Docker 构建过程 #173
社区建设
此次 ShardingSphere-On-Cloud 0.2.0 版本的发布,共有 2 位 Contributor 提交了 22 个 PR,感谢社区伙伴们的大力支持。
GitHub ID
🔖 mlycore
🔖 xuanyuan300
相关参考链接:
🔗 Apache ShardingSphere on Cloud 项目:https://github.com/apache/shardingsphere-on-cloud
🔗 设计提案:https://github.com/apache/shardingsphere-on-cloud/issues/166 ComputeNode
文章转载自ShardingSphere官微,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。




