Closed ohardy closed 6 years ago
I've never used replSet, so I don't really know what either of those errors mean.
@ohardy I'm trying to convert my container, too...
Direct running needs a patch https://github.com/docker-library/mongo/issues/211#issuecomment-344347819
Meanwhile, did you try to invert the options?
--replSet example --auth
@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?
I got it to work “à postériori”.. I’ll try and create a gist...
(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
@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
.
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.
For anyone struggling with @malixsys's code not working, it's likely because your MongoDB version is already up to date and the dokku mongo:upgrade
command doesn't run and restart the container. To do that instead of upgrading, do the following:
docker rm dokku.mongo.YOUR_SERVICE
dokku mongo:start YOUR_SERVICE
Hat tip https://realmenweardress.es/2019/07/running-rocketchat-on-a-dokku-paas-server/
Quick question for those in the discussion: Did any of you manage to use a hostname other than the container ID? I've tried updating it but realise I need to update the /etc/hosts
file in order to do it. I though maybe that would be possible with the docker-options plugin but it only seems to work on dokku apps and not plugin containers.
This is what I receive:
admin> rs.initiate()
MongoServerError: This node was not started with replication enabled.
If i export MONGO_CONFIG_OPTIONS with :
And i create a new mongo database with :
It's just return just after the first echo in functions.sh L54.
give me :
If i try manually to run the docker command got with trace, i get :