mongodump 備份數(shù)據(jù)時報錯 Unrecognized field 'snapshot'

問題

使用 Ubuntu 20.04 apt 安裝的 mongodump,備份云上的 MongoDB 服務(wù)數(shù)據(jù)時,報錯 Failed: error writing data for collection `xxx_prod_marketdata.marketdata04_xxx.sec` to disk: error reading collection: Failed to parse: { find: "marketdata04_xxx.sec", skip: 0, snapshot: true, $readPreference: { mode: "secondaryPreferred" }, $db: "xxx_prod_marketdata" }. Unrecognized field 'snapshot'.

分析

系統(tǒng)自帶的 mongo-tools 版本太低

# mongodump --version
mongodump version: built-without-version-string
git version: built-without-git-spec
Go version: go1.10.1
   os: linux
   arch: amd64
   compiler: gc
OpenSSL version: OpenSSL 1.1.0g  2 Nov 2017

解決辦法

卸載掉老版本的 mongo-tools ,安裝新版本的 mongodb-database-tools,工具下載頁面 https://www.mongodb.com/try/download/database-tools

# apt remove mongo-tools -y
# wget https://fastdl.mongodb.org/tools/db/mongodb-database-tools-ubuntu2004-x86_64-100.12.0.deb
# apt install -y ./mongodb-database-tools-ubuntu2004-x86_64-100.12.0.deb
# mongodump --version
mongodump version: 100.12.0
git version: 4558399ef8d5aa59a2779d5909fe9713da43b6af
Go version: go1.23.7
   os: linux
   arch: amd64
   compiler: gc
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容