<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[静怡家园]]></title> 
<link>http://www.zhanghaijun.com/index.php</link> 
<description><![CDATA[书山有路勤为径，学海无涯苦作舟！]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[静怡家园]]></copyright>
<item>
<link>http://www.zhanghaijun.com/post//</link>
<title><![CDATA[MySQL 5.0.15数据同步备份(master-slave)]]></title> 
<author>碟舞飞扬 &lt;webmaster@zhanghaijun.com&gt;</author>
<category><![CDATA[数据库类]]></category>
<pubDate>Fri, 16 Jun 2006 12:33:14 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//</guid> 
<description>
<![CDATA[ 
	平台说明：<br/>192.168.200.102=>master<br/>192.168.200.101=>slave<br/>Mysql版本：Mysql 5.0.15<br/>操作系统：Fc3 内核：2.6.9<br/><br/>(1)配置主服务器<br/>#vi /etc/my.cnf<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>[mysqld]<br/>log-bin=hnolwebserver-bin //日志文件的名称，这里可以制定日志到别的目录 如果没有设置则默认主机名的一个日志名称<br/>server-id = 1 //数据库的id这个应该默认是1就不用改动<br/>binlog-do-db=tianya //需同步的数据库，多数据库用binlog-do-db=tianya1。<br/>character-set-server=gb2312 //设置支持gb2312的字符集。<br/></div></div><br/>#/usr/local/mysql/bin/mysql -u root -p<br/>#建tianya数据库。<br/>#mysql>GRANT REPLICATION SLAVE ON *.* TO 'backup'@'192.168.200.101' IDENTIFIED BY '123456'; #添加一个主机为192.168.200.101的backup帐号，具有全局REPLICATION SLAVE权限。<br/>在phpMyAdmin中导出tianya数据库的SQL数据为tianya.sql。<br/>#mysql>show master status&#92;G;<br/>*************************** 1. row ***************************<br/>File: hnolwebserver-bin.000010<br/>Position: 649<br/>Binlog_Do_DB: tianya<br/>Binlog_Ignore_DB: <br/>1 row in set (0.01 sec)<br/>记下File与Position在设置从服务中需要用到。<br/><br/>(2)配置从服务器<br/>修改/etc/my.cnf，如是多实例Msyql，则修改my_multi.cnf中的任一个实例定义中。<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>[mysqld]<br/>master-host=192.168.200.102 #主服务端主机<br/>master-user=backup #主服务端开设的帐号<br/>master-password=123456 #主服务端开设的密码<br/>master-port=3306 #主服务端Mysql端口<br/>server-id=2 #设置数据库id默认主服务器是1可以随便设置但是如果有多台从服务器则不能重复。<br/>master-connect-retry=60 #如果从服务器发现主服务器断掉，重新连接的时间差<br/>replicate-do-db=tianya #同步的数据库<br/>character-set-server=gb2312 #设置中文字符集。<br/></div></div><br/>将tianya.sql导入到从服务器中。与主服务器数据库一致.<br/>#/usr/local/mysql/bin/mysql -u root -p<br/>设置主服务器的各种参数:<br/><div class="quote"><div class="quote-title">引用</div><div class="quote-content"><br/>#mysql>slave stop; #停止slave的服务<br/>#mysql>CHANGE MASTER TO<br/>#mysql>MASTER_HOST='192.168.200.102',#主服务器的IP地址<br/>#mysql>MASTER_USER='backup', #同步数据库的用户<br/>#mysql>MASTER_PASSWORD='123456', #同步数据库的密码<br/>#mysql>MASTER_LOG_FILE='hnolwebserver-bin.000016', #主服务器二进制日志的文件名(前面要求记住的参数)<br/>#mysql>MASTER_LOG_POS=2567; #日志文件的开始位置(前面要求记住的参数)<br/>#mysql>slave start; #启动同步数据库的线程<br/></div></div><br/>Tags - <a href="http://www.zhanghaijun.com/tags/mysql%25E4%25B8%25BB%25E4%25BB%258E%25E5%25A4%258D%25E5%2588%25B6/" rel="tag">mysql主从复制</a>
]]>
</description>
</item><item>
<link>http://www.zhanghaijun.com/post//#blogcomment</link>
<title><![CDATA[[评论] MySQL 5.0.15数据同步备份(master-slave)]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>http://www.zhanghaijun.com/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>