文章目录

今天很郁闷。真的很郁闷。。

上次配置M/S很正常。今天却因为根分区满了,查找了半天的原因。哎。

记录下配置这程吧。

master:

server-id = 1
log-bin = /data/mysql/3306/logs/binlog/mysql-bin
log-error = /data/mysql/3306/logs/error.log
`</pre>
添加同步账号:
<pre>`GRANT REPLICATION SLAVE ON *.*  TO 'repl'@'%.mydomain.com' IDENTIFIED BY 'slavepass';`</pre>
slave 端:
<pre>`server-id = 3
master-host=master'ip
master-user=slave
master-password=sinaedgeslave
master-port=3306
master-connect-retry=10`</pre>
master 开二个终端,锁表:记录值
<pre>`FLUSH TABLES WITH READ LOCK;`</pre>
<pre>`show master status;

+------------------+----------+--------------+------------------+

| File             | Position | Binlog_Do_DB | Binlog_Ignore_DB |

+------------------+----------+--------------+------------------+

| mysql-bin.000011 |  1138574 |              |                  |

+------------------+----------+--------------+------------------+

1 row in set (0.00 sec)`</pre>
打包data文件,然后 scp至slave 。解压。如果是首次同步最好是重启下slave库。

slave : change
<pre>`slave stop;`</pre>
<pre>`CHANGE MASTER TO  MASTER_LOG_FILE='mysql-bin.000011', MASTER_LOG_POS=1140568;`</pre>
master 解锁: unlock tables;
<pre>`show slave status\G; `</pre>
看到2个YES

我这里在COPY的时候出一个错误。
<pre>`ERROR 29 (HY000): File './mysql-relay-bin.index' not found (Errcode: 2) 

只需要删除 relay info 然后 重启就OK了

文章目录