[ https://jira.fiware.org/browse/HELP-14048?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Joaquín Salvachúa reassigned HELP-14048:
-----------------------------------------
Assignee: Andres Muñoz (was: Joaquín Salvachúa )
> [fiware-stackoverflow] Cygnus and mongodb: Authentication failed
> ----------------------------------------------------------------
>
> Key: HELP-14048
> URL: https://jira.fiware.org/browse/HELP-14048
> Project: Help-Desk
> Issue Type: Monitor
> Components: FIWARE-TECH-HELP
> Reporter: Backlog Manager
> Assignee: Andres Muñoz
> Labels: docker, fiware, fiware-cygnus, mongodb
>
> Created question in FIWARE Q/A platform on 26-04-2018 at 17:04
> {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/50046646/cygnus-and-mongodb-authentication-failed
> +Question:+
> Cygnus and mongodb: Authentication failed
> +Description:+
> I'm trying to use cygnus and mongdb with docker.
> My docker-compose:
> cygnus:
> image: fiware/cygnus-ngsi:1.7.1
> hostname: cygnus
> container_name: cygnus
> volumes:
> - ./config/cygnus/agent.conf:/opt/apache-flume/conf/agent.conf
> links:
> - mysql-cygnus:mysql-cygnus
> external_links:
> - mongodb:mongodb
> expose:
> - "5050"
> ports:
> - "5050:5050"
> environment:
> - CYGNUS_MONGO_HOSTS=mongodb:27017
> - CYGNUS_MONGO_USER=cygnus
> - CYGNUS_MONGO_PASS=f10t_Mongo
> - CYGNUS_LOG_LEVEL=INFO
> ...
> mongodb:
> image: mongo:3.4.7
> hostname: mongodb
> image: aashreys/mongo-auth:latest
> expose:
> - "27017"
> ports:
> - "27017:27017"
> environment:
> - AUTH=yes
> - MONGODB_ADMIN_USER=admin_cygnus
> - MONGODB_ADMIN_PASS=admin_cygnus
> expose:
> - "27017"
> ports:
> - "27017:27017"
> My agent.conf
> cygnus-ngsi.sinks.mongo-sink.mongo_hosts = mongodb:27017
> cygnus-ngsi.sinks.mongo-sink.mongo_username = cygnus
> cygnus-ngsi.sinks.mongo-sink.mongo_password = f10t_Mongo
> But I got in cygnus log:
> msg=com.telefonica.iot.cygnus.sinks.NGSISink[533] : Persistence error.
> Message: -, Timed out after 30000 ms while waiting for a server that matches PrimaryServerSelector.
> Client view of cluster state is {type=UNKNOWN, servers=[{address=mongodb:27017, type=UNKNOWN, state=CONNECTING, exception={com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='cygnus', source='cygnus_imd', password=<hidden>, mechanismProperties={}}}, caused by {com.mongodb.MongoCommandException:
> Command failed with error 18: 'Authentication failed.' on server mongodb:27017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }}}]
> and mongo log:
> 2018-04-25T20:59:19.684+0000 I ACCESS [conn136] SCRAM-SHA-1 authentication failed for cygnus on cygnus_imd from client 172.18.0.4:37250 ; UserNotFound: Could not find user cygnus at cygnus_imd
> I resolved the problem creating the user inside the database cygnus_imd:
> use cygnus_imd
> db.createUser(
> {
> user: "cygnus",
> pwd: "f10t_Mongo",
> roles: [ "readWrite", "dbAdmin" ]
> }
> );
> But I don't think that is a good solution, because I can't create a user for each dataset of my cygnus, it should be done automatically. I think that the authentication doesn't work with a database empty. But at the begin, all databases are empties. So I don't know how fix it.
--
This message was sent by Atlassian JIRA
(v6.4.1#64016)
You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy Cookies policy