Hi Micheal,

I don't think the first URI is necessarily used as primary.

I rechecked our source code; setting multiple URIs in mongodb_uri gets 
around this need. If any of the supplied URIs point to the mongoDb primary, 
Graylog will work as expected. In our case, it made it irrelevant which MongoDB 
server was primary, since MongoDB will automatically elect one server in a 
replica set to primary.

Regards,
Ryan

On Thursday, April 7, 2016 at 2:21:41 PM UTC+1, Michael Laporte wrote:
>
> Hi Ryan
>
> Did you ever find out if the first Mongo_uri server is used as the primary?
>
>
>
> On Friday, 26 February 2016 08:45:33 UTC, [email protected] wrote:
>>
>> Hi,
>>
>> Thank you very much; your suggested changes to mongodb_uri worked 
>> perfectly, and our several-node Graylog cluster is now working as expected.
>>
>> On Monday, February 22, 2016 at 5:33:52 PM UTC, Florent B wrote:
>>>
>>> Hi,
>>>
>>> You can set multiple MongoDB servers in mongodb_uri as specified in 
>>> example config file :
>>>
>>> mongodb_uri = 
>>> mongodb://grayloguser:secret@localhost:27017,localhost:27018,localhost:27019/graylog2
>>>
>>> On 02/22/2016 03:39 PM, [email protected] wrote:
>>>
>>>
>>> Hello,
>>>
>>> We're currently implementing a setup with three-graylog servers, and 
>>> we're having a lot of problems getting MongoDb to work correctly with 
>>> Graylog:
>>>
>>>    - In order to run a cluster of three Graylog (1.2.1) servers, you 
>>>    need to set up a MongoDB replica set.
>>>    - 'mongodb_uri' (set in the configuration file) needs to point to 
>>>    the MongoDB replica set *primary*; (in this case we try to set it to 
>>>    "vm-0").
>>>    - Graylog fails with the following error if the URI does not point 
>>>    to the replica set primary (at least on initial startup):
>>>    
>>>
>>> ERROR [CmdLineTool] Guice error (more detail on log level debug): Error 
>>> injecting constructor, com.mongodb.CommandFailureException: { 
>>> "serverUsed" : "vm-0:27017" , "ok" : 0.0 , "errmsg" : "not master" , 
>>> "code" : 10107}
>>>
>>>
>>>
>>>    - There is no way to specify three mongodb_uri values, and let 
>>>    Graylog 'detect' which of these is primary.
>>>    - It is difficult to force MongoDB to set a particular VM to be 
>>>    primary reliably. 
>>>    
>>> This means that it is difficult to guarantee that mongodb_uri is 
>>> pointing to the current MongoDB master. There's only two ways I know how to 
>>> ensure Graylog' mongo_uri is pointing to the current master:
>>>
>>>    - Dynamically change the Graylog configuration file to point to the 
>>>    current primary each time Graylog starts up. 
>>>    - Write scripts to try force MongoDB's to place its primary on a 
>>>    particular server. 
>>>
>>> Neither of these are very good solutions, and manual setup is not an 
>>> option (the deployment is fully automated).
>>>
>>> Is there an easier way of configuring Graylog to always point towards 
>>> the current MongoDB replica set primary? Unfortunately, my options don't 
>>> include upgrading to 2.0.
>>>
>>> Thanks for any help you can offer; if any clarification is needed please 
>>> leave an email and I'll respond quickly.
>>>
>>>
>>> *Server Layout:*
>>>
>>> VM-0:
>>>
>>>    - Graylog-Server
>>>    - ElasticSearch
>>>    - MongoDb
>>>    
>>>
>>> VM-1:
>>>
>>>    - Graylog-Server
>>>    - Graylog-Web
>>>    - ElasticSearch
>>>    - MongoDb
>>>    
>>>
>>>
>>> VM-2:
>>>
>>>    - Graylog-Server
>>>    - ElasticSearch
>>>    - MongoDb
>>>    
>>>
>>> *Versions:*
>>>
>>>
>>>    - Web    1.3.3 
>>>    - Server 1.2.2 
>>>
>>>
>>>
>>> *Graylog's MongoDb-Related Configuration:*
>>>
>>> mongodb_useauth                                     = false
>>> mongodb_uri                                         = mongodb:
>>> //vm-0:27017/graylog2
>>> mongodb_max_connections                             = 100
>>> mongodb_threads_allowed_to_block_multiplier         = 5
>>> mongodb_replica_set                                 = vm-0:27017,vm-1:
>>> 27017,vm-2:27017
>>>
>>>
>>> *MongoDB Configuration:*
>>>
>>> storage:
>>>   dbPath: /var/lib/mongodb
>>>   journal:
>>>     enabled: true
>>>
>>>
>>> systemLog:
>>>   destination: file
>>>   logAppend: true
>>>   path: /var/log/mongodb/mongod.log
>>>
>>>
>>> net:
>>>   port: 27017
>>>
>>>
>>> replication:
>>>   replSetName: vm-replicaset-0
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Graylog Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to [email protected].
>>> To view this discussion on the web visit 
>>> <https://groups.google.com/d/msgid/graylog2/eb939a2b-939b-4f77-8ad0-e39e9ddfcad3%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> https://groups.google.com/d/msgid/graylog2/eb939a2b-939b-4f77-8ad0-e39e9ddfcad3%40googlegroups.com
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>>
>>>

-- 
You received this message because you are subscribed to the Google Groups 
"Graylog Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/graylog2/4e17d946-2482-4127-aa24-db89245ffac4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to