Skip to content

Instantly share code, notes, and snippets.

{
random: 4583,
favorite_color: “blue”,
age: 29,
gender: “M”,
favorite_food: “pizza”,
city: “NYC”,
shoe_size: 11
}
replset:SECONDARY> db.adminCommand( "shutdown" )
E11000 duplicate key error index
#! /bin/bash
if [ ! $# -eq 2 ]; then
echo "USAGE 2 parameters required: 'hostname' 'port'";
exit -1;
fi
$ mongo myDatabase --host $1 --port $2 --eval "db.myCollection.ensureIndex( { a: 1 }, { unique: true })"
#! /bin/bash
if [ ! $# -eq 2 ]; then
echo "USAGE 2 parameters required: 'hostname' 'port'";
exit -1;
fi
$ mongo myDatabase --host $1 --port $2 --eval "db.myCollection.ensureIndex( { a: 1 }, { unique: true })"
$ mongo myDatabase --port 27018 --eval "db.myCollection.ensureIndex( { a: 1 }, { unique: true })"
replset:PRIMARY> rs.stepDown( 120 )
replset:PRIMARY> rs.stepDown()
2015-06-16T16:01:25.298-0400 I NETWORK DBClientCursor::init call() failed
2015-06-16T16:01:25.303-0400 E QUERY Error: error doing query: failed
at DBQuery._exec (src/mongo/shell/query.js:83:36)
at DBQuery.hasNext (src/mongo/shell/query.js:240:10)
at DBCollection.findOne (src/mongo/shell/collection.js:187:19)
at DB.runCommand (src/mongo/shell/db.js:58:41)
at DB.adminCommand (src/mongo/shell/db.js:66:41)
at Function.rs.stepDown (src/mongo/shell/utils.js:1001:43)
at (shell):1:4 at src/mongo/shell/query.js:83
foo:PRIMARY> rs.printReplicationInfo()
configured oplog size: 192MB
log length start to end: 897secs (0.25hrs)
oplog first event time: Wed Jul 15 2015 13:21:10 GMT-0700 (PDT)
oplog last event time: Wed Jul 15 2015 13:36:07 GMT-0700 (PDT)
now: Wed Jul 15 2015 13:36:46 GMT-0700 (PDT)
compile 'org.mongodb.mongo-hadoop:mongo-hadoop-core:1.4.0'