Showing posts with label mysqlrplms utility in MySQL. Show all posts
Showing posts with label mysqlrplms utility in MySQL. Show all posts

July 5, 2021

MySQL mysqlrplms utility cheatsheet

mysqlrplms utility in MySQL

mysqlrplms - establish multi source/master replication - to set up and start replication from a Slave to Multiple Masters/sources
mysqlrplms --help
mysqlrplms --version
Usage: mysqlrplms --slave=root@localhost:3306 --masters=root@localhost:3310,root@localhost:3311 --rpl-user=rpl:passwd

mysqlrplms --slave=root:root@localhost:3306 --masters=root:root@localhost:3307,root:root@localhost:3308
mysqlrplms --slave=root:root@localhost:3306 --masters=root:root@localhost:3307,root:root@localhost:3308 --report-values=health,gtid,uuid

The mysqlrplms utility is used to setup round robin multi-source replication.
This technique can be a solution for aggregating streams of data from multiple masters for a single slave.
A round-robin scheduling is used to setup replication among the masters and slave.

# Basic multi-source replication setup.
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3306,root:pass@host3:3306
$ mysqlrplms --slave=slave10 --masters=master2,master66

# Multi-source replication setup using a different report values.
$ mysqlrplms --slave=root:pass@host1:3306 --masters=master11,master12 --report-values=gtid,uuid
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3309,root:pass@host3:3308 --report-values=health,gtid,uuid
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3309,root:pass@host3:3308 --report-values=health,uuid --vv --format=FORMAT=tab --interval=10

# Start multi-source replication running as a daemon. (POSIX only)
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3306,root:pass@host3:3306 --log=mysql_rplms_daemon.log --pidfile=mysql_rplms_daemon.pid --daemon=start
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3306,master4 --log=mysql_rplms_daemon.log --pidfile=mysql_rplms_daemon.pid --daemon=start

# Restart a multi-source replication running as a daemon.
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3311,root:pass@host3:3313 --log=mysql_rplms_daemon.log --pidfile=mysql_rplms_daemon.pid --daemon=restart
$ mysqlrplms --slave=slave11 --masters=master3311,master3313 --log=mysql_rplms_daemon.log --pidfile=mysql_rplms_daemon.pid --daemon=restart

# Stop a multi-source replication running as a daemon.
$ mysqlrplms --slave=slave --masters=master1,master2 --log=mysql_rplms_daemon.log --pidfile=rplms_daemon.pid --daemon=stop
$ mysqlrplms --slave=root:pass@host1:3306 --masters=root:pass@host2:3306,root:pass@host3:3306 --log=mysql_rplms_daemon.log --pidfile=mysql_rplms_daemon.pid --daemon=stop
$ mysqlrplms --slave=slave --masters=master1,master2 --log=mysql_rplms_daemon.log --pidfile=rplms_daemon.pid --daemon=stop --verbose --format=FORMAT=csv


mysqlrplms Options:
  --version             show program's version number and exit
  --help                 display a help message and exit
  --license             display program's license and exit
  -i INTERVAL, --interval=INTERVAL   interval in seconds for reporting health. Default = 15 seconds. Lowest value is 5 seconds.
  --switchover-interval=SWITCHOVER_INTERVAL   interval in seconds for switching masters. Default = 60 seconds. Lowest value is 30 seconds.

  --slave=SLAVE             connection information for slave server in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]]
  --masters=MASTERS     connection information for master servers in the form: user[:password]@host[:port][:socket] or login-path[:port][:socket] or config- path[[group]]. List multiple master in comma- separated list.
  --rpl-user=RPL_USER         user and password for the replication user requirement, in the form: user[:password] or login-path. E.g. rpl:passwd
  -b, --start-from-beginning   start replication from the first event recorded in the binary logging of the masters.

  --report-values=REPORT_VALUES    report values used in multi-source replication. It can be health, gtid or uuid. Multiple values can be used separated by commas. The default is health.
  -f FORMAT, --format=FORMAT    display the output in either grid (default), tab, csv, or vertical format
  --daemon=DAEMON      run on daemon mode. It can be start, stop, restart or nodetach.
  --pidfile=PIDFILE          pidfile for running mysqlrplms as a daemon.
  --log=LOG_FILE           specify a log file to use for logging messages
  --log-age=LOG_AGE     specify maximum age of log entries in days. Entries older than this will be purged on startup. Default = 7 days.

  --ssl-ca=SSL_CA         path to a file that contains a list of trusted SSL CAs.
  --ssl-cert=SSL_CERT   name of the SSL certificate file to use for  establishing a secure connection.
  --ssl-key=SSL_KEY     name of the SSL key file to use for establishing a secure connection.
  --ssl=SSL                   specifies if the server connection requires use of SSL. If an encrypted connection cannot be established, the connection attempt fails. By default 0 (SSL not required).
  -v, --verbose             control how much information is displayed. e.g., -v =  verbose, -vv = more verbose, -vvv = debug
  -q, --quiet                  turn off all messages for quiet execution.

The mysqlrplms utility follows these assumptions [or] pre-requisites to use mysqlrplms utility :
  • All servers have GTIDs enabled.
  • There are no conflicts between transactions from different sources/masters.
  • For example, there are no updates to the same object from multiple masters.
  • Replication is asynchronous.

Helpful Hints of mysqlrplms
-------------------------------
  - The default report value is 'health'.
    This value can be changed with the --report-values option. It can be 'health', 'gtid' or 'uuid'. Multiple values can be used separated by commas.

  - The default output for reporting health is 'grid'.
    This value can be changed with the --format option. It can be 'grid', 'tab', 'csv' or 'vertical' format.

  - The default interval for reporting health is 15 seconds.
    This value can be changed with the --interval option.

  - The default interval for switching masters is 60 seconds.
    This value can be changed with the --switchover-interval option.


Related MySQL Articles: