1. <ul id="0c1fb"></ul>

      <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
      <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区

      RELATEED CONSULTING
      相關(guān)咨詢
      選擇下列產(chǎn)品馬上在線溝通
      服務(wù)時間:8:30-17:00
      你可能遇到了下面的問題
      關(guān)閉右側(cè)工具欄

      新聞中心

      這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
      MongoDB之備份與恢復(fù)-創(chuàng)新互聯(lián)
      Mong

      創(chuàng)新互聯(lián)公司服務(wù)項目包括零陵網(wǎng)站建設(shè)、零陵網(wǎng)站制作、零陵網(wǎng)頁制作以及零陵網(wǎng)絡(luò)營銷策劃等。多年來,我們專注于互聯(lián)網(wǎng)行業(yè),利用自身積累的技術(shù)優(yōu)勢、行業(yè)經(jīng)驗、深度合作伙伴關(guān)系等,向廣大中小型企業(yè)、政府機構(gòu)等提供互聯(lián)網(wǎng)行業(yè)的解決方案,零陵網(wǎng)站推廣取得了明顯的社會效益與經(jīng)濟效益。目前,我們服務(wù)的客戶以成都為中心已經(jīng)輻射到零陵省份的部分城市,未來相信會繼續(xù)擴大服務(wù)區(qū)域并繼續(xù)獲得客戶的支持與信任!oDB數(shù)據(jù)備份
      在Mongodb中我們使用mongodump命令來備份MongoDB數(shù)據(jù)。該命令可以導(dǎo)出所有數(shù)據(jù)到指定目錄中。
      mongodump命令可以通過參數(shù)指定導(dǎo)出的數(shù)據(jù)量級轉(zhuǎn)存的服務(wù)器。
      語法
      mongodump命令腳本語法如下:
      >mongodump -h dbhost -d dbname -o dbdirectory
        ● -h:
      MongDB所在服務(wù)器地址,例如:127.0.0.1,當(dāng)然也可以指定端口號:127.0.0.1:27017
        ● -d:
      需要備份的數(shù)據(jù)庫實例,例如:test
        ● -o:
      備份的數(shù)據(jù)存放位置,例如:c:\data\dump,當(dāng)然該目錄需要提前建立,在備份完成后,系統(tǒng)自動在dump目錄下建立一個test目錄,這個目錄里面存放該數(shù)據(jù)庫實例的備份數(shù)據(jù)。
      備份整個數(shù)據(jù)庫
      [root@D2-LZY245 ~]# mongodump
      2017-08-18T11:06:39.771+0800    writing admin.system.users to
      2017-08-18T11:06:39.772+0800    done dumping admin.system.users (3 documents)
      2017-08-18T11:06:39.772+0800    writing admin.system.version to
      2017-08-18T11:06:39.773+0800    done dumping admin.system.version (2 documents)
      2017-08-18T11:06:39.773+0800    writing hr.emps to
      2017-08-18T11:06:39.773+0800    writing hr.emps_infos to
      2017-08-18T11:06:39.773+0800    writing hr.inventory to
      2017-08-18T11:06:39.773+0800    writing hr.emp to
      2017-08-18T11:06:39.774+0800    done dumping hr.emps_infos (11 documents)
      2017-08-18T11:06:39.774+0800    writing hr.shop to
      2017-08-18T11:06:39.774+0800    done dumping hr.emps (11 documents)
      2017-08-18T11:06:39.774+0800    writing hr.t_emps_job to
      2017-08-18T11:06:39.775+0800    done dumping hr.emp (9 documents)
      2017-08-18T11:06:39.775+0800    writing hr.dept to
      2017-08-18T11:06:39.775+0800    done dumping hr.shop (7 documents)
      2017-08-18T11:06:39.775+0800    writing hr.news to
      2017-08-18T11:06:39.775+0800    done dumping hr.t_emps_job (6 documents)
      2017-08-18T11:06:39.775+0800    writing hr.depts to
      2017-08-18T11:06:39.775+0800    done dumping hr.news (4 documents)
      2017-08-18T11:06:39.775+0800    writing hr.loc to
      2017-08-18T11:06:39.776+0800    done dumping hr.dept (5 documents)
      2017-08-18T11:06:39.776+0800    writing hr.t_emps_sex to
      2017-08-18T11:06:39.776+0800    done dumping hr.depts (2 documents)
      2017-08-18T11:06:39.776+0800    writing hr.info to
      2017-08-18T11:06:39.776+0800    done dumping hr.loc (2 documents)
      2017-08-18T11:06:39.776+0800    writing hr.phones to
      2017-08-18T11:06:39.776+0800    done dumping hr.info (0 documents)
      2017-08-18T11:06:39.776+0800    writing test.fs.chunks to
      2017-08-18T11:06:39.777+0800    done dumping hr.t_emps_sex (2 documents)
      2017-08-18T11:06:39.777+0800    writing test.fs.files to
      2017-08-18T11:06:39.777+0800    done dumping hr.phones (0 documents)
      2017-08-18T11:06:39.777+0800    done dumping test.fs.chunks (0 documents)
      2017-08-18T11:06:39.777+0800    done dumping hr.inventory (10 documents)
      2017-08-18T11:06:39.777+0800    done dumping test.fs.files (0 documents)
      備份結(jié)果
      [root@D2-LZY245 ~]# ll dump/
      total 4
      drwxrwxr-x 2 root root  124 Aug 18 11:06 admin
      drwxrwxr-x 2 root root 4096 Aug 18 11:06 hr
      drwxrwxr-x 2 root root  106 Aug 18 11:06 test
      刪除集合
      > use hr
      switched to db hr
      > db.dept.find();
      { "_id" : ObjectId("599504e70184ff511bf02be1"), "deptno" : 11, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599504e70184ff511bf02be2"), "deptno" : 12, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599504e70184ff511bf02be3"), "deptno" : 13, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599504e80184ff511bf02be4"), "deptno" : 14, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599505240184ff511bf02be5"), "deptno" : 16, "dname" : "財務(wù)部", "loc" : "北京" }
      > db.dept.drop();
      true
      > db.dept.find();
      >
      MongoDB數(shù)據(jù)恢復(fù)
      mongodb使用 mongorestore 命令來恢復(fù)備份的數(shù)據(jù)。
      語法
      mongorestore命令腳本語法如下:
      >mongorestore -h <:port> -d dbname
        ● --host <:port>, -h <:port>:
      MongoDB所在服務(wù)器地址,默認為: localhost:27017
        ● --db , -d :
      需要恢復(fù)的數(shù)據(jù)庫實例,例如:test,當(dāng)然這個名稱也可以和備份時候的不一樣,比如test2
        ● --drop:
      恢復(fù)的時候,先刪除當(dāng)前數(shù)據(jù),然后恢復(fù)備份的數(shù)據(jù)。就是說,恢復(fù)后,備份后添加修改的數(shù)據(jù)都會被刪除,慎用哦!
        ●
      mongorestore 最后的一個參數(shù),設(shè)置備份數(shù)據(jù)所在位置,例如:c:\data\dump\test。
      你不能同時指定 和 --dir 選項,--dir也可以設(shè)置備份目錄。
        ● --dir:
      指定備份的目錄
      恢復(fù)被刪除的集合
      [root@D2-LZY245 ~]# mongorestore --db=hr --collection=dept --dir=/root/dump/hr/dept.bson
      2017-08-18T11:14:54.397+0800    checking for collection data in /root/dump/hr/dept.bson
      2017-08-18T11:14:54.406+0800    reading metadata for hr.dept from /root/dump/hr/dept.metadata.json
      2017-08-18T11:14:54.424+0800    restoring hr.dept from /root/dump/hr/dept.bson
      2017-08-18T11:14:54.486+0800    no indexes to restore
      2017-08-18T11:14:54.486+0800    finished restoring hr.dept (5 documents)
      2017-08-18T11:14:54.486+0800    done
      刪除數(shù)據(jù)庫
      > db.dropDatabase()
      { "dropped" : "hr", "ok" : 1 }
      > use hr
      switched to db hr
      > show collections
      >
      恢復(fù)被刪除的數(shù)據(jù)庫
      [root@D2-LZY245 ~]# mongorestore --db=hr --dir=/root/dump/hr
      2017-08-18T11:18:38.570+0800    the --db and --collection args should only be used when restoring from a BSON file. Other uses are deprecated and will not exist in the future; use --nsInclude instead
      2017-08-18T11:18:38.570+0800    building a list of collections to restore from /root/dump/hr dir
      2017-08-18T11:18:38.571+0800    reading metadata for hr.emps from /root/dump/hr/emps.metadata.json
      2017-08-18T11:18:38.572+0800    reading metadata for hr.emp from /root/dump/hr/emp.metadata.json
      2017-08-18T11:18:38.572+0800    reading metadata for hr.inventory from /root/dump/hr/inventory.metadata.json
      2017-08-18T11:18:38.572+0800    reading metadata for hr.emps_infos from /root/dump/hr/emps_infos.metadata.json
      2017-08-18T11:18:38.578+0800    restoring hr.inventory from /root/dump/hr/inventory.bson
      2017-08-18T11:18:38.585+0800    restoring hr.emps from /root/dump/hr/emps.bson
      2017-08-18T11:18:38.591+0800    restoring hr.emp from /root/dump/hr/emp.bson
      2017-08-18T11:18:38.596+0800    restoring indexes for collection hr.inventory from metadata
      2017-08-18T11:18:38.596+0800    no indexes to restore
      2017-08-18T11:18:38.596+0800    finished restoring hr.emp (9 documents)
      2017-08-18T11:18:38.596+0800    no indexes to restore
      2017-08-18T11:18:38.596+0800    finished restoring hr.emps (11 documents)
      2017-08-18T11:18:38.596+0800    restoring hr.emps_infos from /root/dump/hr/emps_infos.bson
      2017-08-18T11:18:38.605+0800    no indexes to restore
      2017-08-18T11:18:38.605+0800    finished restoring hr.emps_infos (11 documents)
      2017-08-18T11:18:38.605+0800    finished restoring hr.inventory (10 documents)
      2017-08-18T11:18:38.605+0800    reading metadata for hr.t_emps_job from /root/dump/hr/t_emps_job.metadata.json
      2017-08-18T11:18:38.605+0800    reading metadata for hr.shop from /root/dump/hr/shop.metadata.json
      2017-08-18T11:18:38.606+0800    reading metadata for hr.dept from /root/dump/hr/dept.metadata.json
      2017-08-18T11:18:38.606+0800    reading metadata for hr.t_emps_sex from /root/dump/hr/t_emps_sex.metadata.json
      2017-08-18T11:18:38.610+0800    restoring hr.t_emps_job from /root/dump/hr/t_emps_job.bson
      2017-08-18T11:18:38.616+0800    restoring hr.dept from /root/dump/hr/dept.bson
      2017-08-18T11:18:38.638+0800    restoring hr.t_emps_sex from /root/dump/hr/t_emps_sex.bson
      2017-08-18T11:18:38.639+0800    restoring hr.shop from /root/dump/hr/shop.bson
      2017-08-18T11:18:38.639+0800    no indexes to restore
      2017-08-18T11:18:38.639+0800    finished restoring hr.dept (5 documents)
      2017-08-18T11:18:38.641+0800    no indexes to restore
      2017-08-18T11:18:38.641+0800    finished restoring hr.t_emps_job (6 documents)
      2017-08-18T11:18:38.641+0800    reading metadata for hr.depts from /root/dump/hr/depts.metadata.json
      2017-08-18T11:18:38.651+0800    reading metadata for hr.news from /root/dump/hr/news.metadata.json
      2017-08-18T11:18:38.652+0800    restoring hr.depts from /root/dump/hr/depts.bson
      2017-08-18T11:18:38.657+0800    restoring hr.news from /root/dump/hr/news.bson
      2017-08-18T11:18:38.660+0800    no indexes to restore
      2017-08-18T11:18:38.660+0800    finished restoring hr.t_emps_sex (2 documents)
      2017-08-18T11:18:38.661+0800    reading metadata for hr.loc from /root/dump/hr/loc.metadata.json
      2017-08-18T11:18:38.661+0800    restoring indexes for collection hr.shop from metadata
      2017-08-18T11:18:38.661+0800    no indexes to restore
      2017-08-18T11:18:38.661+0800    finished restoring hr.depts (2 documents)
      2017-08-18T11:18:38.661+0800    reading metadata for hr.phones from /root/dump/hr/phones.metadata.json
      2017-08-18T11:18:38.661+0800    restoring indexes for collection hr.news from metadata
      2017-08-18T11:18:38.666+0800    restoring hr.loc from /root/dump/hr/loc.bson
      2017-08-18T11:18:38.670+0800    finished restoring hr.shop (7 documents)
      2017-08-18T11:18:38.670+0800    reading metadata for hr.info from /root/dump/hr/info.metadata.json
      2017-08-18T11:18:38.674+0800    finished restoring hr.news (4 documents)
      2017-08-18T11:18:38.679+0800    restoring hr.phones from /root/dump/hr/phones.bson
      2017-08-18T11:18:38.684+0800    no indexes to restore
      2017-08-18T11:18:38.684+0800    finished restoring hr.loc (2 documents)
      2017-08-18T11:18:38.687+0800    restoring hr.info from /root/dump/hr/info.bson
      2017-08-18T11:18:38.687+0800    restoring indexes for collection hr.phones from metadata
      2017-08-18T11:18:38.697+0800    finished restoring hr.phones (0 documents)
      2017-08-18T11:18:38.697+0800    no indexes to restore
      2017-08-18T11:18:38.697+0800    finished restoring hr.info (0 documents)
      2017-08-18T11:18:38.697+0800    done
      > show collections
      dept
      depts
      emp
      emps
      emps_infos
      info
      inventory
      loc
      news
      phones
      shop
      t_emps_job
      t_emps_sex
      > db.dept.find()
      { "_id" : ObjectId("599504e70184ff511bf02be1"), "deptno" : 11, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599504e70184ff511bf02be2"), "deptno" : 12, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599504e70184ff511bf02be3"), "deptno" : 13, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599504e80184ff511bf02be4"), "deptno" : 14, "dname" : "財務(wù)部", "loc" : "北京" }
      { "_id" : ObjectId("599505240184ff511bf02be5"), "deptno" : 16, "dname" : "財務(wù)部", "loc" : "北京" }
      分享名稱:MongoDB之備份與恢復(fù)-創(chuàng)新互聯(lián)
      鏈接URL:http://www.ef60e0e.cn/article/ceeoec.html
      99热在线精品一区二区三区_国产伦精品一区二区三区女破破_亚洲一区二区三区无码_精品国产欧美日韩另类一区
      1. <ul id="0c1fb"></ul>

        <noscript id="0c1fb"><video id="0c1fb"></video></noscript>
        <noscript id="0c1fb"><listing id="0c1fb"><thead id="0c1fb"></thead></listing></noscript>

        香河县| 得荣县| 即墨市| 苏尼特右旗| 临颍县| 阿瓦提县| 浠水县| 盐边县| 剑阁县| 山东省| 白水县| 盱眙县| 辰溪县| 高台县| 大邑县| 齐齐哈尔市| 家居| 鄂尔多斯市| 兖州市| 南昌县| 宁城县| 镇巴县| 海兴县| 若尔盖县| 车致| 吐鲁番市| 安阳市| 阜新市| 泽州县| 讷河市| 微博| 得荣县| 兖州市| 定日县| 沙坪坝区| 天峨县| 茂名市| 五寨县| 武功县| 漳浦县| 鄱阳县|