0 Replies Latest reply on May 7, 2019 8:00 AM by lkrzyzanek

    How to configure replicaSetName in Widlfly/MongoDB

    lkrzyzanek

      Hi,

      I'm trying to figure out how to pass replicaSet name to Mongo DB connection.

       

      I use Thorntail 2.4.0 with such config:

       

      mongodb:
        mongos:
          mongodb-profile:
            database: xxx
            hosts:
            - mongodb-host1:
              outbound-socket-binding-ref: mongodb-host1
            - mongodb-host2:
              outbound-socket-binding-ref: mongodb-host2
            - mongodb-host3:
              outbound-socket-binding-ref: mongodb-host3
            id: xxx
            jndi-name: xxx
            module: xxx
            ssl: true
            properties:
              default:
                property:
                  writeConcern: UNACKNOWLEDGED
                  readConcern: LOCAL
                  requiredReplicaSetName: replicaname
                  sslInvalidHostNamesAllowed: true

       

      It leads into exception:

      2019-05-07 11:15:23,120 ERROR [org.jboss.as.controller.management-operation] (ServerService Thread Pool -- 19) WFLYCTL0013: Operation ("add") failed - address: ([
          ("subsystem" => "mongodb"),
          ("mongo" => "mongodb-profile"),
          ("properties" => "default")
      ]) - failure description: "Invalid property name: requiredReplicaSetName"

       

      I read mongo configuration docs (wildfly-nosql/README.adoc at master · wildfly/wildfly-nosql · GitHub ) also checked XSD (wildfly-nosql/wildfly-mongodb_1_0.xsd at master · wildfly/wildfly-nosql · GitHub ) and it looks like only writeConcern and readConcern properties are  allowed.

       

      So the question is how to configure replicaSet name like it's defined in such shell connection:

      mongo --ssl --sslAllowInvalidCertificates -u user -p CHANGE --authenticationDatabase admin mongodb://HOSTA:27017,HOSTB:27017,HOSTC:27017/DBNAME?replicaSet=replicaname

       

      Same applies for other properties like authentication Database (authSource) or timeout.

       

      Thanks,

       

      Libor