Documentation ¶
Index ¶
- Constants
- func DefineBackupFlags(flags *pflag.FlagSet)
- func DefineCommonFlags(flags *pflag.FlagSet)
- func DefineDatabaseFlags(command *cobra.Command)
- func DefineFilterFlags(command *cobra.Command)
- func DefineLogRestoreFlags(command *cobra.Command)
- func DefineRawBackupFlags(command *cobra.Command)
- func DefineRawRestoreFlags(command *cobra.Command)
- func DefineRestoreCommonFlags(flags *pflag.FlagSet)
- func DefineRestoreFlags(flags *pflag.FlagSet)
- func DefineTableFlags(command *cobra.Command)
- func GetKeepalive(cfg *Config) keepalive.ClientParameters
- func GetStorage(ctx context.Context, cfg *Config) (*backuppb.StorageBackend, storage.ExternalStorage, error)
- func LogArguments(cmd *cobra.Command)
- func NewMgr(ctx context.Context, g glue.Glue, pds []string, tlsConfig TLSConfig, ...) (*conn.Mgr, error)
- func ParseTLSTripleFromFlags(flags *pflag.FlagSet) (ca, cert, key string, err error)
- func ReadBackupMeta(ctx context.Context, fileName string, cfg *Config) (*backuppb.StorageBackend, storage.ExternalStorage, *backuppb.BackupMeta, error)
- func RunBackup(c context.Context, g glue.Glue, cmdName string, cfg *BackupConfig) error
- func RunBackupRaw(c context.Context, g glue.Glue, cmdName string, cfg *RawKvConfig) error
- func RunLogRestore(c context.Context, g glue.Glue, cfg *LogRestoreConfig) error
- func RunRestore(c context.Context, g glue.Glue, cmdName string, cfg *RestoreConfig) error
- func RunRestoreRaw(c context.Context, g glue.Glue, cmdName string, cfg *RestoreRawConfig) (err error)
- type BackupConfig
- type CompressionConfig
- type Config
- type LogRestoreConfig
- type RawKvConfig
- type RestoreCommonConfig
- type RestoreConfig
- type RestoreRawConfig
- type TLSConfig
Constants ¶
const ( // FlagMergeRegionSizeBytes is the flag name of merge small regions by size FlagMergeRegionSizeBytes = "merge-region-size-bytes" // FlagMergeRegionKeyCount is the flag name of merge small regions by key count FlagMergeRegionKeyCount = "merge-region-key-count" )
Variables ¶
This section is empty.
Functions ¶
func DefineBackupFlags ¶
DefineBackupFlags defines common flags for the backup command.
func DefineCommonFlags ¶
DefineCommonFlags defines the flags common to all BRIE commands.
func DefineDatabaseFlags ¶
DefineDatabaseFlags defines the required --db flag for `db` subcommand.
func DefineFilterFlags ¶
DefineFilterFlags defines the --filter and --case-sensitive flags for `full` subcommand.
func DefineLogRestoreFlags ¶
DefineLogRestoreFlags defines common flags for the backup command.
func DefineRawBackupFlags ¶
DefineRawBackupFlags defines common flags for the backup command.
func DefineRawRestoreFlags ¶
DefineRawRestoreFlags defines common flags for the backup command.
func DefineRestoreCommonFlags ¶
DefineRestoreCommonFlags defines common flags for the restore command.
func DefineRestoreFlags ¶
DefineRestoreFlags defines common flags for the restore tidb command.
func DefineTableFlags ¶
DefineTableFlags defines the required --db and --table flags for `table` subcommand.
func GetKeepalive ¶
func GetKeepalive(cfg *Config) keepalive.ClientParameters
GetKeepalive get the keepalive info from the config.
func GetStorage ¶
func GetStorage( ctx context.Context, cfg *Config, ) (*backuppb.StorageBackend, storage.ExternalStorage, error)
GetStorage gets the storage backend from the config.
func LogArguments ¶
LogArguments prints origin command arguments.
func NewMgr ¶
func NewMgr(ctx context.Context, g glue.Glue, pds []string, tlsConfig TLSConfig, keepalive keepalive.ClientParameters, checkRequirements bool, needDomain bool, ) (*conn.Mgr, error)
NewMgr creates a new mgr at the given PD address.
func ParseTLSTripleFromFlags ¶
ParseTLSTripleFromFlags parses the (ca, cert, key) triple from flags.
func ReadBackupMeta ¶
func ReadBackupMeta( ctx context.Context, fileName string, cfg *Config, ) (*backuppb.StorageBackend, storage.ExternalStorage, *backuppb.BackupMeta, error)
ReadBackupMeta reads the backupmeta file from the storage.
func RunBackupRaw ¶
RunBackupRaw starts a backup task inside the current goroutine.
func RunLogRestore ¶
RunLogRestore starts a restore task inside the current goroutine.
func RunRestore ¶
RunRestore starts a restore task inside the current goroutine.
func RunRestoreRaw ¶
func RunRestoreRaw(c context.Context, g glue.Glue, cmdName string, cfg *RestoreRawConfig) (err error)
RunRestoreRaw starts a raw kv restore task inside the current goroutine.
Types ¶
type BackupConfig ¶
type BackupConfig struct { Config TimeAgo time.Duration `json:"time-ago" toml:"time-ago"` BackupTS uint64 `json:"backup-ts" toml:"backup-ts"` LastBackupTS uint64 `json:"last-backup-ts" toml:"last-backup-ts"` GCTTL int64 `json:"gc-ttl" toml:"gc-ttl"` RemoveSchedulers bool `json:"remove-schedulers" toml:"remove-schedulers"` IgnoreStats bool `json:"ignore-stats" toml:"ignore-stats"` CompressionConfig }
BackupConfig is the configuration specific for backup tasks.
func (*BackupConfig) ParseFromFlags ¶
func (cfg *BackupConfig) ParseFromFlags(flags *pflag.FlagSet) error
ParseFromFlags parses the backup-related flags from the flag set.
type CompressionConfig ¶
type CompressionConfig struct { CompressionType backuppb.CompressionType `json:"compression-type" toml:"compression-type"` CompressionLevel int32 `json:"compression-level" toml:"compression-level"` }
CompressionConfig is the configuration for sst file compression.
type Config ¶
type Config struct { storage.BackendOptions Storage string `json:"storage" toml:"storage"` PD []string `json:"pd" toml:"pd"` TLS TLSConfig `json:"tls" toml:"tls"` RateLimit uint64 `json:"rate-limit" toml:"rate-limit"` ChecksumConcurrency uint `json:"checksum-concurrency" toml:"checksum-concurrency"` Concurrency uint32 `json:"concurrency" toml:"concurrency"` Checksum bool `json:"checksum" toml:"checksum"` SendCreds bool `json:"send-credentials-to-tikv" toml:"send-credentials-to-tikv"` // LogProgress is true means the progress bar is printed to the log instead of stdout. LogProgress bool `json:"log-progress" toml:"log-progress"` // CaseSensitive should not be used. // // Deprecated: This field is kept only to satisfy the cyclic dependency with TiDB. This field // should be removed after TiDB upgrades the BR dependency. CaseSensitive bool // NoCreds means don't try to load cloud credentials NoCreds bool `json:"no-credentials" toml:"no-credentials"` CheckRequirements bool `json:"check-requirements" toml:"check-requirements"` // EnableOpenTracing is whether to enable opentracing EnableOpenTracing bool `json:"enable-opentracing" toml:"enable-opentracing"` // SkipCheckPath skips verifying the path SkipCheckPath bool `json:"skip-check-path" toml:"skip-check-path"` // Filter should not be used, use TableFilter instead. // // Deprecated: This field is kept only to satisfy the cyclic dependency with TiDB. This field // should be removed after TiDB upgrades the BR dependency. Filter filter.MySQLReplicationRules TableFilter filter.Filter `json:"-" toml:"-"` SwitchModeInterval time.Duration `json:"switch-mode-interval" toml:"switch-mode-interval"` // GrpcKeepaliveTime is the interval of pinging the server. GRPCKeepaliveTime time.Duration `json:"grpc-keepalive-time" toml:"grpc-keepalive-time"` // GrpcKeepaliveTimeout is the max time a grpc conn can keep idel before killed. GRPCKeepaliveTimeout time.Duration `json:"grpc-keepalive-timeout" toml:"grpc-keepalive-timeout"` }
Config is the common configuration for all BRIE tasks.
type LogRestoreConfig ¶
type LogRestoreConfig struct { Config StartTS uint64 EndTS uint64 BatchFlushKVPairs int BatchFlushKVSize int64 BatchWriteKVPairs int }
LogRestoreConfig is the configuration specific for restore tasks.
func (*LogRestoreConfig) ParseFromFlags ¶
func (cfg *LogRestoreConfig) ParseFromFlags(flags *pflag.FlagSet) error
ParseFromFlags parses the restore-related flags from the flag set.
type RawKvConfig ¶
type RawKvConfig struct { Config StartKey []byte `json:"start-key" toml:"start-key"` EndKey []byte `json:"end-key" toml:"end-key"` CF string `json:"cf" toml:"cf"` CompressionConfig RemoveSchedulers bool `json:"remove-schedulers" toml:"remove-schedulers"` }
RawKvConfig is the common config for rawkv backup and restore.
func (*RawKvConfig) ParseBackupConfigFromFlags ¶
func (cfg *RawKvConfig) ParseBackupConfigFromFlags(flags *pflag.FlagSet) error
ParseBackupConfigFromFlags parses the backup-related flags from the flag set.
func (*RawKvConfig) ParseFromFlags ¶
func (cfg *RawKvConfig) ParseFromFlags(flags *pflag.FlagSet) error
ParseFromFlags parses the raw kv backup&restore common flags from the flag set.
type RestoreCommonConfig ¶
type RestoreCommonConfig struct { Online bool `json:"online" toml:"online"` // MergeSmallRegionSizeBytes is the threshold of merging small regions (Default 96MB, region split size). // MergeSmallRegionKeyCount is the threshold of merging smalle regions (Default 960_000, region split key count). // See https://github.com/tikv/tikv/blob/v4.0.8/components/raftstore/src/coprocessor/config.rs#L35-L38 MergeSmallRegionSizeBytes uint64 `json:"merge-region-size-bytes" toml:"merge-region-size-bytes"` MergeSmallRegionKeyCount uint64 `json:"merge-region-key-count" toml:"merge-region-key-count"` }
RestoreCommonConfig is the common configuration for all BR restore tasks.
func (*RestoreCommonConfig) ParseFromFlags ¶
func (cfg *RestoreCommonConfig) ParseFromFlags(flags *pflag.FlagSet) error
ParseFromFlags parses the config from the flag set.
type RestoreConfig ¶
type RestoreConfig struct { Config RestoreCommonConfig NoSchema bool `json:"no-schema" toml:"no-schema"` }
RestoreConfig is the configuration specific for restore tasks.
func (*RestoreConfig) ParseFromFlags ¶
func (cfg *RestoreConfig) ParseFromFlags(flags *pflag.FlagSet) error
ParseFromFlags parses the restore-related flags from the flag set.
type RestoreRawConfig ¶
type RestoreRawConfig struct { RawKvConfig RestoreCommonConfig }
RestoreRawConfig is the configuration specific for raw kv restore tasks.
func (*RestoreRawConfig) ParseFromFlags ¶
func (cfg *RestoreRawConfig) ParseFromFlags(flags *pflag.FlagSet) error
ParseFromFlags parses the backup-related flags from the flag set.
type TLSConfig ¶
type TLSConfig struct { CA string `json:"ca" toml:"ca"` Cert string `json:"cert" toml:"cert"` Key string `json:"key" toml:"key"` }
TLSConfig is the common configuration for TLS connection.
func (*TLSConfig) ParseFromFlags ¶
ParseFromFlags parses the TLS config from the flag set.