Mongodb connection string


(Akash Kumar Dutta) #1

I have learned from the official documentation that I need to make a replica set for mongodb instances, but the way they are dns labelled in the env var of GRAYLOG_MONGODB_URI is something like : mongodb://mongo-mongodb-replicaset-0.mongo-mongodb-replicaset:27017,mongo-mongodb-replicaset-1.mongo-mongodb-replicaset.mongo:27017,mongo-mongodb-replicaset-2.mongo-mongodb-replicaset:27017/graylog?replicaSet=rs0 . But this looks like a stateful set and not a replicaset. What is that I need to make for mongodb ? Statefulset or replicaset. In case stateful what is the name=value pair for replicaSet=rs0 that comes at the end of the connection string ?


(Jochen) #2

Please refer to the documentation for MongoDB connection strings at https://docs.mongodb.com/manual/reference/connection-string/


(Akash Kumar Dutta) #3

Can you just exlaim me that repclicaSet=rs0 is used by graylog or mongodb ?


(Jochen) #4

Please rephrase your question and take a look at the examples at https://docs.mongodb.com/manual/reference/connection-string/#standard-connection-string-format.


(Akash Kumar Dutta) #5

Rephrased : Do we require to set the replicaSet=rs0 in the mongo db connection string. In the link here https://github.com/Graylog2/graylog2-server/blob/2.2.3/misc/graylog.conf they do not mention the “?replicaSet=rs0” options part in the mongo db connection string in the statefulsets. But in the mongo db connection string here : https://docs.mongodb.com/manual/reference/connection-string/#standard-connection-string-format they do mention. Thanks.


(Jochen) #6

When in question, use the format described in the MongoDB documentation.


(system) #7

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.