Documentation ¶
Index ¶
- Variables
- func DelPosTable()
- func GetBinlogFromMysqlPosInfo(sql string, args ...interface{}) (string, int)
- func GetMasterStatus() (string, int)
- func GetNewBinlogBefore(mysqlAddr string, binlog string, pos uint32) (string, int)
- func GetNewMasterBinlogInfo(mysqlAddr string, binlog string, pos uint32) (string, int)
- func GetSlaveInfo() (string, string, string, string)
- func Manually(tables string, flag int) error
- func Monitor()
- func MonitorMysqlPos()
- type MasterStatus
- type MysqlPosInfo
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // SetDumpFlag 设置dump 标志 SetDumpFlag = 1 // ReleaseDumpFlag 释放dump 标志 ReleaseDumpFlag = 0 // AddRuleFlag 添加规则标志 AddRuleFlag = 2 // DelRuleFlag 删除规则标志 DelRuleFlag = 3 // RestartCanalFlag 重启解析标志 RestartCanalFlag = 4 // RuleApplySuccess 规则修改完成 RuleApplySuccess = 1 )
View Source
var DumpFlagChan = make(chan int)
DumpFlagChan dump flag chan
View Source
var RuleChan = make(chan int)
RuleChan 重新启动后,需要将rule operation 字段置成0
Functions ¶
func GetBinlogFromMysqlPosInfo ¶
GetBinlogFromMysqlPosInfo 查询mysql_pos_info表获取新主对应的位置
func GetMasterStatus ¶
GetMasterStatus 获取master binlog file and pos
func GetNewBinlogBefore ¶
GetNewBinlogBefore 新主根据mysql_pos_info表向前最接近working_info位置点,作为同步位置
func GetNewMasterBinlogInfo ¶
GetNewMasterBinlogInfo 主从切换后,根据fusion处理到的老主节点的位置信息和mysql_pos_info表中信息来确定新主的位置进行同步
func Manually ¶
Manually flag = 0 手动dump, 用以恢复不一致的内存数据, flag = 2 , 添加新规则,全量dump 需要dump 的数据, flag = 1 删除规则, 重启fusion 加载最新的同步表信息
func MonitorMysqlPos ¶
func MonitorMysqlPos()
MonitorMysqlPos 每秒获取一次mysql主从pos对应关系,写入到数据库表mysql_pos_info,便于主从切换时找到从节点对应的pos位置
Types ¶
type MasterStatus ¶
type MasterStatus struct { File string `db:"File"` Position int `db:"Position"` BinlogDoDB string `db:"Binlog_Do_DB"` BinlogIgnoreDB string `db:"Binlog_Ignore_DB"` ExecutedGtidSet string `db:"Executed_Gtid_Set"` }
MasterStatus keep master file and pos
type MysqlPosInfo ¶
type MysqlPosInfo struct { SID int `db:"sid"` MasterMysqlAddr string `db:"master_mysql_addr"` MasterBinlogFile interface{} `db:"master_binlog_file_name"` MasterBinlogPos interface{} `db:"master_binlog_position"` SlaveMysqlAddr string `db:"slave_mysql_addr"` SlaveBinlogFile string `db:"slave_binlog_file_name"` SlaveBinlogPos int `db:"slave_binlog_position"` }
MysqlPosInfo mysql_pos_info
func GetPosFromSlave ¶
func GetPosFromSlave() (MysqlPosInfo, error)
GetPosFromSlave 在从节点获取主从当前的pos,写入到数据库表mysql_pos_info
Click to show internal directories.
Click to hide internal directories.