Skip to content

Instantly share code, notes, and snippets.

@viveksinghggits
Created November 29, 2019 08:05
Show Gist options
  • Save viveksinghggits/6e7de2656f43bd54c54cdb91cad39ebf to your computer and use it in GitHub Desktop.
Save viveksinghggits/6e7de2656f43bd54c54cdb91cad39ebf to your computer and use it in GitHub Desktop.
kubectl exec -it -n mongo-test mongo-mongodb-primary-0 bash
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"ismaster" : false,
"secondary" : false,
"info" : "Does not have a valid replica set config",
"isreplicaset" : true,
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:56:36.951Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1
}
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"hosts" : [
"mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"setName" : "rs0",
"setVersion" : 1,
"ismaster" : false,
"secondary" : true,
"primary" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"me" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"electionId" : ObjectId("7fffffff0000000000000001"),
"lastWrite" : {
"opTime" : {
"ts" : Timestamp(1575014199, 2),
"t" : NumberLong(1)
},
"lastWriteDate" : ISODate("2019-11-29T07:56:39Z"),
"majorityOpTime" : {
"ts" : Timestamp(1575014199, 2),
"t" : NumberLong(1)
},
"majorityWriteDate" : ISODate("2019-11-29T07:56:39Z")
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:56:39.546Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1
}
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
2019-11-29T07:56:49.036+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):3:6
exception: connect failed
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
2019-11-29T07:56:52.449+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):3:6
exception: connect failed
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
2019-11-29T07:56:53.416+0000 E QUERY [js] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed: SocketException: Error connecting to 127.0.0.1:27017 :: caused by :: Connection refused :
connect@src/mongo/shell/mongo.js:344:17
@(connect):3:6
exception: connect failed
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"hosts" : [
"mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"mongo-mongodb-secondary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"arbiters" : [
"mongo-mongodb-arbiter-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"setName" : "rs0",
"setVersion" : 3,
"ismaster" : true,
"secondary" : false,
"primary" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"me" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"electionId" : ObjectId("7fffffff0000000000000002"),
"lastWrite" : {
"opTime" : {
"ts" : Timestamp(1575014217, 1),
"t" : NumberLong(2)
},
"lastWriteDate" : ISODate("2019-11-29T07:56:57Z")
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:56:57.758Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1,
"operationTime" : Timestamp(1575014217, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1575014217, 1),
"signature" : {
"hash" : BinData(0,"snCoeWQMpYNj5QMAAX9oQ+/lTrE="),
"keyId" : NumberLong("6764634544160112641")
}
}
}
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"hosts" : [
"mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"mongo-mongodb-secondary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"arbiters" : [
"mongo-mongodb-arbiter-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"setName" : "rs0",
"setVersion" : 3,
"ismaster" : true,
"secondary" : false,
"primary" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"me" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"electionId" : ObjectId("7fffffff0000000000000002"),
"lastWrite" : {
"opTime" : {
"ts" : Timestamp(1575014217, 1),
"t" : NumberLong(2)
},
"lastWriteDate" : ISODate("2019-11-29T07:56:57Z")
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:56:59.463Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1,
"operationTime" : Timestamp(1575014217, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1575014217, 1),
"signature" : {
"hash" : BinData(0,"snCoeWQMpYNj5QMAAX9oQ+/lTrE="),
"keyId" : NumberLong("6764634544160112641")
}
}
}
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"hosts" : [
"mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"mongo-mongodb-secondary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"arbiters" : [
"mongo-mongodb-arbiter-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"setName" : "rs0",
"setVersion" : 3,
"ismaster" : true,
"secondary" : false,
"primary" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"me" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"electionId" : ObjectId("7fffffff0000000000000002"),
"lastWrite" : {
"opTime" : {
"ts" : Timestamp(1575014217, 1),
"t" : NumberLong(2)
},
"lastWriteDate" : ISODate("2019-11-29T07:56:57Z")
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:57:00.989Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1,
"operationTime" : Timestamp(1575014217, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1575014217, 1),
"signature" : {
"hash" : BinData(0,"snCoeWQMpYNj5QMAAX9oQ+/lTrE="),
"keyId" : NumberLong("6764634544160112641")
}
}
}
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"hosts" : [
"mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"mongo-mongodb-secondary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"arbiters" : [
"mongo-mongodb-arbiter-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"setName" : "rs0",
"setVersion" : 3,
"ismaster" : true,
"secondary" : false,
"primary" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"me" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"electionId" : ObjectId("7fffffff0000000000000002"),
"lastWrite" : {
"opTime" : {
"ts" : Timestamp(1575014217, 1),
"t" : NumberLong(2)
},
"lastWriteDate" : ISODate("2019-11-29T07:56:57Z")
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:57:02.483Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1,
"operationTime" : Timestamp(1575014217, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1575014217, 1),
"signature" : {
"hash" : BinData(0,"snCoeWQMpYNj5QMAAX9oQ+/lTrE="),
"keyId" : NumberLong("6764634544160112641")
}
}
}
I have no name!@mongo-mongodb-primary-0:/$ mongo admin --authenticationDatabase admin -u root -p $MONGODB_ROOT_PASSWORD --quiet --eval "db.isMaster()"
{
"hosts" : [
"mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"mongo-mongodb-secondary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"arbiters" : [
"mongo-mongodb-arbiter-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017"
],
"setName" : "rs0",
"setVersion" : 3,
"ismaster" : true,
"secondary" : false,
"primary" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"me" : "mongo-mongodb-primary-0.mongo-mongodb-headless.mongo-test.svc.cluster.local:27017",
"electionId" : ObjectId("7fffffff0000000000000002"),
"lastWrite" : {
"opTime" : {
"ts" : Timestamp(1575014217, 1),
"t" : NumberLong(2)
},
"lastWriteDate" : ISODate("2019-11-29T07:56:57Z"),
"majorityOpTime" : {
"ts" : Timestamp(1575014217, 1),
"t" : NumberLong(2)
},
"majorityWriteDate" : ISODate("2019-11-29T07:56:57Z")
},
"maxBsonObjectSize" : 16777216,
"maxMessageSizeBytes" : 48000000,
"maxWriteBatchSize" : 100000,
"localTime" : ISODate("2019-11-29T07:57:07.782Z"),
"logicalSessionTimeoutMinutes" : 30,
"minWireVersion" : 0,
"maxWireVersion" : 7,
"readOnly" : false,
"ok" : 1,
"operationTime" : Timestamp(1575014217, 1),
"$clusterTime" : {
"clusterTime" : Timestamp(1575014217, 1),
"signature" : {
"hash" : BinData(0,"snCoeWQMpYNj5QMAAX9oQ+/lTrE="),
"keyId" : NumberLong("6764634544160112641")
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment