Documentation ¶
Index ¶
- Constants
- Variables
- func AddTableToBackup(ch *clickhouse.ClickHouse, backupName string, diskList []clickhouse.Disk, ...) (map[string][]metadata.Part, map[string]int64, error)
- func CopyPartHashes(cfg config.Config, tablePattern string, backupName string) error
- func CreateBackup(cfg *config.Config, backupName, tablePattern string, ...) error
- func GetRemoteBackups(cfg *config.Config) ([]new_storage.Backup, error)
- func GetTables(cfg *config.Config) ([]clickhouse.Table, error)
- func IsInformationSchema(database string) bool
- func NewBackupName() string
- func PrintAllBackups(cfg *config.Config, format string) error
- func PrintLocalBackups(cfg *config.Config, format string) error
- func PrintRemoteBackups(cfg *config.Config, format string) error
- func PrintTables(cfg *config.Config, printAll bool) error
- func RemoveBackupLocal(cfg *config.Config, backupName string) error
- func RemoveBackupRemote(cfg *config.Config, backupName string) error
- func RemoveOldBackupsLocal(cfg *config.Config, keepLastBackup bool) error
- func Restore(cfg *config.Config, backupName string, tablePattern string, ...) error
- func RestoreData(cfg *config.Config, ch *clickhouse.ClickHouse, backupName string, ...) error
- func RestoreSchema(ch *clickhouse.ClickHouse, backupName string, tablePattern string, ...) error
- type BackupLocal
- type BackupOptions
- type Backuper
- func (b *Backuper) CreateToRemote(backupName, tablePattern, diffFrom string, schemaOnly, rbac, backupConfig bool, ...) error
- func (b *Backuper) Download(backupName string, tablePattern string, schemaOnly bool) error
- func (b *Backuper) ReadBackupMetadata(backupName string) (*metadata.BackupMetadata, error)
- func (b *Backuper) RestoreFromRemote(backupName string, tablePattern string, ...) error
- func (b *Backuper) Upload(backupName, tablePattern, diffFrom string, schemaOnly bool) error
- type RestoreTables
Constants ¶
const ( // TimeFormatForBackup - default backup name format TimeFormatForBackup = "2006-01-02T15-04-05" MetaFileName = "metadata.json" )
Variables ¶
var (
ErrBackupIsAlreadyExists = errors.New("backup is already exists")
)
var ( // ErrUnknownClickhouseDataPath - ErrUnknownClickhouseDataPath = errors.New("clickhouse data path is unknown, you can set data_path in config file") )
Functions ¶
func AddTableToBackup ¶ added in v1.0.0
func AddTableToBackup(ch *clickhouse.ClickHouse, backupName string, diskList []clickhouse.Disk, table *clickhouse.Table) (map[string][]metadata.Part, map[string]int64, error)
func CopyPartHashes ¶
CopyPartHashes - Copy data parts hashes by tablePattern
func CreateBackup ¶
func CreateBackup(cfg *config.Config, backupName, tablePattern 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) ([]new_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 PrintAllBackups ¶ added in v1.0.0
func PrintLocalBackups ¶
PrintLocalBackups - print all backups stored locally
func PrintRemoteBackups ¶
PrintRemoteBackups - print all backups stored on remote storage
func PrintTables ¶
PrintTables - print all tables suitable for backup
func RemoveOldBackupsLocal ¶
func Restore ¶
func Restore(cfg *config.Config, backupName string, tablePattern 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) error
RestoreData - restore data for tables matched by tablePattern from backupName
func RestoreSchema ¶
func RestoreSchema(ch *clickhouse.ClickHouse, backupName string, tablePattern string, dropTable bool) 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) ([]BackupLocal, error)
GetLocalBackups - return slice of all backups stored locally
type BackupOptions ¶ added in v1.0.0
type Backuper ¶ added in v1.0.0
type Backuper struct { Version string DiskMap map[string]string DefaultDataPath string // contains filtered or unexported fields }
func NewBackuper ¶ added in v1.0.0
func (*Backuper) CreateToRemote ¶ added in v1.0.0
func (*Backuper) ReadBackupMetadata ¶ added in v1.0.0
func (b *Backuper) ReadBackupMetadata(backupName string) (*metadata.BackupMetadata, error)
func (*Backuper) RestoreFromRemote ¶ added in v1.0.0
type RestoreTables ¶
type RestoreTables []metadata.TableMetadata
RestoreTables - slice of RestoreTable
func (RestoreTables) Sort ¶
func (rt RestoreTables) Sort(dropTable bool)
Sort - sorting BackupTables slice orderly by name