MySQL Master/Slave Query

Source: Internet
Author: User

MASTER:
Show Master Status;-view status:
Show processlist;-view MySQL process information under slave
Reset master; # Use with caution to clear logs and synchronize the position

Slave end:
Show slave status;
Show slave logs;
Show processlist;
Reset slave; # use it with caution. The slave configuration information, logs, and Synchronization position will be cleared.
Skipping error events on the slave server
Mysql> stop slave;
Mysql> set global SQL _slave_skip_counter = N (skip the next n events in the master server. This command is valid for the termination of replication caused by statements. Valid only when the slave server thread is not running );
Mysql> Start slave;

The synchronization user on the MySQL master server must have the super, reload, and replication slave permissions.

When adding a new slave server, you must first load the data master on the slave database to ensure the data consistency with other slave databases.

Set global SQL _slave_skip_counter = N # Run the client to skip several events. It can be executed only when the synchronization process stops when an error occurs.

Reset master # run on the host to clear all logs. This command is the original flush master.

Reset slave # Run from the machine, clear the log synchronization location mark, and regenerate master.info

Although master.info is re-generated, it cannot be used. It is best to restart the MySQL process on the slave machine,

Load table tblname from Master
# When running from the slave machine, the data in the specified table can be re-viewed from the host. Only one table can be read at a time. Due to the timeout time limit, you need to adjust the timeout time. To execute this command, the synchronization account must have the reload and super permissions. And have the select permission on the corresponding database. If the table is large, add the net_read_timeout and net_write_timeout values.

Load data from master # Run from the slave machine and read all the data from the host. To execute this command, the synchronization account must have the reload and super permissions. And have the select permission on the corresponding database. If the table is large, add the net_read_timeout and net_write_timeout values.

Change master to master_def_list # online Change of some host settings. Separate multiple settings with commas (,). For example

Change master

Master_host = 'master2 .mycompany.com ',

Master_user = 'replicase ',

Master_password = 'bigs3cret'

Master_pos_wait () # Run from the slave machine

Show Master Status # Run the host and view the log export information

Show slave hosts # Run the host to check the connected slave machine.

Show slave status (slave)

Show Master logs (master)

Show BINLOG events [IN 'logname'] [from POS] [limit [offset,] rows]

Purge [Master] logs to 'logname'; purge [Master] logs before 'date'

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.