Reputation: 6121
I'm inserting some few million records into local MongoDB.
I wasn't sure how to disable logging but the terminal is going crazy outputting tons of data.
Does this actually slow down the insertion or does the terminal "lag" behind what is actually being done?
Upvotes: 0
Views: 119
Reputation: 20022
The logging makes it slow. You can buy a new video card or silence the output.
When your insertscript
gives a lot of output, it can be stdout
or stderr
.
You can redirect either of them to a file (or /dev/null). When you redirect, stdout is the default (and has value 1) and stderr is number 2.
insertscript > insert.out 2> insert.err
# or
insertscript 1> insert.out 2> insert.err
You can also redirect to the current target of another with the &
:
# Stderr also to insert.out
insertscript > insert.out 2>&1
# or
# stderr to your console
insertscript 2>&1 > insert.out
Why not play with the redirection first?
echo "Normal output" >/dev/null
echo "Normal output" 2>/dev/null
rm not_existing_file >/dev/null
rm not_existing_file 2>/dev/null
#
echo "Normal output" >/dev/null 2>&1
echo "Normal output" 2>&1 > /dev/null
rm not_existing_file >/dev/null 2>&1
rm not_existing_file 2>&1 2>/dev/null
Upvotes: 1