国产99久久精品_欧美日本韩国一区二区_激情小说综合网_欧美一级二级视频_午夜av电影_日本久久精品视频

最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題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關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
當前位置: 首頁 - 科技 - 知識百科 - 正文

MongoDB之整庫備份還原單表collection備份還原

來源:懂視網 責編:小采 時間:2020-11-09 14:33:12
文檔

MongoDB之整庫備份還原單表collection備份還原

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

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

MongoDB之整庫備份還原單表collection備份還原

cd D:\MongoDB\bin

1整庫備份:

mongodump -h dbhost -d dbname -o dbdirectory

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

-d:需要備份的數據庫實例,例如:wlwdb

-o:備份的數據存放位置,例如:D:\MongoDB\data\dump,當然該目錄需要提前建立,在備份完成后,系統自動在dump目錄下建立一個wlwdb目錄,這個目錄里面存放該數據庫實例的備份數據。

eg:

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

\

可以查看該備份目錄:

\

mongodump --help

\
mongodump的官方說明:
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整庫恢復:

mongorestore -h dbhost -d dbname –directoryperdb dbdirectory

-h:MongoDB所在服務器地址

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

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

–drop:恢復的時候,先刪除當前數據,然后恢復備份的數據。

eg:

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

mongorestore的官方說明(可通過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單個collection備份:

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

-h: MongoDB所在服務器地址

-d: 需要恢復的數據庫實例

-c: 需要恢復的集合

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

-o: 表示導出的文件名

mongoexport的官方說明(可通過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單個collection恢復:

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

-type: 指明要導入的文件格式

-headerline: 批明不導入第一行,因為第一行是列名

-file: 指明要導入的文件路徑

mongoimport的官方說明(可通過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.

聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

文檔

MongoDB之整庫備份還原單表collection備份還原

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

最新推薦

猜你喜歡

熱門推薦

專題
Top
主站蜘蛛池模板: 亚洲v欧美v日韩v国产v | 国产一区二区在线观看视频 | 国产欧美一区二区三区精品 | 亚洲va国产va欧美va综合 | 日韩欧美中字 | 国产精品免费观看视频 | 国模私拍一区二区三区 | 国产综合亚洲欧美日韩一区二区 | 亚洲国产精品日韩一线满 | 欧美国产一区二区三区 | 成人中文字幕一区二区三区 | 一区二区国产在线观看 | 亚欧免费视频一区二区三区 | 亚洲精品自产拍在线观看app | 国产精品久久久久久久 | 日韩在线第三页 | 精品久久久久久国产牛牛app | 久久婷婷久久一区二区三区 | 久久久久777777人人人视频 | 欧美嫩交| xxxxx欧美| 精品一区二区三区免费毛片爱 | 国产一级特黄全黄毛片 | 久久精品一区二区三区不卡牛牛 | 欧美日韩国产一区二区 | 精品成人一区二区三区免费视频 | 亚洲色图欧美自拍 | 日韩在线第三页 | 欧美激情一区 | 日韩欧美一区二区三区免费看 | 91久久国产情侣真实对白 | 国产精品亚洲国产三区 | 日本精品久久久一区二区三区 | 国产精品一区二区国产 | 欧美地区一二三 | 欧美日韩国产码高清综合人成 | 亚洲欧美日韩另类在线专区 | 欧美.com| 91麻精品国产91久久久久 | 国内一级野外a一级毛片 | 一区二区电影 |