<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問(wèn)答1問(wèn)答10問(wèn)答100問(wèn)答1000問(wèn)答2000關(guān)鍵字專題1關(guān)鍵字專題50關(guān)鍵字專題500關(guān)鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關(guān)鍵字專題關(guān)鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問(wèn)答文章1 問(wèn)答文章501 問(wèn)答文章1001 問(wèn)答文章1501 問(wèn)答文章2001 問(wèn)答文章2501 問(wèn)答文章3001 問(wèn)答文章3501 問(wèn)答文章4001 問(wèn)答文章4501 問(wèn)答文章5001 問(wèn)答文章5501 問(wèn)答文章6001 問(wèn)答文章6501 問(wèn)答文章7001 問(wèn)答文章7501 問(wèn)答文章8001 問(wèn)答文章8501 問(wèn)答文章9001 問(wèn)答文章9501
        當(dāng)前位置: 首頁(yè) - 科技 - 知識(shí)百科 - 正文

        MongoDB之整庫(kù)備份還原單表collection備份還原

        來(lái)源:懂視網(wǎng) 責(zé)編:小采 時(shí)間:2020-11-09 14:33:12
        文檔

        MongoDB之整庫(kù)備份還原單表collection備份還原

        MongoDB之整庫(kù)備份還原單表collection備份還原:MongoDB之整庫(kù)備份還原單表collection備份還原 cd D:\MongoDB\bin 1整庫(kù)備份: mongodump -h dbhost -d dbname -o dbdirectory -h:MongDB所在服務(wù)器地址,例如:127.0.0.1:27017 -d:需要備份的數(shù)據(jù)庫(kù)實(shí)例,例如:wlwdb -o:備份
        推薦度:
        導(dǎo)讀MongoDB之整庫(kù)備份還原單表collection備份還原:MongoDB之整庫(kù)備份還原單表collection備份還原 cd D:\MongoDB\bin 1整庫(kù)備份: mongodump -h dbhost -d dbname -o dbdirectory -h:MongDB所在服務(wù)器地址,例如:127.0.0.1:27017 -d:需要備份的數(shù)據(jù)庫(kù)實(shí)例,例如:wlwdb -o:備份

        MongoDB之整庫(kù)備份還原單表collection備份還原 cd D:\MongoDB\bin 1整庫(kù)備份: mongodump -h dbhost -d dbname -o dbdirectory -h:MongDB所在服務(wù)器地址,例如:127.0.0.1:27017 -d:需要備份的數(shù)據(jù)庫(kù)實(shí)例,例如:wlwdb -o:備份的數(shù)據(jù)存放位置,例如:D:\M

        MongoDB之整庫(kù)備份還原單表collection備份還原

        cd D:\MongoDB\bin

        1整庫(kù)備份:

        mongodump -h dbhost -d dbname -o dbdirectory

        -h:MongDB所在服務(wù)器地址,例如:127.0.0.1:27017

        -d:需要備份的數(shù)據(jù)庫(kù)實(shí)例,例如:wlwdb

        -o:備份的數(shù)據(jù)存放位置,例如:D:\MongoDB\data\dump,當(dāng)然該目錄需要提前建立,在備份完成后,系統(tǒng)自動(dòng)在dump目錄下建立一個(gè)wlwdb目錄,這個(gè)目錄里面存放該數(shù)據(jù)庫(kù)實(shí)例的備份數(shù)據(jù)。

        eg:

        mongodump -h 127.0.0.1 -d wlwdb -o D:\MongoDB\data\dump

        \

        可以查看該備份目錄:

        \

        mongodump --help

        \
        mongodump的官方說(shuō)明:
        options:
         --help produce help message
         -v [ --verbose ] be more verbose (include multiple times for more
         verbosity e.g. -vvvvv)
         --version print the program's version and exit
         -h [ --host ] arg mongo host to connect to ( /s1,s2 for
         sets)
         --port arg server port. Can also use --host hostname:port
         --ipv6 enable IPv6 support (disabled by default)
         -u [ --username ] arg username
         -p [ --password ] arg password
         --dbpath arg directly access mongod database files in the given
         path, instead of connecting to a mongod server -
         needs to lock the data directory, so cannot be used
         if a mongod is currently accessing the same path
         --directoryperdb if dbpath specified, each db is in a separate
         directory
         --journal enable journaling
         -d [ --db ] arg database to use
         -c [ --collection ] arg collection to use (some commands)
         -o [ --out ] arg (=dump) output directory or "-" for stdout
         -q [ --query ] arg json query
         --oplog Use oplog for point-in-time snapshotting
         --repair try to recover a crashed database
         --forceTableScan force a table scan (do not use $snapshot)

        2整庫(kù)恢復(fù):

        mongorestore -h dbhost -d dbname –directoryperdb dbdirectory

        -h:MongoDB所在服務(wù)器地址

        -d:需要恢復(fù)的數(shù)據(jù)庫(kù)實(shí)例,例如:wlwdb(可以和備份時(shí)候的不一樣)

        –directoryperdb:備份數(shù)據(jù)所在位置,例如:D:\MongoDB\data\dump\wlwdb

        –drop:恢復(fù)的時(shí)候,先刪除當(dāng)前數(shù)據(jù),然后恢復(fù)備份的數(shù)據(jù)。

        eg:

        mongorestore -h 127.0.0.1 -d wlwdb –directoryperdb D:\MongoDB\data\dump\wlwdb

        mongorestore的官方說(shuō)明(可通過(guò)mongorestore --help查看):
        options:
         --help produce help message
         -v [ --verbose ] be more verbose (include multiple times for more
         verbosity e.g. -vvvvv)
         --version print the program's version and exit
         -h [ --host ] arg mongo host to connect to ( /s1,s2 for sets)
         --port arg server port. Can also use --host hostname:port
         --ipv6 enable IPv6 support (disabled by default)
         -u [ --username ] arg username
         -p [ --password ] arg password
         --dbpath arg directly access mongod database files in the given
         path, instead of connecting to a mongod server -
         needs to lock the data directory, so cannot be used
         if a mongod is currently accessing the same path
         --directoryperdb if dbpath specified, each db is in a separate
         directory
         --journal enable journaling
         -d [ --db ] arg database to use
         -c [ --collection ] arg collection to use (some commands)
         --objcheck validate object before inserting
         --filter arg filter to apply before inserting
         --drop drop each collection before import
         --oplogReplay replay oplog for point-in-time restore
         --oplogLimit arg exclude oplog entries newer than provided timestamp
         (epoch[:ordinal])
         --keepIndexVersion don't upgrade indexes to newest version
         --noOptionsRestore don't restore collection options
         --noIndexRestore don't restore indexes
         --w arg (=1) minimum number of replicas per write
        3單個(gè)collection備份:

        mongoexport -h dbhost -d dbname -c collectionname -f collectionKey -o dbdirectory

        -h: MongoDB所在服務(wù)器地址

        -d: 需要恢復(fù)的數(shù)據(jù)庫(kù)實(shí)例

        -c: 需要恢復(fù)的集合

        -f: 需要導(dǎo)出的字段(省略為所有字段)

        -o: 表示導(dǎo)出的文件名

        mongoexport的官方說(shuō)明(可通過(guò)mongoexport --help查看):
         --help produce help message
         -v [ --verbose ] be more verbose (include multiple times for more
         verbosity e.g. -vvvvv)
         --version print the program's version and exit
         -h [ --host ] arg mongo host to connect to ( /s1,s2 for
         sets)
         --port arg server port. Can also use --host hostname:port
         --ipv6 enable IPv6 support (disabled by default)
         -u [ --username ] arg username
         -p [ --password ] arg password
         --dbpath arg directly access mongod database files in the given
         path, instead of connecting to a mongod server -
         needs to lock the data directory, so cannot be used
         if a mongod is currently accessing the same path
         --directoryperdb if dbpath specified, each db is in a separate
         directory
         --journal enable journaling
         -d [ --db ] arg database to use
         -c [ --collection ] arg collection to use (some commands)
         -f [ --fields ] arg comma separated list of field names e.g. -f
         name,age
         --fieldFile arg file with fields names - 1 per line
         -q [ --query ] arg query filter, as a JSON string
         --csv export to csv instead of json
         -o [ --out ] arg output file; if not specified, stdout is used
         --jsonArray output to a json array rather than one object per
         line
         -k [ --slaveOk ] arg (=1) use secondaries for export if available, default
         true
         --forceTableScan force a table scan (do not use $snapshot)
        4單個(gè)collection恢復(fù):

        mongoimport -d dbhost -c collectionname –type csv –headerline –file

        -type: 指明要導(dǎo)入的文件格式

        -headerline: 批明不導(dǎo)入第一行,因?yàn)榈谝恍惺橇忻?/p>

        -file: 指明要導(dǎo)入的文件路徑

        mongoimport的官方說(shuō)明(可通過(guò)mongoimport --help查看):
         --help produce help message
         -v [ --verbose ] be more verbose (include multiple times for more
         verbosity e.g. -vvvvv)
         --version print the program's version and exit
         -h [ --host ] arg mongo host to connect to ( /s1,s2 for sets)
         --port arg server port. Can also use --host hostname:port
         --ipv6 enable IPv6 support (disabled by default)
         -u [ --username ] arg username
         -p [ --password ] arg password
         --dbpath arg directly access mongod database files in the given
         path, instead of connecting to a mongod server -
         needs to lock the data directory, so cannot be used
         if a mongod is currently accessing the same path
         --directoryperdb if dbpath specified, each db is in a separate
         directory
         --journal enable journaling
         -d [ --db ] arg database to use
         -c [ --collection ] arg collection to use (some commands)
         -f [ --fields ] arg comma separated list of field names e.g. -f name,age
         --fieldFile arg file with fields names - 1 per line
         --ignoreBlanks if given, empty fields in csv and tsv will be ignored
         --type arg type of file to import. default: json (json,csv,tsv)
         --file arg file to import from; if not specified stdin is used
         --drop drop collection first
         --headerline CSV,TSV only - use first line as headers
         --upsert insert or update objects that already exist
         --upsertFields arg comma-separated fields for the query part of the
         upsert. You should make sure this is indexed
         --stopOnError stop importing at first error rather than continuing
         --jsonArray load a json array, not one item per line. Currently
         limited to 16MB.

        聲明:本網(wǎng)頁(yè)內(nèi)容旨在傳播知識(shí),若有侵權(quán)等問(wèn)題請(qǐng)及時(shí)與本網(wǎng)聯(lián)系,我們將在第一時(shí)間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        MongoDB之整庫(kù)備份還原單表collection備份還原

        MongoDB之整庫(kù)備份還原單表collection備份還原:MongoDB之整庫(kù)備份還原單表collection備份還原 cd D:\MongoDB\bin 1整庫(kù)備份: mongodump -h dbhost -d dbname -o dbdirectory -h:MongDB所在服務(wù)器地址,例如:127.0.0.1:27017 -d:需要備份的數(shù)據(jù)庫(kù)實(shí)例,例如:wlwdb -o:備份
        推薦度:
        標(biāo)簽: 恢復(fù) 還原 備份
        • 熱門焦點(diǎn)

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲?V无码乱码国产精品| 亚洲大尺度无码专区尤物| 日本免费一区二区三区最新vr| 精品免费国产一区二区三区| 亚洲午夜国产精品无码| 亚洲一级特黄特黄的大片| 久青草视频97国内免费影视| 成人免费看黄20分钟| 国产亚洲精品一品区99热| 色欲aⅴ亚洲情无码AV蜜桃| 99re6热视频精品免费观看| 亚洲福利精品一区二区三区| 亚洲国产成a人v在线观看| 亚洲高清中文字幕免费| 亚洲午夜久久久影院伊人| 最近中文字幕免费mv视频7| 亚洲国产精品日韩在线| 中文字幕免费在线播放| 色播在线永久免费视频| 国产精品亚洲精品日韩动图| 色妞WWW精品免费视频| 亚洲精品福利网泷泽萝拉| 中文字幕的电影免费网站| 亚洲国产成人一区二区精品区| 污污网站18禁在线永久免费观看| 亚洲视频在线免费| 激情小说亚洲色图| 午夜一级免费视频| 人人鲁免费播放视频人人香蕉| 国产在线播放免费| 亚洲乱码av中文一区二区| 久久国内免费视频| 老妇激情毛片免费| 又黄又爽无遮挡免费视频| 亚洲Av永久无码精品一区二区| 亚洲黄片毛片在线观看| 无码AV动漫精品一区二区免费| 亚洲国产精品无码久久一区二区 | 免费在线观看日韩| 中文字幕一区二区三区免费视频| 亚洲美女视频一区|