Documentation ¶
Index ¶
- type Agent
- func (a *Agent) List(host, dir, t string) ([]string, error)
- func (a *Agent) ListDirs(host, dir string) ([]string, error)
- func (a *Agent) ListFiles(host, dir string) ([]string, error)
- func (a *Agent) ReadFile(host, file string) (io.Reader, error)
- func (a *Agent) Run(host, cmd string) ([]byte, error)
- func (a *Agent) UploadFile(host, localFile, remotePath string) error
- type Cassandra
- func (c *Cassandra) Hosts() []string
- func (c *Cassandra) SchemaBackup(host string) (string, error)
- func (c *Cassandra) Snapshot(host, ts string) ([]string, []string, error)
- func (c *Cassandra) SnapshotFull(host, ts string) ([]string, []string, error)
- func (c *Cassandra) SnapshotInc(host string) ([]string, []string, error)
- type Config
- type Priam
- type S3
- type SnapshotHistory
- func (h *SnapshotHistory) Add(key string)
- func (h *SnapshotHistory) Keys(snapshot string) ([]string, error)
- func (h *SnapshotHistory) List() []string
- func (h *SnapshotHistory) Parent(snapshot string) string
- func (h *SnapshotHistory) String() string
- func (h *SnapshotHistory) Valid(snapshot string) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Agent ¶
type Agent struct {
// contains filtered or unexported fields
}
Agent provides methods to run commands and interface with remote cassandra cluster nodes via ssh. TODO: add mutex to agent operations, to enable multi thread.
func (*Agent) UploadFile ¶
UploadFile from local machine to remote host.
type Cassandra ¶
type Cassandra struct {
// contains filtered or unexported fields
}
Cassandra provides methods to interface with a Cassandra cluster.
func NewCassandra ¶
NewCassandra returns a new Cassandra object.
func (*Cassandra) SchemaBackup ¶
SchemaBackup takes backup of a keyspace and saves it on remote machine
func (*Cassandra) SnapshotFull ¶
SnapshotFull takes a full snapshot.
type Config ¶
type Config struct { AwsAccessKey string `yaml:"aws-access-key"` AwsBasePath string `yaml:"aws-base-path"` AwsBucket string `yaml:"aws-bucket"` AwsRegion string `yaml:"aws-region"` AwsSecretKey string `yaml:"aws-secret-key"` CassandraClasspath string `yaml:"cassandra-classpath"` CassandraConf string `yaml:"cassandra-conf"` CqlshPath string `yaml:"cqlsh-path"` Host string Incremental bool Keyspace string Nodetool string TempDir string `yaml:"temp-dir"` PrivateKey string `yaml:"private-key"` Snapshot string Sstableloader string User string }
Config holds priam configuration parameters.
func DefaultConfig ¶
DefaultConfig provides a starting point config for priam.
type Priam ¶
type Priam struct {
// contains filtered or unexported fields
}
Priam object provides backup and restore of cassandra DB to AWS S3.
func (*Priam) Backup ¶
Backup flushes all cassandra tables to disk identifies the appropriate files and copies them to the specified AWS S3 bucket.
func (*Priam) NewTimestamp ¶
NewTimestamp generates a new timestamp which is based on current time. The code assumes timestamps are monotonically increasing and is used by restore function to determine which backup is the latest as well as the order of incremental backups.
func (*Priam) Restore ¶
Restore cassandra from a given snapshot. TODO: if restoring from a cassandra node then skip copying file to cassandra host.
func (*Priam) SnapshotHistory ¶
SnapshotHistory returns snapshot history
type S3 ¶
type S3 struct {
// contains filtered or unexported fields
}
S3 object interfaces with AWS S3.
func (*S3) SnapshotHistory ¶
func (s *S3) SnapshotHistory() (*SnapshotHistory, error)
SnapshotHistory retrieves snapshot history from S3.
func (*S3) UploadFile ¶
UploadFile uploads a file to AWS S3.
type SnapshotHistory ¶
type SnapshotHistory struct {
// contains filtered or unexported fields
}
SnapshotHistory provides the history of all snapshots in S3 for a keyspace. parent is set only for incremental backups.
func NewSnapshotHistory ¶
func NewSnapshotHistory() *SnapshotHistory
NewSnapshotHistory initializes new snapshot history.
func (*SnapshotHistory) Add ¶
func (h *SnapshotHistory) Add(key string)
Add key to snapshot history.
func (*SnapshotHistory) Keys ¶
func (h *SnapshotHistory) Keys(snapshot string) ([]string, error)
Keys returns all keys for a given snapshot including keys for parent snapshots if this is an incremental backup.
func (*SnapshotHistory) List ¶
func (h *SnapshotHistory) List() []string
List returns a ordered list of timestamps.
func (*SnapshotHistory) Parent ¶
func (h *SnapshotHistory) Parent(snapshot string) string
Parent returns parent for this snapshot, returns itself if not incremental.
func (*SnapshotHistory) String ¶
func (h *SnapshotHistory) String() string
String representation of snapshot history.
func (*SnapshotHistory) Valid ¶
func (h *SnapshotHistory) Valid(snapshot string) bool
Valid returns true if a valid snapshot.