backup

package
v1.6.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 30, 2022 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeFormatForBackup - default backup name format
	TimeFormatForBackup = "2006-01-02T15-04-05"
	MetaFileName        = "metadata.json"
)

Variables

View Source
var (
	ErrBackupIsAlreadyExists = errors.New("backup is already exists")
)
View Source
var (
	// ErrUnknownClickhouseDataPath -
	ErrUnknownClickhouseDataPath = errors.New("clickhouse data path is unknown, you can set data_path in config file")
)
View Source
var UUIDWithReplicatedMergeTreeRE = regexp.MustCompile(`^(.+)(UUID)(\s+)'([^']+)'(.+)({uuid})(.*)`)

Functions

func AddTableToBackup added in v1.0.0

func AddTableToBackup(ch *clickhouse.ClickHouse, backupName, shadowBackupUUID string, diskList []clickhouse.Disk, table *clickhouse.Table, partitionsToBackupMap common.EmptyMap) (map[string][]metadata.Part, map[string]int64, error)

func Clean

func Clean(cfg *config.Config) error

Clean - removed all data in shadow folder

func CreateBackup

func CreateBackup(cfg *config.Config, backupName, tablePattern string, partitions []string, schemaOnly, rbacOnly, configsOnly bool, version string) error

CreateBackup - create new backup of all tables matched by tablePattern If backupName is empty string will use default backup name

func GetRemoteBackups

func GetRemoteBackups(cfg *config.Config, parseMetadata bool) ([]storage.Backup, error)

GetRemoteBackups - get all backups stored on remote storage

func GetTables

func GetTables(cfg *config.Config) ([]clickhouse.Table, error)

GetTables - get all tables for use by PrintTables and API

func IsInformationSchema added in v1.2.3

func IsInformationSchema(database string) bool

func NewBackupName

func NewBackupName() string

NewBackupName - return default backup name

func PrintAllBackups added in v1.0.0

func PrintAllBackups(cfg *config.Config, format string) error

func PrintLocalBackups

func PrintLocalBackups(cfg *config.Config, format string) error

PrintLocalBackups - print all backups stored locally

func PrintRemoteBackups

func PrintRemoteBackups(cfg *config.Config, format string) error

PrintRemoteBackups - print all backups stored on remote storage

func PrintTables

func PrintTables(cfg *config.Config, printAll bool) error

PrintTables - print all tables suitable for backup

func RemoveBackupLocal

func RemoveBackupLocal(cfg *config.Config, backupName string, disks []clickhouse.Disk) error

func RemoveBackupRemote

func RemoveBackupRemote(cfg *config.Config, backupName string) error

func RemoveOldBackupsLocal

func RemoveOldBackupsLocal(cfg *config.Config, keepLastBackup bool, disks []clickhouse.Disk) error

func Restore

func Restore(cfg *config.Config, backupName string, tablePattern string, partitions []string, schemaOnly, dataOnly, dropTable, rbacOnly, configsOnly bool) error

Restore - restore tables matched by tablePattern from backupName

func RestoreData

func RestoreData(cfg *config.Config, ch *clickhouse.ClickHouse, backupName string, tablePattern string, partitionsToRestore common.EmptyMap, disks []clickhouse.Disk) error

RestoreData - restore data for tables matched by tablePattern from backupName

func RestoreSchema

func RestoreSchema(cfg *config.Config, ch *clickhouse.ClickHouse, backupName string, tablePattern string, dropTable bool, disks []clickhouse.Disk) error

RestoreSchema - restore schemas matched by tablePattern from backupName

Types

type BackupLocal added in v1.0.0

type BackupLocal struct {
	metadata.BackupMetadata
	Legacy bool
	Broken string
}

func GetBackupsToDelete added in v1.0.0

func GetBackupsToDelete(backups []BackupLocal, keep int) []BackupLocal

func GetLocalBackups added in v1.0.0

func GetLocalBackups(cfg *config.Config, disks []clickhouse.Disk) ([]BackupLocal, []clickhouse.Disk, error)

GetLocalBackups - return slice of all backups stored locally

type Backuper added in v1.0.0

type Backuper struct {
	Version         string
	DiskToPathMap   map[string]string
	DefaultDataPath string
	// contains filtered or unexported fields
}

func NewBackuper added in v1.0.0

func NewBackuper(cfg *config.Config) *Backuper

func (*Backuper) CreateToRemote added in v1.0.0

func (b *Backuper) CreateToRemote(backupName, diffFrom, diffFromRemote, tablePattern string, partitions []string, schemaOnly, rbac, backupConfig bool, version string) error

func (*Backuper) Download added in v1.0.0

func (b *Backuper) Download(backupName string, tablePattern string, partitions []string, schemaOnly bool) error

func (*Backuper) ReadBackupMetadataLocal added in v1.3.0

func (b *Backuper) ReadBackupMetadataLocal(backupName string) (*metadata.BackupMetadata, error)

func (*Backuper) ReadBackupMetadataRemote added in v1.3.0

func (b *Backuper) ReadBackupMetadataRemote(backupName string) (*metadata.BackupMetadata, error)

func (*Backuper) RestoreFromRemote added in v1.0.0

func (b *Backuper) RestoreFromRemote(backupName string, tablePattern string, partitions []string, schemaOnly, dataOnly, dropTable, rbacOnly, configsOnly bool) error

func (*Backuper) Upload added in v1.0.0

func (b *Backuper) Upload(backupName, diffFrom, diffFromRemote, tablePattern string, partitions []string, schemaOnly bool) error

type ListOfTables added in v1.3.0

type ListOfTables []metadata.TableMetadata

func (ListOfTables) Sort added in v1.3.0

func (lt ListOfTables) Sort(dropTable bool)

Sort - sorting ListOfTables slice orderly by engine priority

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL