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

Using "replSet" in MONGO_CONFIG_OPTIONS #88

Closed
ohardy opened this issue Aug 2, 2017 · 7 comments

Comments

@ohardy
Copy link

commented Aug 2, 2017

If i export MONGO_CONFIG_OPTIONS with :

export MONGO_CONFIG_OPTIONS=" --auth --replSet example "

And i create a new mongo database with :

dokku mongo:create test

It's just return just after the first echo in functions.sh L54.

dokku mongo:connect test

give me :

connecting to: mongodb://127.0.0.1:27017/test
MongoDB server version: 3.4.6
2017-08-02T12:21:27.542+0000 E QUERY    [thread1] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1461:20
@(auth):6:1
@(auth):1:2
exception: login failed

If i try manually to run the docker command got with trace, i get :

2017-08-02T12:15:42.339+0000 E QUERY    [thread1] Error: couldn't add user: not master :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.createUser@src/mongo/shell/db.js:1292:15
@(shell):1:1
bye
@josegonzalez

This comment has been minimized.

Copy link
Member

commented Aug 26, 2017

I've never used replSet, so I don't really know what either of those errors mean.

@malixsys

This comment has been minimized.

Copy link
Contributor

commented Feb 20, 2018

@ohardy I'm trying to convert my container, too...

Direct running needs a patch
docker-library/mongo#211 (comment)

Meanwhile, did you try to invert the options?

--replSet example --auth

@wootwoot1234

This comment has been minimized.

Copy link

commented Jul 22, 2018

@ohardy Did you ever get this working?

@malixsys I tried inverting the options as suggested but no luck. Still can't connect. Any other ideas?

@malixsys

This comment has been minimized.

Copy link
Contributor

commented Jul 22, 2018

I got it to work “à postériori”.. I’ll try and create a gist...

@malixsys

This comment has been minimized.

Copy link
Contributor

commented Jul 22, 2018

YMMV

(updated for latest version)

nano  /var/lib/dokku/services/mongo/YOUR_SERVICE/MONGO_CONFIG_OPTIONS
 --replSet rs0  --storageEngine wiredTiger --auth
sudo docker pull mongo:3.6
dokku mongo:upgrade YOUR_SERVICE  -I 3.6
dokku mongo:upgrade YOUR_SERVICE  -I 3.6.13
dokku mongo:connect-admin YOUR_SERVICE

// IN MONGO

use admin
rs.initiate()
use local
db.system.replset.find()
exit
@StefanoDeVuono

This comment has been minimized.

Copy link

commented Jul 29, 2018

@malixsys is correct. As per mongo's documentation a standaone db needs to be initiated to run as a replica set.

rs.initiate()

Then wait until the prompt says PRIMARY or SECONDARY.

@josegonzalez

This comment has been minimized.

Copy link
Member

commented Jul 29, 2018

Closing as this isn't really in the scope of this plugin, and I think folks have a sufficiently good answer to get started down this path.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
5 participants
You can’t perform that action at this time.