mysql> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.8.101
Master_User: rep1
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000003
Read_Master_Log_Pos: 235
Relay_Log_File: -relay-bin.000009
Relay_Log_Pos: 235
Relay_Master_Log_File: mysql-bin.000003
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 235
Relay_Log_Space: 235
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
1 row in set (0.00 sec)
|
mysql-proxy \
--proxy-backend-addresses=mysql_ip1:3306 \
--proxy-backend-addresses=mysql_ip2:3306
|
mysql-proxy
--proxy-backend-addresses=<master_ip> :3306\
--proxy-read-only-address=<slave_ip1>:3306 \
--proxy-read-only-address=<slave_ip2>:3306
|
mysql> create database first_db;
Query OK, 1 row affected (0.01 sec)
在主数据库服务器创建库first_db
mysql> create table first_tb(id int(3),name char(10));
Query OK, 0 rows affected (0.00 sec)
在主数据库服务器创建表first_db
mysql> insert into first_tb values (001,'myself');
Query OK, 1 row affected (0.00 sec)
在主数据服务器的表first_db中插入记录
|
mysql> show databases;
+--------------------+
| Database|
+--------------------+
| information_schema |
| first_db|
| mysql|
| test|
+--------------------+
4 rows in set (0.01 sec)
数据库自动生成了
mysql> use first_db;
Database changed
mysql> show tables;
+--------------------+ | Tables_in_first_db | +--------------------+ | first_tb | +--------------------+ 1 row in set (0.00 sec)
表也自动生成了
mysql> select * from first_tb;
+------+--------+ | id | name | +------+--------+ | 1 | myself | +------+--------+ 1 row in set (0.00 sec)
记录也按照我们的意愿存在了
|