使用 Helm

使用 Helm 在 Kubernetes 集群中引导 ShardingSphere-Proxy 实例进行安装。

快速入门

helm repo add shardingsphere https://shardingsphere.apache.org/charts
helm install shardingsphere-proxy shardingsphere/apache-shardingsphere-proxy

操作步骤

必要条件

kubernetes 1.18+

kubectl

helm 3.2.0+

可以动态申请 PV(Persistent Volumes) 的 StorageClass 已持久化数据。

安装

在线安装

将 ShardingSphere-Proxy 添加到 Helm 本地仓库:

helm repo add shardingsphere https://shardingsphere.apache.org/charts

以 ShardingSphere-Proxy 命名安装 charts:

helm install shardingsphere-proxy shardingsphere/apache-shardingsphere-proxy

源码安装

cd apache-shardingsphere-proxy/charts/governance
helm dependency build 
cd ../..
helm dependency build 
cd ..
helm install shardingsphere-proxy apache-shardingsphere-proxy 

执行上述命令以执行默认配置进行安装。 其他的配置详见下方的配置列表。 执行 helm list 获取所有安装的 release。

卸载

helm uninstall shardingsphere-proxy

默认删除所有发布记录,增加 --keep-history 参数保留发布记录。

配置项

治理节点配置项

配置项描述
governance.enabled用来切换是否使用治理节点的 charttrue

治理节点--ZooKeeper 配置项

配置项描述
governance.zookeeper.enabled用来切换是否使用 ZooKeeper 的 charttrue
governance.zookeeper.replicaCountZooKeeper 节点数量1
governance.zookeeper.persistence.enabled标识 ZooKeeper 是否使用持久卷申领 (PersistentVolumeClaim) 用来申请持久卷(PersistentVolume)false
governance.zookeeper.persistence.storageClass持久卷(PersistentVolume)的存储类 (StorageClass)""
governance.zookeeper.persistence.accessModes持久卷(PersistentVolume)的访问模式["ReadWriteOnce"]
governance.zookeeper.persistence.size持久卷(PersistentVolume) 大小8Gi
governance.zookeeper.resources.limitsZooKeeper 容器的资源限制{}
governance.zookeeper.resources.requests.memoryZooKeeper 容器申请的内存256Mi
governance.zookeeper.resources.requests.cpuZooKeeper 容器申请的 cpu 核数250m

计算节点--ShardingSphere-Proxy 配置项

配置项描述
compute.image.repositoryShardingSphere-Proxy 的镜像名apache/shardingsphere-proxy
compute.image.pullPolicyShardingSphere-Proxy 镜像拉取策略IfNotPresent
compute.image.tagShardingSphere-Proxy 镜像标签5.1.2
compute.imagePullSecrets拉取私有仓库的凭证[]
compute.resources.limitsShardingSphere-Proxy 容器的资源限制{}
compute.resources.requests.memoryShardingSphere-Proxy 容器申请的内存2Gi
compute.resources.requests.cpuShardingSphere-Proxy 容器申请的 cpu 核数200m
compute.replicasShardingSphere-Proxy 节点个数3
compute.service.typeShardingSphere-Proxy 网络模式ClusterIP
compute.service.portShardingSphere-Proxy 暴露端口3307
compute.mysqlConnector.versionMySQL 驱动版本5.1.49
compute.startPortShardingSphere-Proxy 启动端口3307
compute.serverConfigShardingSphere-Proxy 模式配置文件""