MYSQL的主从
时间:2006-06-20 来源:我为鹤狂
mysql安装在/data2/mysql路径下,镜像建立在/data0/mysql-slave
******************************************
主库配置文件:
******************************************
bash-2.03# cat /data2/mysql/var/master.cnf
[mysqld]
set-variable = max_connections=500
log-bin
#binlog-do-db=test2
server-id=1
datadir = /data2/mysql/var
port = 3306
socket = /tmp/mysql.sock ****************************************** 从库配置文件: ****************************************** bash-2.03# cat /data2/mysql/var/slave.cnf
[client]
port = 3308
socket = /tmp/mysql3308.sock
[mysqld]
master-host=172.16.11.85
master-user=slave
master-password=slave
master-port=3306
server-id=2
datadir = /data0/mysql-slave
port = 3308
socket = /tmp/mysql3308.sock ****************************************** 故障恢复 ****************************************** data2所在的磁盘损坏,重新安装了一块。恢复过程如下 1.停掉从库; 2.复制从库/data0/mysql-slave下数据库对应的目录到/data2/mysql/var(这时主从库数据相同); 3.启动主库(主库恢复); /data2/mysql/bin/safe_mysqld --defaults-file=/data2/mysql/var/master.cnf & 4.修改/data0/mysql-slave/master.info,把前两行改为: 计算机名-bin.001 73 5.启动从库; /data2/mysql/bin/safe_mysqld --defaults-file=/data2/mysql/var/slave.cnf &
[mysqld]
set-variable = max_connections=500
log-bin
#binlog-do-db=test2
server-id=1
datadir = /data2/mysql/var
port = 3306
socket = /tmp/mysql.sock ****************************************** 从库配置文件: ****************************************** bash-2.03# cat /data2/mysql/var/slave.cnf
[client]
port = 3308
socket = /tmp/mysql3308.sock
[mysqld]
master-host=172.16.11.85
master-user=slave
master-password=slave
master-port=3306
server-id=2
datadir = /data0/mysql-slave
port = 3308
socket = /tmp/mysql3308.sock ****************************************** 故障恢复 ****************************************** data2所在的磁盘损坏,重新安装了一块。恢复过程如下 1.停掉从库; 2.复制从库/data0/mysql-slave下数据库对应的目录到/data2/mysql/var(这时主从库数据相同); 3.启动主库(主库恢复); /data2/mysql/bin/safe_mysqld --defaults-file=/data2/mysql/var/master.cnf & 4.修改/data0/mysql-slave/master.info,把前两行改为: 计算机名-bin.001 73 5.启动从库; /data2/mysql/bin/safe_mysqld --defaults-file=/data2/mysql/var/slave.cnf &
相关阅读 更多 +