Documentation
¶
Index ¶
Constants ¶
const ( //ClusterStateFlagNew used to indicate that the cluster is new ClusterStateFlagNew = "new" //ClusterStateFlagExisting used to indicate that the cluster is exist ClusterStateFlagExisting = "existing" )
const ( //ServerRunningStatus means server is running ServerRunningStatus = "running" //ServerStoppedStatus means server has stopped ServerStoppedStatus = "stopped" )
const ( //MaxRequestBytes is max size of request transfer in raft cluster, 20MB MaxRequestBytes uint64 = 20 * 1024 * 1024 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Attributes ¶
type Attributes struct {
ID types.ID `json:"id"`
Name string `json:"name"`
AdminURLs []string `json:"admin_urls"`
}
Attributes is raft node attributes, including admin url
func (*Attributes) EncodeWithType ¶
func (a *Attributes) EncodeWithType() ([]byte, error)
EncodeWithType implements encode Attributes to byte,the first byte is type apply function will Identify the type using the byte.
type BinlogServerConfig ¶
type BinlogServerConfig struct {
Addr string `json:"addr"`
// User is for MySQL user.
User string `json:"user"`
// Password is for MySQL password.
Password string `json:"password"`
}
BinlogServerConfig is the argument to start a binlog master
func (*BinlogServerConfig) Check ¶
func (s *BinlogServerConfig) Check(kingbusIP string) error
Check the correctness of BinlogServerConfig
type BinlogServerStatus ¶
type BinlogServerStatus struct {
BinlogServerConfig
Slaves []*mysql.Slave `json:"slaves"`
CurrentGtid string `json:"current_gtid"`
LastBinlogFile string `json:"last_binlog_file"`
LastFilePosition uint32 `json:"last_file_position"`
ExecutedGtidSet string `json:"executed_gtid_set"`
PurgedGtidSet string `json:"purged_gtid_set"`
Status string `json:"status"`
}
BinlogServerStatus is the status of binlog master dump for user
type KingbusServerConfig ¶
type KingbusServerConfig struct {
RaftNodeCfg RaftNodeConfig
AdminURLs types.URLs
MetricsAddr string
LogDir string
LogLevel string
}
KingbusServerConfig is the config of kingbus server
func NewKingbusServerConfig ¶
func NewKingbusServerConfig(configPath string) (*KingbusServerConfig, error)
NewKingbusServerConfig implements create a config of kingbus server
type MasterGtidPurged ¶
type MasterGtidPurged struct {
GtidPurged string `json:"gtid_purged"`
}
MasterGtidPurged is the value of of master gtid_purged.
func (*MasterGtidPurged) EncodeWithType ¶
func (s *MasterGtidPurged) EncodeWithType() ([]byte, error)
EncodeWithType implements encode Attributes to byte,the first byte is type apply function will Identify the type using the byte.
type RaftNodeConfig ¶
type RaftNodeConfig struct {
Name string
AppliedIndex uint64
PeerURLs types.URLs
InitialPeerURLsMap types.URLsMap
MaxRequestBytes uint64
HeartbeatMs time.Duration
ElectionTimeoutMs time.Duration
NewCluster bool
PreVote bool
DataDir string
ReserveDataSize int
StrictReconfigCheck bool
}
RaftNodeConfig is the config of raft node
func (*RaftNodeConfig) VerifyBootstrap ¶
func (c *RaftNodeConfig) VerifyBootstrap() error
VerifyBootstrap sanity-checks the initial config for bootstrap case and returns an error for things that should never happen.
func (*RaftNodeConfig) VerifyJoinExisting ¶
func (c *RaftNodeConfig) VerifyJoinExisting() error
VerifyJoinExisting sanity-checks the initial config for join existing cluster case and returns an error for things that should never happen.
type SubServerType ¶
type SubServerType int8
SubServerType is the type of sub server
const ( //SyncerServerType represent a binlog syncer SyncerServerType SubServerType = iota + 1 //BinlogServerType represent a binlog master BinlogServerType )
type SyncerArgs ¶
type SyncerArgs struct {
SyncerID int `json:"syncer_id"`
SynerUUID string `json:"syncer_uuid"`
MysqlAddr string `json:"mysql_addr"`
MysqlUser string `json:"mysql_user"`
MysqlPassword string `json:"mysql_password"`
SemiSync bool `json:"semi_sync"`
}
SyncerArgs is the argument to start a syncer
func (*SyncerArgs) EncodeWithType ¶
func (s *SyncerArgs) EncodeWithType() ([]byte, error)
EncodeWithType implements encode SyncerArgs to byte,the first byte is type apply function will Identify the type using the byte.
type SyncerConfig ¶
type SyncerConfig struct {
replication.BinlogSyncerConfig
MaxEventBytes uint64
}
SyncerConfig is the config of syncer in kingbus
func NewSyncerConfig ¶
func NewSyncerConfig(args *SyncerArgs) (*SyncerConfig, error)
NewSyncerConfig create a syncer config
type SyncerStatus ¶
type SyncerStatus struct {
SyncerArgs
CurrentGtid string `json:"current_gtid"`
LastBinlogFile string `json:"last_binlog_file"`
LastFilePosition uint32 `json:"last_file_position"`
ExecutedGtidSet string `json:"executed_gtid_set"`
PurgedGtidSet string `json:"purged_gtid_set"`
Status string `json:"status"`
}
SyncerStatus is the status of syncer dump for user