Skip to content

Instantly share code, notes, and snippets.

@kgorman
Last active December 25, 2015 13:29
Show Gist options
  • Save kgorman/6984045 to your computer and use it in GitHub Desktop.
Save kgorman/6984045 to your computer and use it in GitHub Desktop.
# Export/Import using named pipe
# Doesn't use disk I/O, just pipes input through pipes
#
# Node 1 | Terminal A
#
mkfifo /tmp/mongodump_pipe
# now export the data
/opt/mongodb/bin/mongoexport --host=localhost:99999 --collection=lotsodata --username=xxxx --password=yyyy --db=testdb > /tmp/mongodump_pipe
# Node 1 | Terminal B
# import the data
cat /tmp/mongodump_pipe | /opt/mongodb/bin/mongoimport --host=localhost:99991 --db=testdb_dumped --username=xxx --password=yyy --collection=lotsodata
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment