Open nilroy opened 9 years ago
i would like to confirm this for mongodb 2.4 as well. (1 primary, 1 secondary) this is what i see in the graylog-server logfile as soon as i start the input pointing to the secondary:
2016-01-12T11:20:42.922+01:00 ERROR [ProfileSubscriber] Error when reading MongoDB profile information. Retrying. com.mongodb.MongoException: not talking to master and retries used up at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:323) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:325) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:325) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:273) at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:84) at com.mongodb.DBCollectionImpl.find(DBCollectionImpl.java:66) at com.mongodb.DBCursor._check(DBCursor.java:498) at com.mongodb.DBCursor._hasNext(DBCursor.java:621) at com.mongodb.DBCursor.hasNext(DBCursor.java:657) at com.graylog2.inputs.mongoprofiler.input.mongodb.ProfileSubscriber.run(ProfileSubscriber.java:83)
for me this looks like the input (or the mongodb-driver inside java if that one is used) refuses to talk to a secondary (since i can "manually" look at the profiling on a secondary via the mongo-console this doesn't look like a mongo-db issue to me)
for me this renders the input rather useless since most queries are executed on the secondary, especially the time consuming ones...
ingo
a little more research tells me that the solution might be rather easy. mongodb reports in its logs (on the secondary) that the query should not be executed on slaves:
assertion 13435 not master and slaveOk=false ns:xxxxxx.system.profile query
which, in my limited concept of mongodb means all you have to do is extend your query which is polling the profiling log with a "slaveOk=yes" to make it work.
to bad i am so not into java programming otherwise i would have tried to fix it myself instead of just smart-assing around ;)
ingo
@lennartkoopmann Any update on this?
Any update?
@nilroy please dont ask for status updates all the time. When something changes people will leave a note here. Open source is about contributing not pushing others.
Thanks.
@mariussturm Sorry if I bothered anybody. I am not trying to push anybody. And I know that what opensource is all about. If I would be a Java guy I would have tried to fix it atleast. I expected a reply like if someone is working or it would take time. I was just wandering what happened to this as it was opened for long time. I would appreciate if this issue is labelled or classified. Sorry if I bothered again.
a little more research tells me that the solution might be rather easy. mongodb reports in its logs (on the secondary) that the query should not be executed on slaves:
assertion 13435 not master and slaveOk=false ns:xxxxxx.system.profile query which, in my limited concept of mongodb means all you have to do is extend your query which is polling the profiling log with a "slaveOk=yes" to make it work.
to bad i am so not into java programming otherwise i would have tried to fix it myself instead of just smart-assing around ;)
ingo
You can try executing rs.slaveOK()
in a MongoDB client to allow those queries on a slave without modifying the code.
Just keep in mind to persist this so it does not break when you have to restart your MongoDB.
I have enabled profiling for both the primary and secondary mongodb (we are using replica set). Profiling level being 2 (that is profiling all queries). But only those queries executed against the master are shown in graylog. Is it designed to do so or I am missing something?
I am using mongodb 3.0