Skip to main content
backup and restore

reference

  • https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/backup-restore-cr
  • https://github.com/pingcap/tidb-operator/blob/master/pkg/apis/pingcap/v1alpha1/types.go#L1912
  • https://asktug.com/t/topic/1042360

introduction

prepare

  1. optional: only for local storage
  2. requirements
    • for backup/restore by br, local:// protocol requires a local path in tikv to store the backup/restore files
    • therefore, we need to create a pvc to mount the local path in tikv
  3. prepare backup.pvc.yaml
    • apiVersion: v1
      kind: PersistentVolumeClaim
      metadata:
        name: tidb-cluster-backup-pvc
        namespace: tidb-cluster
      spec:
        accessModes:
          - ReadWriteMany
        resources:
          requests:
            storage: 20Gi
        storageClassName: ""
      
      
    • apply to the cluster
      • kubectl -n tidb-cluster apply -f backup.pvc.yaml
        
  4. patch the tidb cluster
    • kubectl -n tidb-cluster patch tidbcluster basic --type=merge -p '{"spec":{"tikv":{"additionalVolumes":[{"name":"backup","persistentVolumeClaim":{"claimName":"tidb-cluster-backup-pvc"}}],"additionalVolumeMounts":[{"name":"backup","mountPath":"/backup"}]}}}'
      
    • check and waiting for the cluster status to be ready
      • kubectl -n tidb-cluster get tidbcluster basic -w
        

ben.wangzAbout 1 min
benchmark for tidb mysql interface

reference

  • https://docs.pingcap.com/zh/tidb/stable/benchmark-tidb-using-sysbench

introduction

  1. What's TiDB MySQL interface
    • TiDB is a distributed SQL database that is compatible with the MySQL protocol. The TiDB MySQL interface allows users to interact with the TiDB database using familiar MySQL commands and tools. This compatibility enables seamless migration of existing MySQL applications to TiDB without significant code changes, providing users with a consistent experience while leveraging TiDB's scalability, high availability, and distributed capabilities.
  2. What's SysBench
    • SysBench is an open-source, cross-platform, and multi-threaded benchmarking tool designed to evaluate system performance under various load conditions. It supports a wide range of database systems, including MySQL, PostgreSQL, and TiDB. SysBench can simulate different types of database workloads, such as OLTP (Online Transaction Processing) and OLAP (Online Analytical Processing), helping users to measure the performance of their database systems, identify bottlenecks, and optimize configurations.

ben.wangzLess than 1 minute
TiDB monitor and alerts

reference

  • https://docs.pingcap.com/zh/tidb/stable/tidb-monitoring-framework
  • https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/monitor-a-tidb-cluster

prepare the tidb-monitor.yaml

  • apiVersion: pingcap.com/v1alpha1
    kind: TidbMonitor
    metadata:
      name: basic
    spec:
      clusters:
        - name: basic
      prometheus:
        baseImage: m.daocloud.io/docker.io/prom/prometheus
        version: v2.27.1
      grafana:
        baseImage: m.daocloud.io/docker.io/grafana/grafana
        version: 7.5.11
        usernameSecret:
          name: basic-grafana-credentials
          key: username
        passwordSecret:
          name: basic-grafana-credentials
          key: password
      initializer:
        baseImage: m.daocloud.io/docker.io/pingcap/tidb-monitor-initializer
        version: v8.5.0
      reloader:
        baseImage: m.daocloud.io/docker.io/pingcap/tidb-monitor-reloader
        version: v1.0.1
      prometheusReloader:
        baseImage: m.daocloud.io/quay.io/prometheus-operator/prometheus-config-reloader
        version: v0.49.0
      imagePullPolicy: IfNotPresent
    
    

ben.wangzLess than 1 minute
tidb scale in and out

reference

  • https://docs.pingcap.com/zh/tidb-in-kubernetes/stable/scale-a-tidb-cluster/

introduction

  • Horizontal scaling of TiDB is achieved by increasing or decreasing the number of Pods, and operations on PD, TiKV, and TiDB will be carried out in the order of the replicas value.
    • Scaling In: Decrease the replicas value of the component, and delete component Pods in descending order of the Pod number.
    • Scaling Out: Increase the replicas value of the component, and add component Pods in ascending order of the Pod number.

ben.wangzLess than 1 minute
intro

Wang Zhi

  • email: ben.wangz@foxmail.com
  • blog: https://blog.geekcity.tech

Summary

  • experienced Java developer with 8+ years of expertise in designing and implementing scalable data processing platforms.
  • proficient in Apache Flink, Kubernetes, and handling large volumes of data.
  • proven ability to lead teams and deliver high-performance systems.
  • achieved developing data processing platforms for various companies, including Alibaba Group, ZhejiangLab and tianrang-inc.

ben.wangzAbout 3 min
commands

what

  • record some useful commands

ben.wangzLess than 1 minutecommandslinuxshelltool
git

init global config

git config --global user.name "ben.wangz"
git config --global user.email ben.wangz@foxmail.com
git config --global pager.branch false
git config --global pull.ff only
git --no-pager diff

ben.wangzLess than 1 minute
java

show gc info

jstat -gcutil $pid 1000 100

ben.wangzLess than 1 minute