Documentation ¶
Index ¶
- func ParseCQLFile(filePath string) ([]string, error)
- func RunBackupTool(args []string)
- func RunSchemaUpdateTool(args []string)
- func ValidateBackupConfig(cfg *BackupToolConfig) error
- func ValidateRestoreConfig(cfg *BackupToolConfig) error
- type AWSConfig
- type BackupConfig
- type BackupCron
- type BackupTask
- type BackupToolConfig
- type CQLClient
- type ConfigError
- type Manifest
- type NodeTool
- type NodeToolError
- type RestoreConfig
- type RestoreTask
- type SchemaUpdateTask
- type SchemaUpdaterConfig
- type Secret
- type SnapshotCreds
- type TaskError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseCQLFile ¶
ParseCQLFile takes a cql file path as input and returns an array of cql statements on success.
func RunSchemaUpdateTool ¶
func RunSchemaUpdateTool(args []string)
RunSchemaUpdateTool runs the schema update tool
func ValidateBackupConfig ¶
func ValidateBackupConfig(cfg *BackupToolConfig) error
ValidateBackupConfig validates the given config
func ValidateRestoreConfig ¶
func ValidateRestoreConfig(cfg *BackupToolConfig) error
ValidateRestoreConfig validate the given restore config
Types ¶
type AWSConfig ¶
type AWSConfig struct { Region string `yaml:"Region"` S3Bucket string `yaml:"S3Bucket"` SecretFilePath string `yaml:"SecretFilePath"` }
AWSConfig contains aws specific configuratoin
type BackupConfig ¶
type BackupConfig struct { Schedule string `yaml:"Schedule"` HourOfDay int `yaml:"HourOfDay"` Keyspace string `yaml:"Keyspace"` SchemaBackupDir string `yaml:"SchemaBackupDir"` }
BackupConfig has all the backup specific configurations
type BackupCron ¶
type BackupCron struct {
// contains filtered or unexported fields
}
BackupCron represents a background job that schedules backup tasks based on a pre-defined schedule
func NewBackupCron ¶
func NewBackupCron(svc string, cfg *BackupToolConfig) *BackupCron
NewBackupCron returns a cron task that schedules backup based on a schedule
func (*BackupCron) ScheduleNow ¶
func (cron *BackupCron) ScheduleNow(date string) error
ScheduleNow schedules a one time back up immediately
type BackupTask ¶
type BackupTask struct {
// contains filtered or unexported fields
}
BackupTask runs a single run of backup for cassandra
func NewBackupTask ¶
func NewBackupTask(config *BackupToolConfig, snapshotName string, hostname string, secret *Secret) (*BackupTask, error)
NewBackupTask creates and returns a task that captures a snapshot from cassandra and uploads the artifacts to S3. The snapshot will be captured with the given snapshotName the artifacts will be stored in S3 under the same name. Following is the key naming used in S3:
bucket:cherami - deployment-name - cassandra/backups/keyspace - metadata-servername - snapshotName snapshotName_keyspace_schema.txt snapshotName_keyspace_peers.json table1-hexstring - file1.db - manifest.json table2-hexstring .....
type BackupToolConfig ¶
type BackupToolConfig struct { Deployment string `yaml:"Deployment"` RootDirPath string `yaml:"RootDirPath"` AWS AWSConfig `yaml:"AWS"` Logging configure.LogConfiguration `yaml:"Logging"` Backup BackupConfig `yaml:"Backup"` Restore RestoreConfig `yaml:"Restore"` }
BackupToolConfig is the configuration used for cassandra-backup tool
type CQLClient ¶
type CQLClient interface { // Exec executes the cql statement Exec(stmt string) error // ReadSchemaVersion returns the current schema version for the keyspace ReadSchemaVersion() (int64, error) // UpdateSchemaVersion updates the schema version for the keyspace UpdateSchemaVersion(newVersion int64, minCompatibleVersion int64) error // WriteSchemaUpdateLog adds an entry to the schema update history table WriteSchemaUpdateLog(oldVersion int64, newVersion int64, manifestMD5 string, desc string) error }
CQLClient is the interface for implementations that provide way to talk to cassandra through CQL
type ConfigError ¶
type ConfigError struct {
// contains filtered or unexported fields
}
ConfigError represents any error for the Config handler
type Manifest ¶
type Manifest struct { CurrVersion int64 MinCompatibleVersion int64 Description string SchemaUpdateCqlFiles []string // contains filtered or unexported fields }
Manifest represents the json deserialized object for the schema update manifest
type NodeTool ¶
type NodeTool interface { // CreateSnapshot captures a cassandra snapshot CreateSnapshot(name string, keyspace string) error // ClearSnapshot clears a specific cassandra snapshot ClearSnapshot(name string) error // ClearAllSnapshots clears all cassandra snapshots ClearAllSnapshots() error // DescKeyspace describes a given keyspace DescKeyspace(keyspace string) (string, error) // GetPeers returns the cassandra peers GetPeers() ([]string, error) }
NodeTool is an interface that Cassandra's node tool wrappers must adhere to
func NewNodeTool ¶
NewNodeTool returns a node too wrapper
type NodeToolError ¶
type NodeToolError struct {
// contains filtered or unexported fields
}
NodeToolError represents any error thrown by the NodeTool
type RestoreConfig ¶
type RestoreConfig struct { SnapshotDate string `yaml:"SnapshotDate"` SnapshotHostname string `yaml:"SnapshotHostname"` OutputDirPath string `yaml:"OutputDirPath"` Keyspace string `yaml:"Keyspace"` }
RestoreConfig has snapshot restore specific configuration
type RestoreTask ¶
type RestoreTask struct {
// contains filtered or unexported fields
}
RestoreTask represents a task that restores a backup snapshot from S3 to disk
func NewRestoreTask ¶
func NewRestoreTask(cfg *BackupToolConfig, secret *Secret) (*RestoreTask, error)
NewRestoreTask returns a new instance of task that fetches a cassandra snapshot from s3 and stores it onto a given output dir.
type SchemaUpdateTask ¶
type SchemaUpdateTask struct {
// contains filtered or unexported fields
}
SchemaUpdateTask represents a task that takes a config for schema upgrade and in turn, runs the upgrade
func NewSchemaUpdateTask ¶
func NewSchemaUpdateTask(config *SchemaUpdaterConfig) (*SchemaUpdateTask, error)
NewSchemaUpdateTask creates and returns a new SchemaUpdateTask
type SchemaUpdaterConfig ¶
type SchemaUpdaterConfig struct { Keyspace string HostsCsv string IsDryRun bool SkipVersionCheck bool ManifestFilePath string ProtoVersion int }
SchemaUpdaterConfig represents the configuration for the schema update task
type Secret ¶
type Secret struct { AWSAccessKeyID string `yaml:"aws_access_key_id"` AWSSecretKey string `yaml:"aws_secret_access_key"` Snapshot SnapshotCreds `yaml:"snapshot"` }
Secret represents the credentials that come from langley
func LoadSecret ¶
LoadSecret loads the secret yaml from the given path
type SnapshotCreds ¶
type SnapshotCreds struct {
AESMasterKey string `yaml:"aesMasterKey"`
}
SnapshotCreds are the secrets needed to encrypt snapshot data