Install Mysql multi-instance in Linux as the data backup server to implement multi-master to one-slave multi-instance _ MySQL
Source: Internet
Author: User
Install Mysql multi-instance in Linux as the data backup server to implement multi-master to one backup bitsCN. com1 from multiple instances. download the MYSQL source code version from the MYSQL official website [must be the source code version]
2. press the following code to type the LINUX command line
[Note] adding mysql groups and users
# Groupadd mysql
# Useradd-g mysql
[Note] unpackage to/usr/local
# Tar-xzf mysql-standard-4.1.9-pc-linux-gnu-i686.tar.gz-C/usr/local
[Note] creating a soft link is convenient (this connection can be named mysql001 or another name)
# Cd/usr/local
# Ln-s mysql-standard-5.0.15-linux-i686-glibc23 mysql001
# Cd mysql001
# Scripts/mysql_install_db
# Chown-R root.
# Chown-R mysql data
# Chgrp-R mysql.
[Note] copy data for allocation of multiple instances in a single version
# Cp-a data data_1
# Cp-a data data_2
[Note] add a multi-instance configuration file
# Cd/usr/local/mysql001/bin
# Cat> my_multi.cnf
[Note] The following is the configuration information of my_multi.cnf, which can be copied accordingly.
[Mysqld_multi]
Mysqld =/usr/local/mysql001/bin/mysqld_safe
Mysqladmin =/usr/local/mysql001/bin/mysqladmin
User = root
Password = root
[Mysqld1]
Socket =/tmp/mysql_001.sock
Port = 3301
Pid-file =/usr/local/mysql001/data_1/hostname. pid
Datadir =/usr/local/mysql001/data_1
Log =/usr/local/mysql001/data_1/hostname. log
User = mysql
# Slave setting
Server-id = 2
Master-host = 192.168.1.85
Master-port = 3306
Master-user = backup
Masters-password = 123456
Replicate-do-db = gs_database
Replicate-do-db = gs_log
Master-connect-retry = 30
[Mysqld2]
Socket =/tmp/mysql_5_2.sock
Port = 3302
Pid-file =/usr/local/mysql001/data_2/hostname. pid
Datadir =/usr/local/mysql001/data_2
Log =/usr/local/mysql001/data_2/hostname. log
User = mysql
# Slave setting
Server-id = 3
Master-host = 192.168.1.69
Master-port = 3306
Master-user = backup
Masters-password = 123
Replicate-do-db = gs_databaes
Replicate-do-db = gs_log
Master-connect-retry = 30
Restart the system to make environment variables take effect.
Add to enable automatic start. [do not add this parameter here. you can decide whether to enable automatic start based on your situation]
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.