MongoDB

1 comment:

  1. Hi Prathik Soni,

    We have one query about failover using YCSB(Yahoo Cloud Servicing Benchmark)

    Just few days back onwards, we started doing some performance testing on MongoDB. Everything is working as expect failover. We have tried following options.

    Could you please let us know if any other parameters needs to send via ycsb command line for automatically perform write/read operations while primary is down.

    1st option

    We have taken 2 AWS MongoDB instances one primary and one secondary. We have created replicaset for validating failover case.

    If Primary is down it should automatically elect secondary as primary and perform the operations. However it is not happening from YCSB tool with command line. Below is the command line which we are using.

    ./bin/ycsb load mongodb -P workloads/workloada -p recordcount=750000 -threads 20 -p mongodb.url=mongodb://username:password@mongodbinstance1.com:27017,mongodbinstance2.com:27017/dbname?replicaSet=rep1&autoReconnect=true

    2nd option

    We have taken 3 machines and created replicaset. Once primary is down, behind electing secondary is happening, however writing to db is not happening.

    Here is the command which we have used while validating in local machines:

    ./bin/ycsb load mongodb-async -s -P workloads/workloada -p recordcount=750000 -threads 20 -p mongodb.url=mongodb://username:password@machineoneIP:27017,machinetwoIP:27017,machinethreeIP:27017/mongotag?replicaSet=rep1&autoReconnect=true&&serverSelectionTimeoutMS=10&serverSelectionTryOnce=true&readPreference=primary&w=2

    We have got following errors:

    com.mongodb.MongoCommandException: Command failed with error 11600: 'interrupted at shutdown' on server 192.168.1.118:27017. The full response is { "operationTime" : { "$timestamp" : { "t" : 1534227554, "i" : 2423 } }, "ok" : 0.0, "errmsg" : "interrupted at shutdown", "code" : 11600, "codeName" : "InterruptedAtShutdown", "$clusterTime" : { "clusterTime" : { "$timestamp" : { "t" : 1534227554, "i" : 2423 } }, "signature" : { "hash" : { "$binary" : "AAAAAAAAAAAAAAAAAAAAAAAAAAA=", "$type" : "00" }, "keyId" : { "$numberLong" : "0" } } } } at com.mongodb.connection.ProtocolHelper.getCommandFailureException(ProtocolHelper.java:164)
    com.mongodb.MongoWriteException: Not primary while writing to mongotag.usertablea com.mongodb.MongoCollectionImpl.executeSingleWriteRequest(MongoCollectionImpl.java:1033)
    INFO: Closed connection [connectionId{localValue:5, serverValue:34}] to 192.168.1.60:27017 because there was a socket exception raised on another connection from this pool. Exception while trying bulk insert with 0 com.mongodb.MongoNotPrimaryException: The server is not the primary and did not execute the operation at com.mongodb.connection.ProtocolHelper.createSpecialException(ProtocolHelper.java:223)

    Could you please let us know any suggestion on how to test failover with replicaset.

    Thank you, Mahendra

    ReplyDelete

Protected by Copyscape