场景
- TiKV-server 需要更换磁盘类型
- TiKV-server 扩容不同磁盘类型
参考文档
- 官方文档 https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/deploy-heterogeneous-tidb-cluster 为已有 TiDB 集群部署异构集群
模拟步骤
kubectl get pv
for i in $(seq 1 10); do
sudo mkdir -p /home/vol${i} /mnt/disks/${DISK_UUID}_vol${i}
sudo mount --bind /home/vol${i} /mnt/disks/${DISK_UUID}_vol${i}
done
for i in $(seq 1 10); do
echo /home/vol${i} /mnt/disks/${DISK_UUID}_vol${i} none bind 0 0 sudo tee -a /etc/fstab
done
使用 diff 查看配置前后不同项
kubectl get tc -n cluster-name-ryl
kubectl get pod -n cluster-name-ryl
[root@m4136 ryl]# cat cluster-tikv.yaml (格式显示无缩进,请查看图片)
apiVersion: pingcap.com/v1alpha1
kind: TidbCluster
metadata:
name: tidboperator-ryl-new
spec:
configUpdateStrategy: RollingUpdate
version: v4.0.9
timezone: UTC
pvReclaimPolicy: Delete
discovery: {}
cluster:
name: tidboperator-ryl
tikv:
baseImage: pingcap/tikv
replicas: 1
if storageClassName is not set, the default Storage Class of the Kubernetes cluster will be used
storageClassName: nvme-storage
requests:
storage: “1Gi”
config: {}
- 执行命令 kubectl create -f cluster-tikv.yaml -n cluster-name-ryl
- 查看结果
[root@m4136 ryl]# kubectl get pod -n cluster-name-ryl
[root@m4136 ryl]# kubectl get service -n cluster-name-ryl
备注
- 如果是原 TiKV-server 更换磁盘类型,需要扩缩容两次,把原来的 storageclass 改为需要的。