How to configure a MongoDB cluster which supports sessions?

前端 未结 6 730
刺人心
刺人心 2020-12-16 17:32

I want to explore the new transaction feature of MongoDB and use Spring Data MongoDB. However, I get the exception message \"Sessions are not supported by the MongoDB cl

6条回答
  •  猫巷女王i
    2020-12-16 17:44

    With the reference to the answer give by @kakabali, I have few a bit different scenario and configure it.

    I am configure mongo with spring boot and try to use transactions management and getting the error:

    com.mongodb.MongoClientException: Sessions are not supported by the MongoDB cluster to which this client is connected at

    I follow few of the steps given by above answer and added few:

    Change the mongo.cfg and added this

    replication:
       oplogSizeMB: 128
       replSetName: "rs0"
       enableMajorityReadConcern: true
    

    Restart the service as I am using Windows10.

    Open mongo console and run rs.initilize()

提交回复
热议问题