当前位置:网站首页>Introduction to backup and recovery Cr
Introduction to backup and recovery Cr
2022-07-06 08:02:00 【Tianxiang shop】
This document describes Backup、Restore And BackupSchedule Custom Resource (CR) Fields of resources , Make sure you are better at Kubernetes Upper TiDB The cluster performs data backup and data recovery .
Backup CR Field is introduced
In order to Kubernetes Upper TiDB Cluster data backup , Users can create a customized Backup CR Object to describe a backup , For specific backup process, please refer to The data backup Documents listed in . The following is an introduction Backup CR The specific meaning of each field .
Introduction to general fields
.spec.metadata.namespace:BackupCR Where namespace..spec.toolImage: Is used to specify theBackupUse tools to mirror .TiDB Operator from v1.1.9 It supports this configuration .- Use BR When the backup , You can use this field to specify BR Version of :
- If not specified or empty , Image is used by default
pingcap/br:${tikv_version}Make a backup . - If you specify BR Version of , for example
.spec.toolImage: pingcap/br:v5.3.0, Then use the specified version image for backup . - If a mirror is specified but no version is specified , for example
.spec.toolImage: private/registry/br, Then use imageprivate/registry/br:${tikv_version}Make a backup .
- If not specified or empty , Image is used by default
- Use Dumpling When the backup , You can use this field to specify Dumpling Version of :
- If you specify Dumpling Version of , for example
spec.toolImage: pingcap/dumpling:v5.3.0, Then use the specified version image for backup . - If not specified , By default Backup Manager Dockerfile In file
TOOLKIT_VERSIONdesignated Dumpling Version .
- If you specify Dumpling Version of , for example
- Use BR When the backup , You can use this field to specify BR Version of :
.spec.backupType: Appoint Backup type , This field is only used BR Valid during backup , Currently, the following three types are supported , Can combine.spec.tableFilterConfigure table library filtering rules :full: Yes TiDB Cluster all of database Data backup .db: Yes TiDB Cluster one database Perform a backup of your data .table: Yes TiDB The data of the specified table in the cluster is backed up .
.spec.tikvGCLifeTime: Temporary in backuptikv_gc_life_timeSet the time , The default is72h.Before the backup starts , if TiDB Clustered
tikv_gc_life_timeLess than the user setspec.tikvGCLifeTime, To ensure that the backed up data is not TiKV GC fall ,TiDB Operator Before backup Adjust the tikv_gc_life_time byspec.tikvGCLifeTime.After backup , Success or failure , If the old
tikv_gc_life_timeLess than the setting.spec.tikvGCLifeTime,TiDB Operator Will try to recovertikv_gc_life_timeIs the old value before backup . In extreme cases , If TiDB Operator Failed to access database ,TiDB Operator Will not automatically recovertikv_gc_life_timeAnd think the backup failed .here , You can view the current through the following statement TiDB Clustered
tikv_gc_life_time:select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc_life_time";If you find that
tikv_gc_life_timeOvervalued ( Usually it is 10m), You need to follow Adjust the tikv_gc_life_time taketikv_gc_life_timeReturn to the original ..spec.cleanPolicy: Delete after backing up the cluster Backup CR Backup file cleanup strategy . Currently, three cleaning strategies are supported :Retain: In any case , Delete Backup CR The files backed up will be preserved .Delete: In any case , Delete Backup CR The files backed up will be deleted .OnFailure: If the backup fails , Delete Backup CR The files backed up will be deleted .If this field is not configured , Or configure the value of this field to be a value other than the above three , The files backed up will be preserved . It is worth noting that , stay v1.1.2 And previous versions do not exist in this field , And it is deleted by default CR Delete the backed up files at the same time . if v1.1.3 And later versions of users want to maintain this behavior , You need to set this field to
Delete.
.spec.cleanOption: Delete after backing up the cluster Backup CR Backup file cleanup behavior when . For more instructions, see Clean up backup files.spec.from.host: Standby TiDB The access address of the cluster , For those that need to be exported TiDB Of service name, for examplebasic-tidb..spec.from.port: Standby TiDB Access port of the cluster ..spec.from.user: Standby TiDB Access users of the cluster ..spec.from.secretName: Storage.spec.from.userThe user's password Secret..spec.from.tlsClientSecretName: Specify the storage certificate used for backup Secret.If TiDB The cluster is on TLS, But I don't want to use file Created in the
${cluster_name}-cluster-client-secretMake a backup , This parameter can be used to specify a Secret, It can be generated by the following command :kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path}.spec.storageClassName: Required for backup persistent volume (PV) type ..spec.storageSize: Specify the required PV size , The default is 100 GiB. This value should be greater than the backup TiDB The size of the cluster data . One TiDB Clustered Backup CR Corresponding PVC The name is certain , If the... Already exists in the cluster namespace PVC And its size is less than.spec.storageSize, At this time, you need to delete this PVC Run again Backup job..spec.resources: Specify the Pod Resource request and upper limit of ..spec.env: Specify the Pod Information about environment variables ..spec.affinity: Specify the Pod Affinity configuration , About affinity Instructions for use , see also Affinity & AntiAffinity..spec.tolerations: Specify the Pod Can be scheduled to have matching The stain (Taint) Node . More about stains and tolerance , see also Taints and Tolerations..spec.podSecurityContext: Specify the Pod Security context configuration , allow Pod In a root Run as a user , About podSecurityContext More about , see also In a root User run container ..spec.priorityClassName: Specify the Pod Of priorityClass The name of , To set the running priority , About priorityClass More about , see also Pod Priority and Preemption..spec.imagePullSecrets: Specify the Pod Of imagePullSecrets.spec.serviceAccount: Specify the ServiceAccount name ..spec.useKMS: Specify whether to use AWS-KMS Decrypt the backup using S3 Storage key ..spec.tableFilter: During backup, specify Dumpling perhaps BR Backup compliance table-filter The rules Table of . By default, this field can be configured without .When not configured , If you use Dumpling Backup ,
tableFilterThe default values of the fields are as follows :tableFilter: - "*.*" - "!/^(mysql|test|INFORMATION_SCHEMA|PERFORMANCE_SCHEMA|METRICS_SCHEMA|INSPECTION_SCHEMA)$/.*"When not configured , If you use BR Backup ,BR All databases except the system library will be backed up .
Be careful
If you want to use exclusion rules
"!db.table"Export Divisiondb.tableAll the watches of , So in"!db.table"You must add*.*The rules . As shown in the following example :tableFilter: - "*.*" - "!db.table"
BR Field is introduced
.spec.br.cluster: Represents the name of the cluster that needs to be backed up ..spec.br.clusterNamespace: Represents the location of the cluster that needs to be backed upnamespace..spec.br.logLevel: Represents the level of the log . The default isinfo..spec.br.statusAddr: by BR A process listens for the state of a process HTTP port , It is convenient for users to debug . If you don't fill in , The default is not to listen ..spec.br.concurrency: When backing up each TiKV Number of threads used by the process . The default is 4, It defaults to 128..spec.br.rateLimit: Whether to limit the flow . Unit is MB/s, For example, set to4Represents speed limit 4 MB/s, No speed limit by default ..spec.br.checksum: Whether to verify the file after the backup . The default istrue..spec.br.timeAgo: Backup timeAgo Previous data , The default is empty. ( Back up the current data ), Support "1.5h","2h45m" Data such as ..spec.br.sendCredToTikv:BR Whether the process will own AWS jurisdiction 、GCP Authority or Azure Permissions are transferred to TiKV process . The default istrue..spec.br.onLine:restore Whether to enable Online recovery function ..spec.br.options:BR Additional parameters supported by the tool , It needs to be passed in the form of string array . since v1.1.6 This parameter is supported since version . Can be used to specifylastbackuptsFor incremental backup .
S3 Storage field introduction
.spec.s3.provider: Supported compatibility S3 Ofprovider.More supported compatibility S3 Of
provideras follows :alibaba:Alibaba Cloud Object Storage System (OSS),formerly Aliyundigitalocean:Digital Ocean Spacesdreamhost:Dreamhost DreamObjectsibmcos:IBM COS S3minio:Minio Object Storagenetease:Netease Object Storage (NOS)wasabi:Wasabi Object Storageother:Any other S3 compatible provider
.spec.s3.region: Use Amazon S3 Store backup , Need configuration Amazon S3 Where region..spec.s3.bucket: compatible S3 Stored bucket name ..spec.s3.prefix: If this field is set , This field will be used to splice the storage path stored at the remote ends3://${.spec.s3.bucket}/${.spec.s3.prefix}/backupName..spec.s3.path: Specify the storage path where the backup file is stored remotely , This field is only used Dumpling Back up or Lightning Effective upon recovery , for examples3://test1-demo1/backup-2019-12-11T04:32:12Z.tgz..spec.s3.endpoint: compatible S3 Storage services for endpoint, for examplehttp://minio.minio.svc.cluster.local:9000..spec.s3.secretName: Access compatibility S3 Stored key information ( contain access key and secret key) Of Secret name ..spec.s3.sse: Appoint S3 Server encryption method , for exampleaws:kms..spec.s3.acl: Supported by access-control list (ACL) Strategy .Amazon S3 The following are supported access-control list (ACL) Strategy :
privatepublic-readpublic-read-writeauthenticated-readbucket-owner-readbucket-owner-full-controlIf not set ACL Strategy , It is used by default
privateStrategy .ACL Detailed introduction of strategy , Reference resources AWS Official documents .
.spec.s3.storageClass: Supported bystorageClasstype .Amazon S3 The following are supported
storageClasstype :STANDARDREDUCED_REDUNDANCYSTANDARD_IAONEZONE_IAGLACIERDEEP_ARCHIVEIf not set
storageClass, It is used by defaultSTANDARD_IA.storageClassDetailed introduction , Reference resources AWS Official documents .
GCS Storage field introduction
.spec.gcs.projectId: representative GCP Unique identification of the user item on . For specific methods of obtaining this identification, please refer to GCP Official documents ..spec.gcs.location: Appoint GCS bucket The area , for exampleus-west2..spec.gcs.path: Specify the storage path where the backup file is stored remotely , This field is only used Dumpling Back up or Lightning Effective upon recovery , for examplegcs://test1-demo1/backup-2019-11-11T16:06:05Z.tgz..spec.gcs.secretName: Specify storage GCS User account authentication information Secret name ..spec.gcs.bucket: Storing data bucket name ..spec.gcs.prefix: If this field is set , This field will be used to splice the storage path stored at the remote endgcs://${.spec.gcs.bucket}/${.spec.gcs.prefix}/backupName..spec.gcs.storageClass:GCS The following are supportedstorageClasstype :MULTI_REGIONALREGIONALNEARLINECOLDLINEDURABLE_REDUCED_AVAILABILITYIf not set
storageClass, It is used by defaultCOLDLINE. For a detailed introduction of these storage types, please refer to GCS Official documents .
.spec.gcs.objectAcl: Set up object access-control list (ACL) Strategy .GCS The following are supported ACL Strategy :
authenticatedReadbucketOwnerFullControlbucketOwnerReadprivateprojectPrivatepublicReadIf not set object ACL Strategy , It is used by default
privateStrategy .ACL Detailed introduction of strategy , Reference resources GCS Official documents .
.spec.gcs.bucketAcl: Set up bucket access-control list (ACL) Strategy .GCS The following are supported bucket ACL Strategy :
authenticatedReadprivateprojectPrivatepublicReadpublicReadWriteIf not set bucket ACL Strategy , The default policy is
private.ACL Detailed introduction of strategy , Reference resources GCS Official documents .
Azure Blob Storage Storage field introduction
.spec.azblob.secretName: Specify storage Azure Blob Storage User account authentication information Secret name ..spec.azblob.container: Storing data container name ..spec.azblob.prefix: If this field is set , This field will be used to splice the storage path stored at the remote endazure://${.spec.azblob.container}/${.spec.azblob.prefix}/backupName..spec.azblob.accessTier: The storage category of the uploaded object .Azure Blob Storage The following are supported
accessTiertype :HotCoolArchiveIf not set
accessTier, It is used by defaultCool.
Local Storage field introduction
.spec.local.prefix: Persistent volume storage directory . If this field is set , This field will be used to splice the storage path of the persistent volumelocal://${.spec.local.volumeMount.mountPath}/${.spec.local.prefix}/..spec.local.volume: Persistent volume configuration ..spec.local.volumeMount: Persistent volume mount configuration .
Restore CR Field is introduced
In order to Kubernetes Upper TiDB Cluster for data recovery , Users can create a customized Restore CR Object to describe a recovery , Refer to Introduction to backup and recovery Documents listed in . The following is an introduction Restore CR The specific meaning of each field .
.spec.metadata.namespace:RestoreCR Where namespace..spec.toolImage: Is used to specify theRestoreUse tools to mirror .TiDB Operator from v1.1.9 This configuration is supported since version .- Use BR When you recover , You can use this field to specify BR Version of . for example ,
spec.toolImage: pingcap/br:v5.3.0. If you don't specify , By defaultpingcap/br:${tikv_version}Resume . - Use Lightning When you recover , You can use this field to specify Lightning Version of , for example
spec.toolImage: pingcap/lightning:v5.3.0. If you don't specify , By default Backup Manager Dockerfile In fileTOOLKIT_VERSIONdesignated Lightning Version recovery .
- Use BR When you recover , You can use this field to specify BR Version of . for example ,
.spec.backupType: Appoint Restore type , This field is only used BR Effective upon recovery , Currently, the following three types are supported , Can combine.spec.tableFilterConfigure table library filtering rules :full: Yes TiDB Cluster all of database Data backup .db: Yes TiDB Cluster one database Perform a backup of your data .table: Yes TiDB The data of the cluster table is backed up .
.spec.tikvGCLifeTime: Temporary in data recoverytikv_gc_life_timeSet the time , The default is 72h.Before data recovery starts , if TiDB Clustered
tikv_gc_life_timeLess than the user setspec.tikvGCLifeTime, To ensure that the recovered data is not TiKV GC fall ,TiDB Operator Before recovery Adjust the tikv_gc_life_time byspec.tikvGCLifeTime.After data recovery , Success or failure , If the old
tikv_gc_life_timeLess than the setting.spec.tikvGCLifeTime,TiDB Operator Will try to settikv_gc_life_timeIs the old value before restoration . In extreme cases , If TiDB Operator Failed to access database ,TiDB Operator Will not automatically recovertikv_gc_life_timeAnd think that data recovery failed .here , You can view the current through the following statement TiDB Clustered
tikv_gc_life_time:select VARIABLE_NAME, VARIABLE_VALUE from mysql.tidb where VARIABLE_NAME like "tikv_gc_life_time";If you find that
tikv_gc_life_timeOvervalued ( Usually it is 10m), You need to follow Adjust the tikv_gc_life_time taketikv_gc_life_timeReturn to the original ..spec.to.host: To be restored TiDB The access address of the cluster ..spec.to.port: To be restored TiDB Access port of the cluster ..spec.to.user: To be restored TiDB Access users of the cluster ..spec.to.secretName: Storage.spec.to.userThe user's password secret..spec.to.tlsClientSecretName: Specify the name of the storage certificate used to restore the backup Secret.If TiDB The cluster is on TLS, But I don't want to use file Created in the
${cluster_name}-cluster-client-secretRestore backup , This parameter can be used to specify a Secret, It can be generated by the following command :kubectl create secret generic ${secret_name} --namespace=${namespace} --from-file=tls.crt=${cert_path} --from-file=tls.key=${key_path} --from-file=ca.crt=${ca_path}.spec.resources: Specify the Pod Resource request and upper limit of ..spec.env: Specify the Pod Information about environment variables ..spec.affinity: Specify the Pod Affinity configuration , About affinity Instructions for use , see also Affinity & AntiAffinity..spec.tolerations: Specify the Pod Can be scheduled to have matching The stain (Taint) Node . More about stains and tolerance , see also Taints and Tolerations..spec.podSecurityContext: Specify the Pod Security context configuration , allow Pod In a root Run as a user , About podSecurityContext More about , see also In a root User run container ..spec.priorityClassName: Specify the Pod Of priorityClass The name of , To set the running priority , About priorityClass More about , see also Pod Priority and Preemption..spec.imagePullSecrets: Specify the Pod Of imagePullSecrets.spec.serviceAccount: Specify the ServiceAccount name ..spec.useKMS: Specify whether to use AWS-KMS Decrypt the backup using S3 Storage key ..spec.storageClassName: Specify the PV type ..spec.storageSize: Specify the PV size . The value should be greater than TiDB The data size of the cluster backup ..spec.tableFilter: When restoring, specify BR Restore compliance table-filter The rules Table of . By default, this field can be configured without .When not configured , If you use TiDB Lightning recovery ,
tableFilterThe default values of the fields are as follows :tableFilter: - "*.*" - "!/^(mysql|test|INFORMATION_SCHEMA|PERFORMANCE_SCHEMA|METRICS_SCHEMA|INSPECTION_SCHEMA)$/.*"When not configured , If you use BR recovery ,BR All databases in the backup file will be restored .
Be careful
If you want to use exclusion rules
"!db.table"Export Divisiondb.tableAll the watches of , So in"!db.table"You must add*.*The rules . As shown in the following example :tableFilter: - "*.*" - "!db.table".spec.br:BR Related configuration , Specific introduction reference BR Field is introduced ..spec.s3:S3 Compatible with storage related configurations , Specific introduction reference S3 Field is introduced ..spec.gcs:GCS Storage related configuration , Specific introduction reference GCS Field is introduced ..spec.azblob:Azure Blob Storage Storage related configuration , Specific introduction reference Azure Blob Storage Field is introduced ..spec.local: Persistent volume storage related configurations , Specific introduction reference Local Field is introduced .
BackupSchedule CR Field is introduced
backupSchedule The configuration of consists of two parts . Part of it is backupSchedule Unique configuration , The other part is backupTemplate.backupTemplate Specify the configuration related to cluster and remote storage , Fields and Backup CR Medium spec equally , Please refer to Backup CR Field is introduced . Let's introduce backupSchedule Unique configuration items :
.spec.maxBackups: A backup retention policy , Determine the maximum number of backups that can be retained for scheduled backups . Exceed this number , The obsolete backup will be deleted . If the item is set to0, Then it means to keep all backups ..spec.maxReservedTime: A backup retention policy , Keep backups by time . For example, set this parameter to24h, Means to keep only the recent 24 Backup pieces within hours . Backups that exceed this time will be cleared . Time setting format reference func ParseDuration. If set at the same time.spec.maxBackupsand.spec.maxReservedTime, with.spec.maxReservedTimeSubject to ..spec.schedule:Cron Time scheduling format . Specific format can refer to Cron..spec.pause: Whether to pause scheduled backup , The default isfalse. If you set the value totrue, It means to pause scheduled backup , At this time, even if it reaches the specified point in time , There will be no backup . During the scheduled backup pause , Backup Garbage Collection (GC) Still normal . If you need to restart the scheduled full backup , taketrueChange it tofalse.
边栏推荐
- File upload of DVWA range
- The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
- Nc204382 medium sequence
- Solution: système de surveillance vidéo intelligent de patrouille sur le chantier
- Golang DNS 随便写写
- 1202 character lookup
- Step by step guide to setting NFT as an ens profile Avatar
- How to estimate the number of threads
- [Yugong series] February 2022 U3D full stack class 010 prefabricated parts
- Data governance: 3 characteristics, 4 transcendence and 3 28 principles of master data
猜你喜欢

Codeforces Global Round 19(A~D)

Uibehavior, a comprehensive exploration of ugui source code

861. Score after flipping the matrix

National economic information center "APEC industry +": economic data released at the night of the Spring Festival | observation of stable strategy industry fund

A Closer Look at How Fine-tuning Changes BERT

Artcube information of "designer universe": Guangzhou implements the community designer system to achieve "great improvement" of urban quality | national economic and Information Center

Qualitative risk analysis of Oracle project management system

继电反馈PID控制器参数自整定

Interview Reply of Zhuhai Jinshan
![[t31zl intelligent video application processor data]](/img/67/b77c1de990d9b8868f8df5e55b0227.png)
[t31zl intelligent video application processor data]
随机推荐
Onie supports pice hard disk
wincc7.5下载安装教程(Win10系统)
Solution: intelligent site intelligent inspection scheme video monitoring system
MEX有关的学习
[research materials] 2022 China yuancosmos white paper - Download attached
Flash return file download
esRally国内安装使用避坑指南-全网最新
好用的TCP-UDP_debug工具下载和使用
. Net 6 learning notes: what is NET Core
NFT smart contract release, blind box, public offering technology practice -- jigsaw puzzle
2.10transfrom attribute
Document 2 Feb 12 16:54
"Friendship and righteousness" of the center for national economy and information technology: China's friendship wine - the "unparalleled loyalty and righteousness" of the solidarity group released th
Uibehavior, a comprehensive exploration of ugui source code
Linked list interview questions (Graphic explanation)
matplotlib. Widgets are easy to use
Sanzi chess (C language)
[count] [combined number] value series
软件开发的一点随记
Hill sort c language