proxysql

package
v1.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: BSD-3-Clause Imports: 19 Imported by: 0

Documentation

Index

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) Conn

func (p *ProxySQL) Conn() *sql.DB

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

  1. stats_mysql_query_digests (maybe use _reset to reset the state)
  2. mysql_query_rules
  3. 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) DumpQueryRules

func (p *ProxySQL) DumpQueryRules(tmpdir string) (string, error)

ProxySQL docs: https://proxysql.com/documentation/main-runtime/#mysql_query_rules

func (*ProxySQL) GetBackends

func (p *ProxySQL) GetBackends() (map[string]int, error)

func (*ProxySQL) GetMissingCorePods

func (p *ProxySQL) GetMissingCorePods() (int, error)

func (*ProxySQL) New

func (p *ProxySQL) New(configs *configuration.Config) (*ProxySQL, error)

func (*ProxySQL) Ping

func (p *ProxySQL) Ping() error

func (*ProxySQL) ProbeClients

func (p *ProxySQL) ProbeClients() (int, error)

func (*ProxySQL) RunProbes

func (p *ProxySQL) RunProbes() (ProbeResult, error)

func (*ProxySQL) Satellite

func (p *ProxySQL) Satellite()

func (*ProxySQL) SatelliteResync

func (p *ProxySQL) SatelliteResync() error

Jump to

Keyboard shortcuts

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