Centos6,mysql 5.5 Configuring master \ Slave Data Synchronization Backup

Source: Internet
Author: User

  1. Database A as the primary service, database B as a synchronous library (note: Both sides of the database library must be one, or there will be constant error information out, change, change, is not successful)
  2. 1. Configure Master
  3. Vi/etc/my.cnf
  4. [Mysqld]
  5. server-id=1
  6. log-bin=Log Path
  7. binlog-do-db=xxxx//means to back up only xxxx This library, you can configure multiple libraries
  8. binlog-ignore-db=yyy//indicates ignoring YYY library
  9. Note: If BINLOG-DO-DB,BINLOG-IGNORE-DB does not add the default backup of all libraries
  10. Restart database service mysqld restart
  11. Login to Database mysql-uroot-p123456
  12. Create a backup account, preferably with slave, reload,super, permissions
  13. Grant Peplication slave,reload,super on * * to ' backup ' @ ' percent ' identfiend by ' 1234 ' with GRANT option;
  14. Note: This must be available with GRANT option, which indicates that backup has operational permissions
  15. Flush privileges;
  16. Show grant for ' backup ' @ '% '; View User
  17. Show master status;
  18. If the IP address changes:
  19. Change Master to master_host=' xxx ',master_user=' backup ',master_password=' 1234 ',Master _port=' 3306 ',master_log_file=' master-log.000001 ',master_log_pos=4, master_connect_  retry=10;
  20. 2, configuration slave
  21. Vi/etc/my.cnf
  22. Server-id=2
  23. Change Master to master_host=' xxx ',master_user=' backup ',master_password=' 1234 ',Master _port=' 3306 ',master_log_file=' master-log.000001 ',master_log_pos=4, master_connect_  retry=10;
  24. Note: Log name, user name, password must be with Master one to
  25. show slave status\g;
  26. See if the information is correct
  27. Slave start;
  28. With show slave status\g;
  29. Just make sure:
  30. slave_io_running=Yes
  31. slave_sql_running=Yes
  32. It's done.
  33. I've got 2 questions.
  34. The first one:
  35. slave_io_running=connecting
  36. slave_sql_running=Yes
  37. Last_io_error:error Connecting Master ...
  38. Looking for long time, the original user name password is wrong, it is a waste of time
  39. The second one: (A little dizzy)
  40. slave_io_running=No
  41. slave_sql_running=Yes
  42. Last_io_error: means that both the library and the table one to the synchronization did not find the corresponding libraries and tables
  43. And then:
  44. Slave stop;
  45. Reset slave; Reset Slave
  46. Change Master to master_host=' xxx ',master_user=' backup ',master_password=' 1234 ',Master _port=' 3306 ',master_log_file=' master-log.000001 ',master_log_pos=4, master_connect_  retry=10;
  47. Again, no way, finally see
  48. slave_io_running=Yes
  49. slave_sql_running=Yes
  50. Last_io_error: Empty
  51. The DBA's job is really a careful person to play

Centos6,mysql 5.5 Configuring master \ Slave Data Synchronization Backup

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.