mysql AB复制
来源:互联网 发布:淘宝旺旺打不开 编辑:程序博客网 时间:2024/05/21 20:51
[root@station93 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
server-id=1
log-bin=mysql-bin
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[root@station93 mysql]# service mysqld restart
mysql> show master status\G
************************** 1. row ***************************
File: mysql-bin.000001
Position: 314
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
mysql> grant replication slave on *.* to slave@192.168.1.17 identified by '0987';
mysql> show grants for slave@192.168.1.17;
root@stu93 ~]#mysqldump --all-database -u root -p0987 > select.sql---备份数据库 (导出生产数据库)
[root@stu93 ~]#scp all.sql 192.168.0.16:/root 拷贝到从服务器上 ()
[root@stu93 var]# mysql -uroot -p0987
从配置
[root@station17 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
log-bin=station17_bin
server-id=2
master-host=192.168.1.93
master-user=slave1
master-password=123
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@station17 ~]# mysql -uroot -p123 <all.sql
[root@station17 ~]# mysql -uroot -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> stop slave
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_host='192.168.1.93',master_user='slave',master_log_file='mysql-bin.000001',master_log_pos=660;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
[root@station17 ~]# mysql -p123
mysql> show master status\G
*************************** 1. row ***************************
File: station17_bin.000001
Position: 98
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
mysql> grant replication slave on *.* to slave2@192.168.1.5 identified by '123';
mysql> show grants for slave2@192.168.1.5;
[root@station17 ~]# mysqldump --all-database -u root -p123 > select.sql
[root@station17 ~]# scp select.sql 192.168.1.5:/root
select.sql 100% 415KB 415.0KB/s 00:00
[root@station5 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
old_passwords=1
server-id=3
master-host=192.168.1.17
master-user=slave2
master-password=123
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@station5 ~]# mysql -uroot -p123 <select.sql
[root@station5 ~]# mysql -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_host='192.168.1.17',master_user='slave2',master_log_file='station17_bin.000001',master_log_pos=232;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
server-id=1
log-bin=mysql-bin
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[root@station93 mysql]# service mysqld restart
mysql> show master status\G
************************** 1. row ***************************
File: mysql-bin.000001
Position: 314
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
mysql> grant replication slave on *.* to slave@192.168.1.17 identified by '0987';
mysql> show grants for slave@192.168.1.17;
root@stu93 ~]#mysqldump --all-database -u root -p0987 > select.sql---备份数据库 (导出生产数据库)
[root@stu93 ~]#scp all.sql 192.168.0.16:/root 拷贝到从服务器上 ()
[root@stu93 var]# mysql -uroot -p0987
从配置
[root@station17 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
log-bin=station17_bin
server-id=2
master-host=192.168.1.93
master-user=slave1
master-password=123
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@station17 ~]# mysql -uroot -p123 <all.sql
[root@station17 ~]# mysql -uroot -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 14
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> stop slave
-> ;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_host='192.168.1.93',master_user='slave',master_log_file='mysql-bin.000001',master_log_pos=660;
Query OK, 0 rows affected (0.01 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
[root@station17 ~]# mysql -p123
mysql> show master status\G
*************************** 1. row ***************************
File: station17_bin.000001
Position: 98
Binlog_Do_DB:
Binlog_Ignore_DB:
1 row in set (0.00 sec)
mysql> grant replication slave on *.* to slave2@192.168.1.5 identified by '123';
mysql> show grants for slave2@192.168.1.5;
[root@station17 ~]# mysqldump --all-database -u root -p123 > select.sql
[root@station17 ~]# scp select.sql 192.168.1.5:/root
select.sql 100% 415KB 415.0KB/s 00:00
[root@station5 ~]# vim /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
user=mysql
old_passwords=1
server-id=3
master-host=192.168.1.17
master-user=slave2
master-password=123
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
[root@station5 ~]# mysql -uroot -p123 <select.sql
[root@station5 ~]# mysql -p123
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 6
Server version: 5.0.77 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> stop slave;
Query OK, 0 rows affected (0.00 sec)
mysql> change master to master_host='192.168.1.17',master_user='slave2',master_log_file='station17_bin.000001',master_log_pos=232;
Query OK, 0 rows affected (0.00 sec)
mysql> start slave;
Query OK, 0 rows affected (0.00 sec)
mysql> show databases;
- mysql AB复制攻略
- MySQL AB复制
- mysql AB复制
- mysql AB复制
- MySQL AB复制
- Mysql AB复制
- Mysql AB 复制
- mysql的AB复制
- MYSQL--ab复制
- MySQL AB复制
- MYSQL-AB复制/MYSQL+VSFTP
- mysql编译安装AB复制
- mysql快速配置AB复制
- MySQL AB复制&mysql-proxy读写分离
- mysql AB复制延迟配置工具
- MySql AB复制(主从复制)的基本原理与过程
- Mysql瘦身及双机热备(ab复制)方案:
- Mysql学习第四课02-冗余--复制AB-replication
- hibernate的一些面试题
- Android Studio 小提示,新建Activity
- 在ORACLE中实现SELECT TOP N的方法
- Android - Mac下反编译Apk(Windows同样适用)
- C++笔记 常量
- mysql AB复制
- ssh windos访问linux linux远程访问主机
- Win32多线程之事件(Event Objects)
- listView中多个listItem布局时,convertView缓存及使用
- IOS6 新特性之UIActivityViewController详解
- weblogic应用服务器
- 测试程序运行时间
- 必读文章
- 真传奇:看看这群清华学生的牛X岁月