Repository: yougov/mongo-connector

Issue #626: pymongo.errors.OperationFailure: not authorized on admin to execute command { listDatabases: 1 }
Created: 2017-01-11T18:12:41Z
Why do I keep getting the error below
pymongo.errors.OperationFailure: not authorized on admin to execute command { listDatabases: 1 } 
`
my config json is below
{
"comment": "Configuration options starting with '' are disabled",
"comment": "To enable them, remove the preceding ''",
"mainAddress": "mongodb://cluster-a0.mlab.com:35828,cluster-a1.mlab.com:35828/admin?replicaSet=rs-cluster",
"oplogFile": "/var/log/mongo-connector/oplog.timestamp",
"noDump": false,
"batchSize": -1,
"verbosity": 3,
"continueOnError": false,

"logging": {
    "type": "stream",
    "__filename": "/var/log/mongo-connector/mongo-connector.log",
    "__format": "%(asctime)s [%(levelname)s] %(name)s:%(lineno)d - %(message)s",
    "__rotationWhen": "D",
    "__rotationInterval": 1,
    "__rotationBackups": 10,

    "__type": "syslog",
    "__host": "localhost:514"
},

"authentication": {
    "adminUsername": "oplog-reader",
    "password": "password",
    "__passwordFile": "mongo-connector.pwd"
},

"__comment__": "For more information about SSL with MongoDB, please see http://docs.mongodb.org/manual/tutorial/configure-ssl-clients/",
"__ssl": {
    "__sslCertfile": "Path to certificate to identify the local connection against MongoDB",
    "__sslKeyfile": "Path to the private key for sslCertfile. Not necessary if already included in sslCertfile.",
    "__sslCACerts": "Path to concatenated set of certificate authority certificates to validate the other side of the connection",
    "__sslCertificatePolicy": "Policy for validating SSL certificates provided from the other end of the connection. Possible values are 'required' (require and validate certificates), 'optional' (validate but don't require a certificate), and 'ignored' (ignore certificates)."
},

"__fields": ["field1", "field2", "field3"],

"namespaces": {
    "include": [
        "mydb.jobs",
        "mydb.workflows"
    ]
},

"docManagers": [
    {
        "docManager": "solr_doc_manager",
        "targetURL": "http://192.168.99.100:8983/solr/gettingstarted",
        "__bulkSize": 1000,
        "__uniqueKey": "_id",
        "__autoCommitInterval": null
    }
]

}
`

Duplicate issue #629: listDatabases command
Created: 2017-01-19T17:43:47Z
Hi, why I'm I getting this issue as I've specified the namespace already. So as per the docs the listDatabases permission is not required if you provide the namespace-set
2017-01-19 17:40:32,738 [ERROR] mongo_connector.util:86 - Call to <bound method MongoClient.database_names of MongoClient(host=['remotemongo-url:port'], document_class=dict, tz_aware=False, connect=True, replicaset=replicaset)> failed too many times in retry_until_ok
Traceback (most recent call last):
File "/home/ubuntu/.local/lib/python2.7/site-packages/mongo_connector/util.py", line 78, in retry_until_ok
return func(*args, **kwargs)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/mongo_client.py", line 1149, in database_names
"listDatabases")["databases"]]
File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/database.py", line 494, in command
codec_options, **kwargs)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/database.py", line 406, in _command
parse_write_concern_error=parse_write_concern_error)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/pool.py", line 419, in command
collation=collation)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/network.py", line 116, in command
parse_write_concern_error=parse_write_concern_error)
File "/home/ubuntu/.local/lib/python2.7/site-packages/pymongo/helpers.py", line 210, in _check_command_response
raise OperationFailure(msg % errmsg, code, response)
OperationFailure: not authorized on admin to execute command { listDatabases: 1 }

Closing comment (2017-02-22T01:16:46Z): Duplicates #626.