dr_oper

package
v0.0.0-...-1489327 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2022 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind_IPs

func Bind_IPs(db_id int, ips string, netcard string) int

func CheckDrConfig

func CheckDrConfig(bs_id int) (int, error)

func CheckSlaveDelay

func CheckSlaveDelay(mdb *xorm.Engine, sdb *xorm.Engine) int

func CountDrconfig

func CountDrconfig(condArr map[string]string) int64

统计数量

func CountOracleDrConfig

func CountOracleDrConfig(condArr map[string]string) int64

统计oracle容灾数量

func FailoverIPs

func FailoverIPs(op_id int64, dr_id int, asset_type int, sta_id int) int

切换IP

func FailoverToMaster

func FailoverToMaster(op_id int64, bs_id int, dsn string, slave_id int) int

func GetAssetType

func GetAssetType(bs_id int) int

func GetChangeMasterCmd

func GetChangeMasterCmd(db_id int, log_file string, log_pos string) (string, error)

func GetCurrentOpId

func GetCurrentOpId(bs_id int, op_type string) (int64, error)

func GetDatabaseRole

func GetDatabaseRole(db *xorm.Engine) int

func GetDsn

func GetDsn(db_id int, asset_type int) (string, error)

func GetIps

func GetIps(dr_id int) (string, error)

func GetIsShiftIP

func GetIsShiftIP(bs_id int) int

func GetMirrorDbname

func GetMirrorDbname(dr_id int) (string, error)

func GetMirrorRole

func GetMirrorRole(db *sql.DB, db_name string) (int, error)

func GetMirrorState

func GetMirrorState(db *sql.DB, db_name string) (int, error)

func GetOnProcess

func GetOnProcess(bs_id int) (int, error)

func GetOpResultById

func GetOpResultById(op_id int64) (string, string, error)

func GetPrimaryDBId

func GetPrimaryDBId(bs_id int) (int, error)

func GetPrimaryOSId

func GetPrimaryOSId(db_id int) int

func GetRestorePointName

func GetRestorePointName(P godror.ConnectionParams) ([]string, error)

func GetStaNetcard

func GetStaNetcard(dr_id int) (string, error)

func GetStandbyDBId

func GetStandbyDBId(bs_id int) (int, error)

func GetTransferStatus

func GetTransferStatus(sta_id int) string

func Init_OP_Instance

func Init_OP_Instance(op_id int64, bs_id int, asset_type int, op_type string) error

func Log_OP_Process

func Log_OP_Process(op_id int64, bs_id int, asset_type int, op_type string, process_desc string) error

func MoveOpRecordToHis

func MoveOpRecordToHis(bs_id int, op_type string) error

func OperationLock

func OperationLock(bs_id int, op_type string) error

func OperationUnlock

func OperationUnlock(bs_id int, op_type string) error

func OraFailoverToPrimary

func OraFailoverToPrimary(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraPrimaryToStandby

func OraPrimaryToStandby(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraRecover

func OraRecover(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStandbyToPrimary

func OraStandbyToPrimary(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStartFlashback

func OraStartFlashback(op_id int64, bs_id int, fb_method int, fb_point string, fb_time string, P godror.ConnectionParams) int

func OraStartRead

func OraStartRead(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStartSnapshot

func OraStartSnapshot(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStartSync

func OraStartSync(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStopRead

func OraStopRead(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStopSnapshot

func OraStopSnapshot(op_id int64, bs_id int, P godror.ConnectionParams) int

func OraStopSync

func OraStopSync(op_id int64, bs_id int, P godror.ConnectionParams) int

func RebuildReplication

func RebuildReplication(op_id int64, bs_id int, dsn_p string, dsn_s string, slave_id int) int

func SlaveToMaster

func SlaveToMaster(op_id int64, bs_id int, dsn_p string, dsn_s string, slave_id int) int

func SwitchIPs

func SwitchIPs(op_id int64, dr_id int, asset_type int, pri_id int, sta_id int) int

切换IP

func SwitchMirror

func SwitchMirror(op_id int64, bs_id int, dsn_p string, dsn_s string, db_name string) int

func Unbind_IPs

func Unbind_IPs(db_id int, ips string) int

func UpdateSwitchFlag

func UpdateSwitchFlag(bs_id int)

func Update_OP_Reason

func Update_OP_Reason(op_id int64, reason string)

func Update_OP_Result

func Update_OP_Result(op_id int64, result int)

Types

type Dr

type Dr struct {
	Id          int    `orm:"pk;column(id);"`
	Bs_Name     string `orm:"column(bs_name);"`
	Db_Id_P     int    `orm:"column(db_id_p);"`
	Db_Type_P   int    `orm:"column(db_type_p);"`
	Host_P      string `orm:"column(host_p);"`
	Port_P      int    `orm:"column(port_p);"`
	Alias_P     string `orm:"column(alias_p);"`
	Inst_Name_P string `orm:"column(inst_name_p);"`
	Db_Name_P   string `orm:"column(db_name_p);"`
	Db_Time_P   string `orm:"column(db_time_p);"`
	Db_Id_S     int    `orm:"column(db_id_s);"`
	Db_Type_S   int    `orm:"column(db_type_s);"`
	Host_S      string `orm:"column(host_s);"`
	Port_S      int    `orm:"column(port_s);"`
	Alias_S     string `orm:"column(alias_s);"`
	Inst_Name_S string `orm:"column(inst_name_s);"`
	Db_Name_S   string `orm:"column(db_name_s);"`
	Db_Time_S   string `orm:"column(db_time_s);"`
	Repl_Status string `orm:"column(repl_status);"`
	Repl_Delay  string `orm:"column(repl_delay);"`
	Is_Switch   int    `orm:"column(is_switch);"`
}

func ListDr

func ListDr(condArr map[string]string, page int, offset int) (num int64, err error, dr []Dr)

获取容灾列表

func ListOracleDr

func ListOracleDr(condArr map[string]string, page int, offset int) (num int64, err error, dr []Dr)

获取Oracle容灾列表

type DrMSSqlPrimary

type DrMSSqlPrimary struct {
	Id                 int    `orm:"pk;column(id);"`
	Dr_Id              int    `orm:"column(dr_id);"`
	Db_Id              int    `orm:"column(db_id);"`
	Database_Id        int    `orm:"column(database_id);"`
	Db_Name            string `orm:"column(db_name);"`
	Role               int    `orm:"column(role);"`
	State              int    `orm:"column(state);"`
	State_Desc         string `orm:"column(state_desc);"`
	Safety_Level       int    `orm:"column(safety_level);"`
	Partner_Name       string `orm:"column(partner_name);"`
	Partner_Instance   string `orm:"column(partner_instance);"`
	Failover_Lsn       int64  `orm:"column(failover_lsn);"`
	Connection_Timeout int    `orm:"column(connection_timeout);"`
	Redo_Queue         int    `orm:"column(redo_queue);"`
	End_Of_Log_Lsn     int64  `orm:"column(end_of_log_lsn);"`
	Replication_Lsn    int64  `orm:"column(replication_lsn);"`
	Created            int64  `orm:"column(created);"`
}

func GetDrMSSqlPrimaryInfo

func GetDrMSSqlPrimaryInfo(db_id int) (DrMSSqlPrimary, error)

type DrMSSqlStandby

type DrMSSqlStandby struct {
	Id                 int    `orm:"pk;column(id);"`
	Dr_Id              int    `orm:"column(dr_id);"`
	Db_Id              int    `orm:"column(db_id);"`
	Database_Id        int    `orm:"column(database_id);"`
	Db_Name            string `orm:"column(db_name);"`
	Master_Server      string `orm:"column(master_server);"`
	Master_Port        string `orm:"column(master_port);"`
	Role               int    `orm:"column(role);"`
	State              int    `orm:"column(state);"`
	State_Desc         string `orm:"column(state_desc);"`
	Safety_Level       int    `orm:"column(safety_level);"`
	Partner_Name       string `orm:"column(partner_name);"`
	Partner_Instance   string `orm:"column(partner_instance);"`
	Failover_Lsn       int64  `orm:"column(failover_lsn);"`
	Connection_Timeout int    `orm:"column(connection_timeout);"`
	Redo_Queue         int    `orm:"column(redo_queue);"`
	End_Of_Log_Lsn     int64  `orm:"column(end_of_log_lsn);"`
	Replication_Lsn    int64  `orm:"column(replication_lsn);"`
	Created            int64  `orm:"column(created);"`
}

func GetDrMSSqlStandbyInfo

func GetDrMSSqlStandbyInfo(db_id int) (DrMSSqlStandby, error)

type DrMySQLPrimary

type DrMySQLPrimary struct {
	Id             int    `orm:"pk;column(id);"`
	Dr_Id          int    `orm:"column(dr_id);"`
	Db_Id          int    `orm:"column(db_id);"`
	Read_Only      string `orm:"column(read_only);"`
	Gtid_Mode      string `orm:"column(gtid_mode);"`
	M_Binlog_File  string `orm:"column(master_binlog_file);"`
	M_Binlog_Pos   string `orm:"column(master_binlog_pos);"`
	M_Binlog_Space int64  `orm:"column(master_binlog_space);"`
	Created        int64  `orm:"column(created);"`
}

func GetDrMySqlPrimaryInfo

func GetDrMySqlPrimaryInfo(db_id int) (DrMySQLPrimary, error)

type DrMySQLStandby

type DrMySQLStandby struct {
	Id             int    `orm:"pk;column(id);"`
	Dr_Id          int    `orm:"column(dr_id);"`
	DB_Id          int    `orm:"column(db_id);"`
	Read_Only      string `orm:"column(read_only);"`
	Gtid_Mode      string `orm:"column(gtid_mode);"`
	M_Server       string `orm:"column(master_server);"`
	M_Port         string `orm:"column(master_port);"`
	Slave_IO_Run   string `orm:"column(slave_io_run);"`
	Slave_SQL_Run  string `orm:"column(slave_sql_run);"`
	Delay          int    `orm:"column(delay);"`
	C_Binlog_File  string `orm:"column(current_binlog_file);"`
	C_Binlog_Pos   string `orm:"column(current_binlog_pos);"`
	M_Binlog_File  string `orm:"column(master_binlog_file);"`
	M_Binlog_Pos   string `orm:"column(master_binlog_pos);"`
	M_Binlog_Space int64  `orm:"column(master_binlog_space);"`
	Created        int64  `orm:"column(created);"`
}

func GetDrMySqlStandbyInfo

func GetDrMySqlStandbyInfo(db_id int) (DrMySQLStandby, error)

type DrPrimary

type DrPrimary struct {
	DB_Id          int    `orm:"pk;column(db_id);"`
	Check_Seq      string `orm:"column(check_seq);"`
	Dest_Id        int    `orm:"column(dest_id);"`
	Transmit_Mode  string `orm:"column(transmit_mode);"`
	Thread         int    `orm:"column(thread);"`
	Sequence       int    `orm:"column(sequence);"`
	Curr_Scn       int64  `orm:"column(curr_scn);"`
	Curr_Db_Time   string `orm:"column(curr_db_time);"`
	Archived_delay int    `orm:"column(archived_delay);"`
	Applied_delay  int    `orm:"column(applied_delay);"`
	Created        int64  `orm:"column(created);"`
}

func GetPrimaryDrInfo

func GetPrimaryDrInfo(db_id int) (DrPrimary, error)

type DrStandby

type DrStandby struct {
	DB_Id        int    `orm:"pk;column(db_id);"`
	Thread       int    `orm:"column(thread);"`
	Sequence     int    `orm:"column(sequence);"`
	Block        string `orm:"column(block);"`
	Delay_Mins   int    `orm:"column(delay_mins);"`
	Apply_Rate   string `orm:"column(apply_rate);"`
	Curr_Scn     int64  `orm:"column(curr_scn);"`
	Curr_Db_Time string `orm:"column(curr_db_time);"`
	Mrp_Status   string `orm:"column(mrp_status);"`
	Created      int64  `orm:"column(created);"`
}

func GetStandbyDrInfo

func GetStandbyDrInfo(db_id int) (DrStandby, error)

type MSSqlInstance

type MSSqlInstance struct {
	Id            int    `orm:"pk;column(id);"`
	Asset_Type    int    `orm:"column(asset_type);"`
	Connect       int    `orm:"column(connect);"`
	Instance_name string `orm:"column(instance_name);"`
	Db_Name       string `orm:"column(db_name);"`
	Host          string `orm:"column(host);"`
	Port          string `orm:"column(port);"`
	Role          string `orm:"column(role);"`
	Version       string `orm:"column(version);"`
	Created       int64  `orm:"column(created);"`
}

func GetMSSqlBasicInfo

func GetMSSqlBasicInfo(db_id int) (MSSqlInstance, error)

type MySQLInstance

type MySQLInstance struct {
	Id            int    `orm:"pk;column(id);"`
	Asset_Type    int    `orm:"column(asset_type);"`
	Connect       int    `orm:"column(connect);"`
	Instance_name string `orm:"column(instance_name);"`
	Db_Name       string `orm:"column(db_name);"`
	Host          string `orm:"column(host);"`
	Port          string `orm:"column(port);"`
	Role          string `orm:"column(role);"`
	Version       string `orm:"column(version);"`
	Created       int64  `orm:"column(created);"`
}

func GetMySQLBasicInfo

func GetMySQLBasicInfo(db_id int) (MySQLInstance, error)

type OracleInstance

type OracleInstance struct {
	Id              int    `orm:"pk;column(id);"`
	Asset_Type      int    `orm:"column(asset_type);"`
	Connect         int    `orm:"column(connect);"`
	Instance_name   string `orm:"column(instance_name);"`
	Db_Name         string `orm:"column(db_name);"`
	Host            string `orm:"column(host);"`
	Port            string `orm:"column(port);"`
	Role            string `orm:"column(inst_role);"`
	Version         string `orm:"column(version);"`
	Open_Mode       string `orm:"column(open_mode);"`
	Flashback_On    string `orm:"column(flashback_on);"`
	Flashback_Usage string `orm:"column(flashback_usage);"`
	Created         int64  `orm:"column(created);"`
}

func GetOracleBasicInfo

func GetOracleBasicInfo(db_id int) (OracleInstance, error)

type OsInfo

type OsInfo struct {
	DB_Id       int    `orm:"pk;column(db_id);"`
	Host        string `orm:"column(host);"`
	Port        string `orm:"column(os_port);"`
	Os_Type     string `orm:"column(os_type);"`
	Os_Protocol string `orm:"column(os_protocol);"`
	Os_Username string `orm:"column(os_username);"`
	Os_Password string `orm:"column(os_password);"`
}

type Process

type Process struct {
	Time         string
	Process_desc string
}

func GetOPProcessById

func GetOPProcessById(op_id int64) ([]*Process, error)

type Redo

type Redo struct {
	Key_Time string `orm:"pk;column(key_time);"`
	Value    int    `orm:"column(redo_log);"`
}

func GetOracleRedo

func GetOracleRedo(db_id int) ([]Redo, error)

type RestorePoint

type RestorePoint struct {
	Name string `orm:"column(name);"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL