简体   繁体   中英

MongoDB 3.0.1 mongodump error

I need to create a dumpfile of a MongoDB db using 'mongodump'.

    ubuntu-0864947@ubuntu-vm:~$ mongo
    MongoDB shell version: 3.0.1
    connecting to: test
    Server has startup warnings: 
    2015-03-30T14:26:08.806+0200 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
    2015-03-30T14:26:08.807+0200 I CONTROL  [initandlisten] 
    2015-03-30T14:26:08.807+0200 I CONTROL  [initandlisten] 
    2015-03-30T14:26:08.807+0200 I CONTROL  [initandlisten] ** WARNING: /sys/kernel/mm/transparent_hugepage/defrag is 'always'.
    2015-03-30T14:26:08.808+0200 I CONTROL  [initandlisten] **        We suggest setting it to 'never'
    2015-03-30T14:26:08.808+0200 I CONTROL  [initandlisten] 
    > mongodump
    2015-04-30T15:56:00.719+0200 E QUERY    ReferenceError: mongodump is not defined
        at (shell):1:1
    > mongodump RotterdamHaven
    2015-04-30T15:56:15.970+0200 E QUERY    SyntaxError: Unexpected identifier
    > use RotterdamHaven
    switched to db RotterdamHaven
    > mongodump RotterdamHaven
    2015-04-30T16:26:13.742+0200 E QUERY    SyntaxError: Unexpected identifier

Can anyone please tell me what I am doing wrong here?

Thanks!

mongodump是与mongo mongodump的可执行文件,您需要在OS shell中而不是在MongoDB shell中执行它:

ubuntu-0864947@ubuntu-vm:~$ mongodump <arguments>

Just Go to bin Directory of Mongodb (mycase : c:\\mongodb\\bin) Then, Run : following Command mongodump --db database_name

Then go to Dump Directory Created inside Bin Folder

There you'll find folder of your named database and inside that .bson & .json file would be there just keep it safe .bson is your backup file

Cheers

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM