Documentation
¶
Index ¶
- Constants
- Variables
- func GetConfigPath(ctx *cli.Context) string
- func PrintConfig(ctx *cli.Context) error
- func ValidateConfig(cfg *Config) error
- type APIConfig
- type AzureBlobConfig
- type COSConfig
- type ClickHouseConfig
- type Config
- type FTPConfig
- type GCSConfig
- type GeneralConfig
- type S3Config
- type SFTPConfig
Constants ¶
View Source
const (
DefaultConfigPath = "/etc/clickhouse-backup/config.yml"
)
Variables ¶
View Source
var ArchiveExtensions = map[string]string{
"tar": "tar",
"lz4": "tar.lz4",
"bzip2": "tar.bz2",
"gzip": "tar.gz",
"sz": "tar.sz",
"xz": "tar.xz",
"br": "tar.br",
"brotli": "tar.br",
"zstd": "tar.zstd",
}
ArchiveExtensions - list of availiable compression formats and associated file extensions
Functions ¶
func GetConfigPath ¶
func PrintConfig ¶
PrintConfig - print default / current config to stdout
func ValidateConfig ¶
Types ¶
type APIConfig ¶
type APIConfig struct {
ListenAddr string `yaml:"listen" envconfig:"API_LISTEN"`
EnableMetrics bool `yaml:"enable_metrics" envconfig:"API_ENABLE_METRICS"`
EnablePprof bool `yaml:"enable_pprof" envconfig:"API_ENABLE_PPROF"`
Username string `yaml:"username" envconfig:"API_USERNAME"`
Password string `yaml:"password" envconfig:"API_PASSWORD"`
Secure bool `yaml:"secure" envconfig:"API_SECURE"`
CertificateFile string `yaml:"certificate_file" envconfig:"API_CERTIFICATE_FILE"`
PrivateKeyFile string `yaml:"private_key_file" envconfig:"API_PRIVATE_KEY_FILE"`
CreateIntegrationTables bool `yaml:"create_integration_tables" envconfig:"API_CREATE_INTEGRATION_TABLES"`
IntegrationTablesHost string `yaml:"integration_tables_host" envconfig:"API_INTEGRATION_TABLES_HOST"`
AllowParallel bool `yaml:"allow_parallel" envconfig:"API_ALLOW_PARALLEL"`
}
type AzureBlobConfig ¶
type AzureBlobConfig struct {
EndpointSchema string `yaml:"endpoint_schema" envconfig:"AZBLOB_ENDPOINT_SCHEMA"`
EndpointSuffix string `yaml:"endpoint_suffix" envconfig:"AZBLOB_ENDPOINT_SUFFIX"`
AccountName string `yaml:"account_name" envconfig:"AZBLOB_ACCOUNT_NAME"`
AccountKey string `yaml:"account_key" envconfig:"AZBLOB_ACCOUNT_KEY"`
UseManagedIdentity bool `yaml:"use_managed_identity" envconfig:"AZBLOB_USE_MANAGED_IDENTITY"`
Container string `yaml:"container" envconfig:"AZBLOB_CONTAINER"`
Path string `yaml:"path" envconfig:"AZBLOB_PATH"`
CompressionLevel int `yaml:"compression_level" envconfig:"AZBLOB_COMPRESSION_LEVEL"`
CompressionFormat string `yaml:"compression_format" envconfig:"AZBLOB_COMPRESSION_FORMAT"`
SSEKey string `yaml:"sse_key" envconfig:"AZBLOB_SSE_KEY"`
BufferSize int `yaml:"buffer_size" envconfig:"AZBLOB_BUFFER_SIZE"`
MaxBuffers int `yaml:"buffer_count" envconfig:"AZBLOB_MAX_BUFFERS"`
MaxPartsCount int `yaml:"max_parts_count" envconfig:"AZBLOB_MAX_PARTS_COUNT"`
Timeout string `yaml:"timeout" envconfig:"AZBLOB_TIMEOUT"`
}
AzureBlobConfig - Azure Blob settings section
type COSConfig ¶
type COSConfig struct {
RowURL string `yaml:"url" envconfig:"COS_URL"`
Timeout string `yaml:"timeout" envconfig:"COS_TIMEOUT"`
SecretID string `yaml:"secret_id" envconfig:"COS_SECRET_ID"`
SecretKey string `yaml:"secret_key" envconfig:"COS_SECRET_KEY"`
Path string `yaml:"path" envconfig:"COS_PATH"`
CompressionFormat string `yaml:"compression_format" envconfig:"COS_COMPRESSION_FORMAT"`
CompressionLevel int `yaml:"compression_level" envconfig:"COS_COMPRESSION_LEVEL"`
Debug bool `yaml:"debug" envconfig:"COS_DEBUG"`
}
COSConfig - cos settings section
type ClickHouseConfig ¶
type ClickHouseConfig struct {
Username string `yaml:"username" envconfig:"CLICKHOUSE_USERNAME"`
Password string `yaml:"password" envconfig:"CLICKHOUSE_PASSWORD"`
Host string `yaml:"host" envconfig:"CLICKHOUSE_HOST"`
Port uint `yaml:"port" envconfig:"CLICKHOUSE_PORT"`
DiskMapping map[string]string `yaml:"disk_mapping" envconfig:"CLICKHOUSE_DISK_MAPPING"`
SkipTables []string `yaml:"skip_tables" envconfig:"CLICKHOUSE_SKIP_TABLES"`
Timeout string `yaml:"timeout" envconfig:"CLICKHOUSE_TIMEOUT"`
FreezeByPart bool `yaml:"freeze_by_part" envconfig:"CLICKHOUSE_FREEZE_BY_PART"`
FreezeByPartWhere string `yaml:"freeze_by_part_where" envconfig:"CLICKHOUSE_FREEZE_BY_PART_WHERE"`
Secure bool `yaml:"secure" envconfig:"CLICKHOUSE_SECURE"`
SkipVerify bool `yaml:"skip_verify" envconfig:"CLICKHOUSE_SKIP_VERIFY"`
SyncReplicatedTables bool `yaml:"sync_replicated_tables" envconfig:"CLICKHOUSE_SYNC_REPLICATED_TABLES"`
LogSQLQueries bool `yaml:"log_sql_queries" envconfig:"CLICKHOUSE_LOG_SQL_QUERIES"`
ConfigDir string `yaml:"config_dir" envconfig:"CLICKHOUSE_CONFIG_DIR"`
RestartCommand string `yaml:"restart_command" envconfig:"CLICKHOUSE_RESTART_COMMAND"`
IgnoreNotExistsErrorDuringFreeze bool `yaml:"ignore_not_exists_error_during_freeze" envconfig:"CLICKHOUSE_IGNORE_NOT_EXISTS_ERROR_DURING_FREEZE"`
CheckReplicasBeforeAttach bool `yaml:"check_replicas_before_attach" envconfig:"CLICKHOUSE_CHECK_REPLICAS_BEFORE_ATTACH"`
TLSKey string `yaml:"tls_key" envconfig:"CLICKHOUSE_TLS_KEY"`
TLSCert string `yaml:"tls_cert" envconfig:"CLICKHOUSE_TLS_CERT"`
TLSCa string `yaml:"tls_ca" envconfig:"CLICKHOUSE_TLS_CA"`
Debug bool `yaml:"debug" envconfig:"CLICKHOUSE_DEBUG"`
}
ClickHouseConfig - clickhouse settings section
type Config ¶
type Config struct {
General GeneralConfig `yaml:"general" envconfig:"_"`
ClickHouse ClickHouseConfig `yaml:"clickhouse" envconfig:"_"`
S3 S3Config `yaml:"s3" envconfig:"_"`
GCS GCSConfig `yaml:"gcs" envconfig:"_"`
COS COSConfig `yaml:"cos" envconfig:"_"`
API APIConfig `yaml:"api" envconfig:"_"`
FTP FTPConfig `yaml:"ftp" envconfig:"_"`
SFTP SFTPConfig `yaml:"sftp" envconfig:"_"`
AzureBlob AzureBlobConfig `yaml:"azblob" envconfig:"_"`
}
Config - config file format
func DefaultConfig ¶
func DefaultConfig() *Config
func LoadConfig ¶
LoadConfig - load config from file + environment variables
func (*Config) GetArchiveExtension ¶
func (*Config) GetCompressionFormat ¶
type FTPConfig ¶
type FTPConfig struct {
Address string `yaml:"address" envconfig:"FTP_ADDRESS"`
Timeout string `yaml:"timeout" envconfig:"FTP_TIMEOUT"`
Username string `yaml:"username" envconfig:"FTP_USERNAME"`
Password string `yaml:"password" envconfig:"FTP_PASSWORD"`
TLS bool `yaml:"tls" envconfig:"FTP_TLS"`
Path string `yaml:"path" envconfig:"FTP_PATH"`
CompressionFormat string `yaml:"compression_format" envconfig:"FTP_COMPRESSION_FORMAT"`
CompressionLevel int `yaml:"compression_level" envconfig:"FTP_COMPRESSION_LEVEL"`
Concurrency uint8 `yaml:"concurrency" envconfig:"FTP_CONCURRENCY"`
Debug bool `yaml:"debug" envconfig:"FTP_DEBUG"`
}
FTPConfig - ftp settings section
type GCSConfig ¶
type GCSConfig struct {
CredentialsFile string `yaml:"credentials_file" envconfig:"GCS_CREDENTIALS_FILE"`
CredentialsJSON string `yaml:"credentials_json" envconfig:"GCS_CREDENTIALS_JSON"`
Bucket string `yaml:"bucket" envconfig:"GCS_BUCKET"`
Path string `yaml:"path" envconfig:"GCS_PATH"`
CompressionLevel int `yaml:"compression_level" envconfig:"GCS_COMPRESSION_LEVEL"`
CompressionFormat string `yaml:"compression_format" envconfig:"GCS_COMPRESSION_FORMAT"`
Debug bool `yaml:"debug" envconfig:"GCS_DEBUG"`
Endpoint string `yaml:"endpoint" envconfig:"GCS_ENDPOINT"`
StorageClass string `yaml:"storage_class" envconfig:"GCS_STORAGE_CLASS"`
}
GCSConfig - GCS settings section
type GeneralConfig ¶
type GeneralConfig struct {
RemoteStorage string `yaml:"remote_storage" envconfig:"REMOTE_STORAGE"`
MaxFileSize int64 `yaml:"max_file_size" envconfig:"MAX_FILE_SIZE"`
DisableProgressBar bool `yaml:"disable_progress_bar" envconfig:"DISABLE_PROGRESS_BAR"`
BackupsToKeepLocal int `yaml:"backups_to_keep_local" envconfig:"BACKUPS_TO_KEEP_LOCAL"`
BackupsToKeepRemote int `yaml:"backups_to_keep_remote" envconfig:"BACKUPS_TO_KEEP_REMOTE"`
LogLevel string `yaml:"log_level" envconfig:"LOG_LEVEL"`
AllowEmptyBackups bool `yaml:"allow_empty_backups" envconfig:"ALLOW_EMPTY_BACKUPS"`
DownloadConcurrency uint8 `yaml:"download_concurrency" envconfig:"DOWNLOAD_CONCURRENCY"`
UploadConcurrency uint8 `yaml:"upload_concurrency" envconfig:"UPLOAD_CONCURRENCY"`
RestoreSchemaOnCluster string `yaml:"restore_schema_on_cluster" envconfig:"RESTORE_SCHEMA_ON_CLUSTER"`
UploadByPart bool `yaml:"upload_by_part" envconfig:"UPLOAD_BY_PART"`
DownloadByPart bool `yaml:"download_by_part" envconfig:"DOWNLOAD_BY_PART"`
}
GeneralConfig - general setting section
type S3Config ¶
type S3Config struct {
AccessKey string `yaml:"access_key" envconfig:"S3_ACCESS_KEY"`
SecretKey string `yaml:"secret_key" envconfig:"S3_SECRET_KEY"`
Bucket string `yaml:"bucket" envconfig:"S3_BUCKET"`
Endpoint string `yaml:"endpoint" envconfig:"S3_ENDPOINT"`
Region string `yaml:"region" envconfig:"S3_REGION"`
ACL string `yaml:"acl" envconfig:"S3_ACL"`
AssumeRoleARN string `yaml:"assume_role_arn" envconfig:"S3_ASSUME_ROLE_ARN"`
ForcePathStyle bool `yaml:"force_path_style" envconfig:"S3_FORCE_PATH_STYLE"`
Path string `yaml:"path" envconfig:"S3_PATH"`
DisableSSL bool `yaml:"disable_ssl" envconfig:"S3_DISABLE_SSL"`
CompressionLevel int `yaml:"compression_level" envconfig:"S3_COMPRESSION_LEVEL"`
CompressionFormat string `yaml:"compression_format" envconfig:"S3_COMPRESSION_FORMAT"`
SSE string `yaml:"sse" envconfig:"S3_SSE"`
DisableCertVerification bool `yaml:"disable_cert_verification" envconfig:"S3_DISABLE_CERT_VERIFICATION"`
UseCustomStorageClass bool `yaml:"use_custom_storage_class" envconfig:"S3_USE_CUSTOM_STORAGE_CLASS"`
StorageClass string `yaml:"storage_class" envconfig:"S3_STORAGE_CLASS"`
Concurrency int `yaml:"concurrency" envconfig:"S3_CONCURRENCY"`
PartSize int64 `yaml:"part_size" envconfig:"S3_PART_SIZE"`
MaxPartsCount int64 `yaml:"max_parts_count" envconfig:"S3_MAX_PARTS_COUNT"`
AllowMultipartDownload bool `yaml:"allow_multipart_download" envconfig:"S3_ALLOW_MULTIPART_DOWNLOAD"`
Debug bool `yaml:"debug" envconfig:"S3_DEBUG"`
}
S3Config - s3 settings section
type SFTPConfig ¶
type SFTPConfig struct {
Address string `yaml:"address" envconfig:"SFTP_ADDRESS"`
Port uint `yaml:"port" envconfig:"SFTP_PORT"`
Username string `yaml:"username" envconfig:"SFTP_USERNAME"`
Password string `yaml:"password" envconfig:"SFTP_PASSWORD"`
Key string `yaml:"key" envconfig:"SFTP_KEY"`
Path string `yaml:"path" envconfig:"SFTP_PATH"`
CompressionFormat string `yaml:"compression_format" envconfig:"SFTP_COMPRESSION_FORMAT"`
CompressionLevel int `yaml:"compression_level" envconfig:"SFTP_COMPRESSION_LEVEL"`
Concurrency int `yaml:"concurrency" envconfig:"SFTP_CONCURRENCY"`
Debug bool `yaml:"debug" envconfig:"SFTP_DEBUG"`
}
SFTPConfig - sftp settings section
Click to show internal directories.
Click to hide internal directories.