Documentation
¶
Index ¶
- 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 DefineRestoreFlags(flags *pflag.FlagSet)
- func DefineTableFlags(command *cobra.Command)
- func GetKeepalive(cfg *Config) keepalive.ClientParameters
- func GetStorage(ctx context.Context, cfg *Config) (*backup.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 ReadBackupMeta(ctx context.Context, fileName string, cfg *Config) (*backup.StorageBackend, storage.ExternalStorage, *backup.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 RestoreConfig
- type RestoreRawConfig
- type TLSConfig
Constants ¶
This section is empty.
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 DefineRestoreFlags ¶
DefineRestoreFlags defines common flags for the restore 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, ) (*backup.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) (*conn.Mgr, error)
NewMgr creates a new mgr at the given PD address.
func ReadBackupMeta ¶
func ReadBackupMeta( ctx context.Context, fileName string, cfg *Config, ) (*backup.StorageBackend, storage.ExternalStorage, *backup.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 kvproto.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
// 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:"-"`
CheckRequirements bool `json:"check-requirements" toml:"check-requirements"`
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 RestoreConfig ¶
type RestoreConfig struct {
Config
Online bool `json:"online" toml:"online"`
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
Online bool `json:"online" toml:"online"`
}
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.