Configure master-slave replication for MySQL 5.5

Source: Internet
Author: User

MySQL provides the master-slave replication function, which is similar to Oracle's slave uard. However, configuration and management are far simpler than slave uard, and there is no so-called physical slave database or logical slave database, there is no corresponding data protection mode, and only the master and slave database roles are provided. This architecture is widely used in major portals and game websites to provide the database read/write splitting function; in contrast, oracle's read/write function can be fully implemented with active standby uard in version 11. Otherwise, it can only use logical standby, but many data types and operations are not supported by the logical standby database!

I have previously used the master-slave architecture of MySQL and for read/write separation of CMS databases. It has a very painful experience. due to various reasons, the master-slave data is not synchronized, then, no additional synchronization mechanism is provided (not learned), so the master-slave architecture is often reconstructed at the end of work. The next step is to test the mha architecture on the MySQL5.5 platform, therefore, this article records how to build a master-slave Database Replication environment on the MySQL5.5 platform. In addition, MySQL's master-slave database can also be seen as MySQL's real-time backup, which has certain data disaster recovery functions, mySQL itself does not provide a hot backup tool similar to oracle rman. Therefore, in most scenarios, a real-time backup is performed on the database using the master and slave nodes for backup from time to time! PS: How does MySQL do incomplete restoration based on time or SCN? Do I really need to analyze binlogs one by one?

I. Create an account for replication on the master database and test the connection on the slave database.

  1. [Root @ dg53 ~] # Mysql
  2. Welcome to the MySQL monitor. Commands end with; or \ g.
  3. Your MySQL connection id is 1
  4. Server version: 5.5.25-log Source distribution
  5.  
  6. Copyright (c) 2000,201 1, Oracle and/or its affiliates. All rights reserved.
  7.  
  8. Oracle is a registered trademark of Oracle Corporation and/or its
  9. Affiliates. Other names may be trademarks of their respective
  10. Owners.
  11.  
  12. Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
  13.  
  14. Mysql>Grant replication slave on *. * to 'r _ test' @ '192. 168.123.14 'identified by '123 ';
  15. Query OK, 0 rows affected (0.00 sec)
  16.  
  17. [Root @ dg54 ~] # Mysql-u r_test-h 192.168.123.13-p
  18. Enter password:
  19. Welcome to the MySQL monitor. Commands end with; or \ g.
  20. Your MySQL connection id is 2
  21. Server version: 5.5.25-log Source distribution
  22.  
  23. Copyright (c) 2000,201 1, Oracle and/or its affiliates. All rights reserved.
  24.  
  25. Oracle is a registered trademark of Oracle Corporation and/or its
  26. Affiliates. Other names may be trademarks of their respective
  27. Owners.
  28.  
  29. Type 'help; 'or' \ H' for help. type' \ C' to clear the current input statement.
  30.  
  31. Mysql>Show databases;
  32. + -------------------- +
  33. | Database |
  34. + -------------------- +
  35. | Information_schema |
  36. | Test |
  37. + -------------------- +
  38. 2 rows in set (0.01 sec)
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next Page

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.