Documentation
¶
Overview ¶
Package dbrepl holds the engine-level pieces of Postgres streaming and MySQL binlog replication that the container-backed database emulators share.
Index ¶
Constants ¶
const PasswordEnv = "REPL_KEY"
PasswordEnv is the container environment variable carrying the replication password into PGReplicaScript.
Variables ¶
var ErrNotStreaming = errors.New("replication is not running")
ErrNotStreaming is returned when a MySQL replica has no replication channel configured.
Functions ¶
func MySQLChangeSourceSQL ¶
MySQLChangeSourceSQL points a MySQL 8 replica at host:port with GTID auto-positioning and starts it.
func MySQLReplicaUserSQL ¶
MySQLReplicaUserSQL creates or resets the replication login on a MySQL source.
func PGHBAScript ¶
PGHBAScript appends a replication rule for user to the source's pg_hba.conf, once.
func PGReplicaRoleSQL ¶
PGReplicaRoleSQL creates or resets the replication login on a Postgres source.
func PGReplicaScript ¶
PGReplicaScript is a container entrypoint that seeds an empty PGDATA with pg_basebackup from the source ($1 host, $2 port) before handing over to the image entrypoint.
Types ¶
type Status ¶
Status is a replica's replication health as reported by its engine.
func InterpretMySQL ¶
InterpretMySQL turns a lower-cased SHOW REPLICA STATUS row into a Status.