Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

mongodump and mongorestore command not found mac

Tags:

mongodb

I intalled mongodb by the following steps

  • Downloaded mongodb-macos-x86_64-4.4.0.tgz
  • sudo mv mongodb-macos-x86_64-4.4.0.tgz /usr/local/mongodb
  • mkdir -p /data/db
  • sudo chown myusername /data/db
  • mongod

Now the mongodb server is started and running, I need to import my db with the backup I have. I tried importing data with the following command

  • mongorestore --host localhost --port 27017 --db dbName /Users/userName/Downloads/mongo

It throws

  • mongorestore: command not found

How can I install mongostore and mongodumb seperately? Any help would be appreciated. Thanks in advance.

like image 663
Jagan Avatar asked Aug 04 '20 21:08

Jagan


People also ask

What is Mongodump and Mongorestore?

The mongodump and mongorestore utilities work with BSON data dumps, and are useful for creating backups of small deployments. For resilient and non-disruptive backups, use a file system or block-level disk snapshot function, such as the methods described in the MongoDB Backup Methods document. Note.

Where is Mongodump?

The mongodump command will overwrite the existing files within the given backup folder. The default location for backups is the dump/ folder. When the WiredTiger storage engine is used in a MongoDB instance, the output will be uncompressed data.

How do I run Mongorestore?

Basic mongorestore syntax The basic way to restore a database is to use the mongorestore command to specify the backup directory (dump directory) without any options. This option is suitable for databases located in the localhost (127.0. 0.1) using the port 27017.


1 Answers

As of MongoDB 4.4 (released July 30, 2020), you need to install mongodump separately because the MongoDB Database Tools (which comprises mongodump, mongorestore, and more) has become its own project.

I found this out because I upgraded to MongoDB 4.4 today and mongodump stopped working.

$ mongodump
zsh: command not found: mongodump

I'm on macOS and installed MongoDB via Homebrew. To get mongodump and friends back, I installed the MongoDB Database Tools via Homebrew:

brew tap mongodb/brew
brew install mongodb-database-tools

It looks like you're not using Homebrew, so this should help:

MongoDB Database Tools Installation

like image 64
ptrkcsk Avatar answered Nov 15 '22 09:11

ptrkcsk