Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not work with mongodb secondaries #4

Open
nilroy opened this issue Dec 7, 2015 · 7 comments
Open

Does not work with mongodb secondaries #4

nilroy opened this issue Dec 7, 2015 · 7 comments
Assignees

Comments

@nilroy
Copy link

nilroy commented Dec 7, 2015

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

@mrfreezer
Copy link

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

@mrfreezer
Copy link

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

@nilroy
Copy link
Author

nilroy commented Mar 2, 2016

@lennartkoopmann Any update on this?

@nilroy
Copy link
Author

nilroy commented Jun 10, 2016

Any update?

@mariussturm
Copy link

@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.

@nilroy
Copy link
Author

nilroy commented Jun 10, 2016

@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.

@fadenb
Copy link

fadenb commented Jul 13, 2020

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants