新聞中心
此文文章主要向大家講述的是MySQL5 master slave安裝與配置日志的實(shí)際操作步驟,首先我們是從MySQL5 master slave安裝與配置日志的背景開始講起的,下面就是文章的主要內(nèi)容的具體描述。

做網(wǎng)站、成都網(wǎng)站建設(shè)的開發(fā),更需要了解用戶,從用戶角度來建設(shè)網(wǎng)站,獲得較好的用戶體驗(yàn)。成都創(chuàng)新互聯(lián)公司多年互聯(lián)網(wǎng)經(jīng)驗(yàn),見的多,溝通容易、能幫助客戶提出的運(yùn)營(yíng)建議。作為成都一家網(wǎng)絡(luò)公司,打造的就是網(wǎng)站建設(shè)產(chǎn)品直銷的概念。選擇成都創(chuàng)新互聯(lián)公司,不只是建站,我們把建站作為產(chǎn)品,不斷的更新、完善,讓每位來訪用戶感受到浩方產(chǎn)品的價(jià)值服務(wù)。
MySQL5 master slave安裝配置日志背景:
master:192.168.100.231 MySQL(和PHP搭配之最佳組合)5.0.19 linux
slave: 192.168.100.234 MySQL(和PHP搭配之最佳組合)5.0.18 linux
step1) 配置master
在/etc/init.d MySQL(和PHP搭配之最佳組合)d段加入
#(要同步的數(shù)據(jù)庫(kù))
binlog_do_db = test
并確保
server-id=1
log-bin=MySQL(和PHP搭配之最佳組合)-bin
step2) 授權(quán)slave
- GRANT REPLICATION SLAVE ON *.* TO test@192.168.100.234 IDENTIFIED BY '123';
重啟master
step3)配置slave
vi /etc/my.cnf
設(shè)置下面4行
- server-id = 2
- master-host = 192.168.100.231
- master-user = test
- master-password = 123
重啟發(fā)現(xiàn)slave的I/O線程工作正常,而SQL線程不工作
報(bào)了很怪的錯(cuò)誤
- 070307 16:30:27 [ERROR] Slave: Error 'Table 'passport.
- loginuser' doesn't exist' on query. Default database: 'passport'.
- Query: 'delete from loginuser where tokenRefreshTime<='2006-07-03 07:00:00'', Error_code: 1146
- 070307 16:30:27 [ERROR] Error running query,
- slave SQL thread aborted. Fix the problem,
- and restart the slave SQL thread with "SLAVE START".
- We stopped at log 'MySQL(和PHP搭配之最佳組合)-bin.000001' position 98
MySQL5 master slave安裝配置日志中因該是relay log中的數(shù)據(jù)有問題,于是在
將master機(jī)器上的數(shù)據(jù)拷到244,發(fā)現(xiàn)還是有問題。
于是在/etc/my.cnf中加入
replicate-do-db=test
重啟slave,
show slave status發(fā)現(xiàn)兩個(gè)線程工作正常
5)測(cè)試
在master的test數(shù)據(jù)的user表中添加了一條記錄
然后在slave上通過show processlist看slave工作情況一切正常,
再查數(shù)據(jù)庫(kù)數(shù)據(jù)似乎沒有更新,查看slave錯(cuò)誤日志
070307 16:45:16 [ERROR] Slave: Error 'Can't create database 'test'; database exists' on query. Default database: 'test'. Query: 'create database test', Error_code: 1007
070307 16:45:16 [ERROR] Error running query, slave SQL thread aborted. Fix the problem, and restart the slave SQL thread with "SLAVE START". We stopped at log 'MySQL(和PHP搭配之最佳組合)-bin.000040' position 70671
原來都是我當(dāng)初拷貝數(shù)據(jù)惹的禍,因?yàn)橹鳈C(jī)日志在我建數(shù)據(jù)庫(kù)的時(shí)候就開始了,所以我拷貝數(shù)據(jù)多此一舉,于是
以上的相關(guān)內(nèi)容就是對(duì)MySQL5 master slave安裝配置日志的介紹,望你能有所收獲。
文章名稱:MySQL5masterslave安裝與配置日志很簡(jiǎn)單
網(wǎng)頁(yè)地址:http://www.dlmjj.cn/article/dpigppi.html


咨詢
建站咨詢
