Create MySQL from library

Source: Internet
Author: User

We know that Oracle has dataguard real-time backup data, you can make the switch, and MySQL also has its own set of program, called Master-slave replication.

To build MySQL from the library is to synchronize the main library data in real time, and also to share the reading pressure of the main library, and to make a read-write separation structure to the database end.

To build MySQL master and slave library note points:

1. The main library and the Server-id from the library must not be the same.

2. Create the replication slave account in the main library.

Grant replication slave on *.* to ' repl ' @ ' 192.168.0.232 ' identified ' Oracle ';

3. View Master Library Master Status

Mysql> Show Master status/g

1. Row ***************************

file:mysql-bin.000005

position:251651

binlog_do_db:

binlog_ignore_db:

1 row in Set (0.00 sec)

4. Configure from Library

Change Master to

-> master_host= ' 192.168.0.232 ',

-> master_user= ' Repl ',

-> master_password= ' Oracle ',

-> master_log_file= ' mysql-bin.000005 ',

-> master_log_pos=251651;

5. Start from library

Slave start

Show Slave status/g

1. Row ***************************

Slave_io_state:waiting for Master to send event

Master_host: ***********

Master_user:repl

master_port:3306

Connect_retry:60

master_log_file:mysql-bin.000005

read_master_log_pos:463725968

relay_log_file:mysql-relay-bin.000006

relay_log_pos:463726114

relay_master_log_file:mysql-bin.000005

Slave_io_running:yes

Slave_sql_running:yes

replicate_do_db: ******************

replicate_ignore_db:

Replicate_do_table:

Replicate_ignore_table:

Replicate_wild_do_table:

Replicate_wild_ignore_table:

last_errno:0

Last_error:

skip_counter:0

exec_master_log_pos:463725968

relay_log_space:873569451

Until_condition:none

Until_log_file:

until_log_pos:0

Master_ssl_allowed:no

Master_ssl_ca_file:

Master_ssl_ca_path:

Master_ssl_cert:

Master_ssl_cipher:

Master_ssl_key:

seconds_behind_master:0

Master_ssl_verify_server_cert:no

last_io_errno:0

Last_io_error:

last_sql_errno:0

Last_sql_error:

Replicate_ignore_server_ids:

master_server_id:100

Attention:

If you slave_io_running:no/slave_sql_running:no from the library

Close slave

Sets the set globalsql_slave_skip_counter=1;

In the Open slave

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.