Documentation ¶
Index ¶
- Constants
- Variables
- func AccessDenied(err error) bool
- func CheckMyCnf()
- func CheckMysqldCmdVersion()
- func CrossCheck(ctx context.Context, mysql *v1.Mysql) map[int]error
- func DailCheck(ctx context.Context, addr string) error
- func GetIncrementals(dir string) (a []int, err error)
- func GroupToken(mysql *v1.Mysql) string
- func IndexNotDigit(s string) int
- func IsEmpty(name string) (bool, error)
- func LoadTimeZone() (string, error)
- func Open(dsn string, params ...string) (*sql.DB, error)
- func PushToken(ctx *tiny.Context)
- func ReadBackupInfo(dir string) (t time.Time, d time.Duration, err error)
- func Serve()
- func SoloToken(mysql *v1.Mysql, name string) string
- func WriteBackupInfo(dir string, t time.Time) error
- type Mylet
- func (mylet *Mylet) AdjustBackup(id int) error
- func (mylet *Mylet) BackupDir() string
- func (mylet *Mylet) BackupFile(src string) error
- func (mylet *Mylet) ChangeLocalPassword() error
- func (mylet *Mylet) ChangePrimary(newId int) (err error)
- func (mylet *Mylet) CheckPosition() error
- func (mylet *Mylet) CheckVersion(v string) error
- func (mylet *Mylet) CompressBackup(dir string) (string, error)
- func (mylet *Mylet) CompressLastBackup() (string, error)
- func (mylet *Mylet) Configure() error
- func (mylet *Mylet) CreateBackupUser() error
- func (mylet *Mylet) DataDir() string
- func (mylet *Mylet) ExecFile(username, password, dbname, f string) error
- func (mylet *Mylet) ExporterUser() error
- func (mylet *Mylet) FetchAndPrepare() error
- func (mylet *Mylet) FixPasswordId(id int) error
- func (mylet *Mylet) FullBackup() (time.Time, error)
- func (mylet *Mylet) GetBackupDir(t time.Time) string
- func (mylet *Mylet) GetBackups() (a []time.Time, err error)
- func (mylet *Mylet) GetCompresses() (a []time.Time, err error)
- func (mylet *Mylet) GetMysqldVersion(id int) (v string, err error)
- func (mylet *Mylet) IncrementalBackup(t time.Time) (int, error)
- func (mylet *Mylet) InitDB() error
- func (mylet *Mylet) Initialize() error
- func (mylet *Mylet) IsPrimary() bool
- func (mylet *Mylet) IsReplica() bool
- func (mylet *Mylet) LockBackup(s string) string
- func (mylet *Mylet) MyCnf() string
- func (mylet *Mylet) Mysqld(ctx context.Context, args ...string) *exec.Cmd
- func (mylet *Mylet) PrepareBackup(id int, dir string) error
- func (mylet *Mylet) PrepareLastBackup() error
- func (mylet *Mylet) ReadGtid() (gtid string, err error)
- func (mylet *Mylet) Read_binlog_pos() (gtid string, err error)
- func (let *Mylet) Reload(ss SizeSpec) error
- func (mylet *Mylet) RenameRoot() error
- func (mylet *Mylet) RestoreBackup(id int, dir string, move bool) error
- func (mylet *Mylet) Run()
- func (mylet *Mylet) SelfCheck() error
- func (let *Mylet) SendReport(ctx context.Context, r *MysqlReport) error
- func (mylet *Mylet) SetupPrimary() error
- func (mylet *Mylet) SetupReplica() error
- func (mylet *Mylet) Socket() string
- func (mylet *Mylet) Start() error
- func (mylet *Mylet) StopPrimary() error
- func (mylet *Mylet) StopReplica() error
- func (mylet *Mylet) SwitchPrimary(rw bool) error
- func (mylet *Mylet) UnlockBackup()
- func (mylet *Mylet) WaitRelay() error
- type MysqlReport
- type MysqlState
- type Querier
- type ReportResult
- type SizeSpec
- type StateKey
- type Token
Constants ¶
View Source
const ( Hour8 = 8 * time.Hour Day = 24 * time.Hour BackupFilename = "mylet_backup" DatetimeLayout = "20060102.150405" CompressExt = ".tar.gz" )
View Source
const ( Timeout1m = time.Minute Timeout5s = 5 * time.Second )
View Source
const ( RW = true RO = false )
View Source
const MaxStartup = 720 // 1h
View Source
const MyCnfTmpl = `` /* 1821-byte string literal not displayed */
View Source
const RunSQL = `` /* 484-byte string literal not displayed */
Variables ¶
View Source
var ( HttpAddr = ":80" HttpsAddr = os.Getenv("HTTPS_ADDR") HttpsCert = os.Getenv("HTTPS_CERT") HttpsKey = os.Getenv("HTTPS_KEY") Http2Https = false )
View Source
var RandId = time.Now().UnixNano() // 启动时间、冲突检测
Functions ¶
func AccessDenied ¶
func CheckMysqldCmdVersion ¶
func CheckMysqldCmdVersion()
func GetIncrementals ¶
func GroupToken ¶
func IndexNotDigit ¶
func LoadTimeZone ¶
Types ¶
type Mylet ¶
type Mylet struct { sync.Mutex Mysql *v1.Mysql v1.MysqlSolo ReadinessProbe bool LivenessProbe bool StartupProbe bool Backing string Running bool ExitChan chan struct{} SwitchChan chan int }
func (*Mylet) AdjustBackup ¶
func (*Mylet) BackupFile ¶
func (*Mylet) ChangeLocalPassword ¶
func (*Mylet) ChangePrimary ¶
func (*Mylet) CheckVersion ¶
func (*Mylet) CompressLastBackup ¶
func (*Mylet) ExporterUser ¶
func (*Mylet) FetchAndPrepare ¶
func (*Mylet) FixPasswordId ¶
func (*Mylet) GetBackups ¶
TODO time corrupt
func (*Mylet) Initialize ¶
func (*Mylet) LockBackup ¶
func (*Mylet) PrepareLastBackup ¶
func (*Mylet) Read_binlog_pos ¶
TODO: multiline
func (*Mylet) RenameRoot ¶
func (*Mylet) RestoreBackup ¶
func (*Mylet) SendReport ¶
func (let *Mylet) SendReport(ctx context.Context, r *MysqlReport) error
func (*Mylet) SetupPrimary ¶
func (*Mylet) SetupReplica ¶
func (*Mylet) StopPrimary ¶
func (*Mylet) StopReplica ¶
func (*Mylet) SwitchPrimary ¶
func (*Mylet) UnlockBackup ¶
func (mylet *Mylet) UnlockBackup()
type MysqlReport ¶
type MysqlReport struct { Name string SizeSpec States []json.RawMessage Hang int }
type MysqlState ¶
type ReportResult ¶
Click to show internal directories.
Click to hide internal directories.