本文主要向大家介绍了MySQL数据库之1分钟利用mysqlreplicate快速搭建MySQL主从 ,通过具体的内容向大家展现,希望对大家学习MySQL数据库有所帮助。
简介
mysql-utilities工具集是一个集中了多种工具的合集,可以理解为是DBA的工具箱,本文介绍利用其中的mysqlreplicate工具来快速搭建MySQL主从环境。
HE1:192.168.1.248 slave
HE3:192.168.1.250 master
实战
Part1:安装mysql-utilities
[root@HE1 ~]# tar xvf mysql-utilities-1.5.4.tar.gz
[root@HE1 ~]# cd mysql-utilities-1.5.4
[root@HE1 mysql-utilities-1.5.4]# python setup.py build
[root@HE1 mysql-utilities-1.5.4]# python setup.py install
Part2:基本使用方式[root@HE1 ~]# mysqlreplicate --helpMySQL Utilities mysqlreplicate version 1.5.4 License type: GPLv2Usage: mysqlreplicate --master=root@localhost:3306 --slave=root@localhost:3310 --rpl-user=rpl:passwd mysqlreplicate - establish replication with a masterOptions: --version show program's version number and exit --help display a help message and exit --license display program's license and exit --master=MASTER connection information for master server in the form: [:]@[:][:] or [:][:] or []. --slave=SLAVE connection information for slave server in the form: [:]@[:][:] or [:][:] or []. --rpl-user=RPL_USER the user and password for the replication user requirement, in the form: [:] or . E.g. rpl:passwd -p, --pedantic fail if storage engines differ among master and slave. --test-db=TEST_DB database name to use in testing replication setu