In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the one-master and multi-slave configuration handout of the Mysql5.5 version, hoping to supplement and update some knowledge for you. If you have any other questions you need to know, you can continue to follow my updated article in the industry information.
1) Experimental topology information
Mysql version: 5.5.32 (installation based on source code)
System version: CentOS6.7
10.10.10.129: the main CVM of mysql
10.10.10.130: slave server of mysql
Objective:
The landowners are subordinate to:
10.10.10.129 3306-> 10.10.10.129 3307
Master and follower from other places:
10.10.10.129 3306-> 10.10.10.130 3306
2) configuration on the main library
Prepare the test environment for mysql
First prepare the mysql multi-instance environment. I have written a blog before, so I will not repeat it here. You can refer to http://molewan.blog.51cto.com/287340/1860198.
B. Enable the binlog recording function on the main library (10.10.10.129)
# grep server-id / data/3306/my.cnf server-id = "grep server-id / data/3307/my.cnf server-id =" grep log-bin / data/3306/my.cnf log-bin = / data/3306/mysql-bin
Log in to the database to view:
# mysql-u root-S / data/3306/mysql.sock-predhat12345mysql > show variables like 'log_bin';+-+-+ | Variable_name | Value | +-+-+ | log_bin | ON | +-+-+ 1 row in set
C. Set up an account for master-slave replication
# mysql-u root-S / data/3306/mysql.sock-predhat12345mysql > grant replication slave on *. * to 'rep'@'10.10.10.%' identified by' redhat12345';Query OK, 0 rows affected (0.01 sec) mysql > flush privileges;Query OK, 0 rows affected (0.00 sec) mysql > select user,host from mysql.user +-+ | user | host | +-+-+ | wan |% | | rep | 10.10.10.% | wan | 10.10.10.0.1 | | root | 127.0.0.1 | | root |:: 1 | | C67-X64-A8 | | root | C67-X64-A8 | | localhost | | root | | Localhost | +-+-+ 9 rows in set (0.00 sec) mysql > select user Host from mysql.user where user='rep' +-+-+ | user | host | +-+-+ | rep | 10.10.10.% | +-+-+ 1 row in set (0.00 sec)
D. Realize the read-only lock table of the main database (do not close the current window)
Mysql > flush table with read lock;Query OK, 0 rows affected (0.00 sec) reopen a window, lock the table and check the status of the main library: # mysql-uroot-S / data/3306/mysql.sock-predhat12345mysql > show master status +-+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +-- -+-+ | mysql-bin.000004 | 337 | +-+ 1 row in set (0.00 sec)
E. Use mysqldump for database backup:
# mysqldump-uroot-paired redhat12345'-S / data/3306/mysql.sock-- events-A-B | gzip > / mysqlback/mysql_bak.$ (date +% F). Sql.gz# echo $? the total amount of ls-l / mysqlback/ is 144 root root Rwashi-1 root root 144402 October 9 02:54 mysql_bak.2016-10-09.sql.gz# du-sh / mysqlback/mysql_bak.2016-10-09.sql.gz 144K/mysqlback/ Mysql_bak.2016-10-09.sql.gz to ensure that during the export of data No data is inserted in the database You can check the status information of the main database again # mysql-uroot-S / data/3306/mysql.sock-predhat12345-e "show master status" +-+ | File | Position | Binlog_Do_DB | Binlog_Ignore_DB | +-+ | mysql-bin.000004 | 337 | +-+- -+
F. After exporting the data, unlock the main library and restore writable
Mysql > unlock tables;Query OK, 0 rows affected (0.01 sec)
3) configuration from the library
A, configuration on the 10.10.10.129 3307 database
# cd / mysqlback/# lsmysql_bak.2016-10-09.sql.gz# gzip-d mysql_bak.2016-10-09.sql.gz# lsmysql_bak.2016-10-09.sql# mysql-uroot-pendant redhat12345'-S / data/3307/mysql.sock
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.