Documentation ¶
Index ¶
- type ProbeResult
- type ProxySQL
- func (p *ProxySQL) Conn() *sql.DB
- func (p *ProxySQL) Core()
- func (p *ProxySQL) DumpData()
- func (p *ProxySQL) DumpQueryDigests(tmpdir string) (string, error)
- func (p *ProxySQL) DumpQueryRuleStats(tmpdir string) (string, error)
- func (p *ProxySQL) DumpQueryRules(tmpdir string) (string, error)
- func (p *ProxySQL) GetBackends() (map[string]int, error)
- func (p *ProxySQL) GetMissingCorePods() (int, error)
- func (p *ProxySQL) New(configs *configuration.Config) (*ProxySQL, error)
- func (p *ProxySQL) Ping() error
- func (p *ProxySQL) ProbeClients() (int, error)
- func (p *ProxySQL) RunProbes() (ProbeResult, error)
- func (p *ProxySQL) Satellite()
- func (p *ProxySQL) SatelliteResync() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ProbeResult ¶
type ProbeResult struct { Status string `json:"status,omitempty"` Message string `json:"message,omitempty"` Clients int `json:"clients,omitempty"` Draining bool `json:"draining,omitempty"` Probe string `json:"probe,omitempty"` Backends struct { Total int `json:"total,omitempty"` Online int `json:"online,omitempty"` } `json:"backends,omitempty"` }
type ProxySQL ¶
type ProxySQL struct {
// contains filtered or unexported fields
}
func (*ProxySQL) Core ¶
func (p *ProxySQL) Core()
ProxySQL core functions.
The core pods need to run certain commands when specific pods joins or leaves the cluster, so this function sets up an informer that watches the k8s pods and runs functions when pods change.
Joining:
When a new core pod joins the cluster, one of two things happen:
- if it's the first core pod, it uses the podAdded callback to add itself to the proxysql_servers table
- if other core pods are already running, one of them will use add the new pod via the podUpdated function
When a new satellite pod joins the cluster, the core pods all run the "LOAD X TO RUNTIME" commands, which accepts the new pod and distributes the configuration to it.
Leaving:
- When a satellite pod leaves the cluster, nothing needs to be done.
- When a core pod leaves the cluster, the remaining core pods all delete that pod from the proxysql_servers table and run all of the LOAD X TO RUNTIME commands.
func (*ProxySQL) DumpData ¶
func (p *ProxySQL) DumpData()
data we eventually want to load into snowflake
- stats_mysql_query_digests (maybe use _reset to reset the state)
- mysql_query_rules
- stats_mysql_query_rules
FIXME: all these functions dump to /tmp/XXXX/Y.csv; we want the directory to be configurable at least.
func (*ProxySQL) DumpQueryDigests ¶
ProxySQL docs: https://proxysql.com/documentation/stats-statistics/#stats_mysql_query_digest
func (*ProxySQL) DumpQueryRuleStats ¶
ProxySQL docs: https://proxysql.com/documentation/stats-statistics/#stats_mysql_query_rules
func (*ProxySQL) DumpQueryRules ¶
ProxySQL docs: https://proxysql.com/documentation/main-runtime/#mysql_query_rules
func (*ProxySQL) GetMissingCorePods ¶
func (*ProxySQL) ProbeClients ¶
func (*ProxySQL) RunProbes ¶
func (p *ProxySQL) RunProbes() (ProbeResult, error)