I am running MongoDB 2.6.2 and I have a replica set with a primary, secondary and an arbiter. Are there any adverse effects to running a mongoimport command with only one or two of the replica set members?
More specifically, does the arbiter need to be specified in the --host option of the mongoimport command? The documentation clearly describes the hostname format (here), but does not warn against how many of the members need to be specified.
mongoimport
command should be run on primary
host as this is an insert operation and all insert can be done on primary node only. Secondary
nodes cannot entertain write operation directly. In a replicaset
, primary node gets the data first and then secondary
nodes reads the primary
node's oplog
and replicate the operations.
Simply put, if you are using a replicaset
and you want import data using mongoimport
then you must pass primary
node as host to mongoimport
command.
Also, mongoimport
command does't care about arbiter
. All it cares is, if it can write data to the node or not. In case of replicaset
, you can insert data only on primary
node.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With