Closed shsunmoonlee closed 5 years ago
related: https://github.com/dokku/dokku-mongo/issues/113 I'm suspecting it's related to the fact that I've changed droplet's password which is different from the mongodb local password when I run dokku --trace mongo:import seunghunlee.net
The droplet password and the mongodb password are not related. Did you change the password in the mongodb server itself?
No I haven't
Can you post the actual output of the command you are running?
ssh root@157.230.217.128
dokku mongo:import seunghunlee.net < seunghunlee.net.dump.gz
2019-02-04T02:10:26.659+0000 Failed: error connecting to db server: server returned error on SASL authentication step:
Yeah, so changing the password on the server had no effect on mongo itself.
What is the output of dokku mongo:enter seunghunlee.net
?
It succesfully enters somewhere
root@554447683e7f:/#
root@554447683e7f:/# mongo
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.9
> show dbs
2019-02-04T02:26:51.671+0000 E QUERY [thread1] Error: listDatabases failed:{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
"code" : 13,
"codeName" : "Unauthorized"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1
shellHelper.show@src/mongo/shell/utils.js:769:19
shellHelper@src/mongo/shell/utils.js:659:15
@(shellhelp2):1:1
>
Try dokku mongo:connect-admin seunghunlee.net
root@dokku-s-1vcpu-1gb-nyc1-01:~# dokku mongo:connect-admin seunghunlee.net
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017/seunghunlee.net
2019-02-04T14:28:54.958+0000 E QUERY [thread1] Error: Failed to parse mongodb:// URL: mongodb://127.0.0.1:27017/seunghunlee.net :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
Did you change the admin password on mongodb? Thats the only reason you'd see that error.
No I've only changed the droplet password
On Tue, Feb 5, 2019, 1:07 AM Jose Diaz-Gonzalez <notifications@github.com wrote:
Did you change the admin password on mongodb? Thats the only reason you'd see that error.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/dokku/dokku-mongo/issues/115#issuecomment-460305669, or mute the thread https://github.com/notifications/unsubscribe-auth/AG-Ov5YRhElmWcDZF5vzIu5pllk9hPFNks5vKFrIgaJpZM4afcr6 .
Might be that periods are not valid in a mongodb database name?
Sorry what does that mean? What steps should I take?
Can you check if a period character (.
) can be used in a mongodb database name?
doens't seem to be an issue
Using a database name with a period in it works for most operations but causes safe mode to throw an error. If these are not valid database names reject them at connection time so the error is obvious. E.g. this code fails:
let me delete and re create database without period
That was it! You shouldn't include dot in your mongodb name when 'dokku mongo:create ' I've changed it to seunghunlee instead of seunghunlee.net now this command works
dokku mongo:import seunghunlee < seunghunlee.net.dump.gz
Thank you so much @josegonzalez for your awesome help.
Oh I found this issue persisting tho!
root@dokku-s-1vcpu-1gb-nyc1-01:~# dokku mongo:enter seunghunlee
-----> Filesystem changes may not persist after container restarts
root@842a127467f1:/# mongo
MongoDB shell version v3.4.9
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.4.9
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
> show dbs
2019-02-08T05:35:26.599+0000 E QUERY [thread1] Error: listDatabases failed:{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
"code" : 13,
"codeName" : "Unauthorized"
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1
shellHelper.show@src/mongo/shell/utils.js:769:19
shellHelper@src/mongo/shell/utils.js:659:15
@(shellhelp2):1:1
What are your exact reproduction steps for creating this database and interacting with it?
Ah we may need to grant admin to that database? https://github.com/dokku/dokku-mongo/blob/1ce8d1747b11f1addf67d70ce8ba5f41816c7e87/functions#L96
Wait, so you're just entering the container and running arbitrary commands? You may wish to instead use dokku mongo:connect-admin SERVICE
, which will connect via the administrative credentials, which will give you listDatabases
.
Ah gotcha.
dokku mongo:connect-admin SERVICE
works for me!
Description of problem
Can't mongo:import file
How reproducible
seunghunlee$ ssh root@157.230.217.128 mongo:import seunghunlee.net < seunghunlee.net.dump.gz
Actual Results
Failed: error connecting to db server: server returned error on SASL authentication step
Expected Results
Successfully import mongodumped file into my database seunghunlee.net
Environment Information
one click deployed digital ocean dokku droplet
dokku report APP_NAME
outputHow (deb/make/rpm) and where (AWS, VirtualBox, physical, etc.) was Dokku installed?:
Additional information
dokku inspect APP_NAME
docker inspect CONTAINER_ID
: WARNING,docker inspect
will print environment variables for some commands, be sure you're not exposing any sensitive information when posting issues. You may replace these values with XXXXXXX.cat /home/dokku/<app>/nginx.conf
(if applicable):Dockerfile
, the contents of that fileProcfile
.dokku trace on
(BEWARE:trace on
will print environment variables for some commands, be sure you're not exposing any sensitive information when posting issues. You may replace these values with XXXXXXX):