在slave上執(zhí)行slaveof到master上,遲遲未成功。
檢查master的redis進(jìn)程日志輸出如下:
-
427:S 03 May 20:32:07.320 * Slave 10.9.95.71:6379 asks for synchronization
-
427:S 03 May 20:32:07.320 * Unable to partial resync with slave $slaveip:6379 for lack of backlog (Slave request was: 5974421660).
-
427:S 03 May 20:32:07.320 * Delay next BGSAVE for SYNC
-
427:S 03 May 20:32:13.350 * Starting BGSAVE for SYNC with target: slaves sockets
-
427:S 03 May 20:32:14.333 * Background RDB transfer started by pid 478
-
427:S 03 May 20:35:04.136 # Connection with slave $slaveip lost.
-
427:S 03 May 20:35:04.912 # Background transfer error
手動(dòng)通過(guò)stat檢查了一下rdb文件,確認(rèn)bgsave成功。
報(bào)錯(cuò)也顯示為transfer error,大致判定為rdb文件在transfer到slave的時(shí)候報(bào)錯(cuò)。
google了一下發(fā)現(xiàn)應(yīng)該是client-output-buffer-limit設(shè)置過(guò)小。
〇 client-output-buffer-limit 在文檔中指出,該參數(shù)用于限制client緩沖區(qū)的限制。
redis的client被分為三種類(lèi)型:
normal、slave、pubsub。normal:正常的客戶(hù)端并包括MONITOR客戶(hù)端
slave:slave客戶(hù)端
pubsub:pub/sub客戶(hù)端
其設(shè)置方式為:
client-output-buffer-limit[class] [hard limit] [soft limit] [soft seconds]
[class]為client的類(lèi)型。
[hard limit]為硬限制,即超過(guò)[hard limit]值的緩沖區(qū)客戶(hù)端會(huì)被強(qiáng)制中斷。
[soft limit] [soft seconds]為軟限制,即持續(xù)[soft seconds]時(shí)間內(nèi),超過(guò)[soft limit]的緩沖區(qū)客戶(hù)端會(huì)被強(qiáng)制中斷。
當(dāng)然,默認(rèn)情況下普通client不受限制(設(shè)置為0),因?yàn)槿绻酝扑偷姆绞剑ú辉?xún)問(wèn)),在請(qǐng)求之后才接收到數(shù)據(jù),那么只有異步客戶(hù)端可能會(huì)創(chuàng)建一個(gè)請(qǐng)求數(shù)據(jù)的速度超過(guò)其讀取速度的情況。
而slave和pubsub client有一個(gè)默認(rèn)限制,因?yàn)樗麄円酝扑偷姆绞浇邮諗?shù)據(jù)。
此處將slave的hard limit設(shè)置為32G。
config set client-output-buffer-limit "normal 0 0 0 slave 34359738368 268435456 600 pubsub 33554432 8388608 60" 重新slaveof后,觀察info replication和主庫(kù)redis進(jìn)程日志,創(chuàng)建復(fù)制成功:
-
427:S 03 May 21:41:16.962 * Slave $slaveip:6379 asks for synchronization
-
427:S 03 May 21:41:16.984 * Full resync requested by slave $slaveip:6379
-
427:S 03 May 21:41:16.984 * Delay next BGSAVE for SYNC
-
427:S 03 May 21:41:22.712 * Starting BGSAVE for SYNC with target: slaves sockets
-
427:S 03 May 21:41:23.679 * Background RDB transfer started by pid 568
-
568:C 03 May 21:51:14.107 * RDB: xxxxx MB of memory used by copy-on-write
-
427:S 03 May 21:51:15.012 * Background RDB transfer terminated with success
-
427:S 03 May 21:51:15.012 # Slave $slaveip:6379 correctly received the streamed RDB file.
-
427:S 03 May 21:51:15.012 * Streamed RDB transfer with slave $slaveip:6379 succeeded (socket). Waiting for REPLCONF ACK from slave to enable streaming
復(fù)制建立好后,將client-output-buffer-limit改為默認(rèn)值。
作者微信公眾號(hào):
標(biāo)題名稱(chēng):【Redis】slaveof報(bào)錯(cuò)Backgroundtransfererror
瀏覽路徑:http://jinyejixie.com/article38/poscsp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)網(wǎng)站建設(shè)、品牌網(wǎng)站制作、面包屑導(dǎo)航、網(wǎng)站設(shè)計(jì)、用戶(hù)體驗(yàn)、品牌網(wǎng)站設(shè)計(jì)
廣告
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶(hù)投稿、用戶(hù)轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話(huà):028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源:
創(chuàng)新互聯(lián)