-
Notifications
You must be signed in to change notification settings - Fork 633
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
Mongos should be allowed to run initdb.d scripts too #365
Comments
Is this a duplicate of #339? #339 (comment) |
Actually I did a pretty big jerry rig and was able to configure it, but I did from other container running The hack is something like this: nohup bash -c "sleep 10 && echo 'rs.initiate({_id: \"mongors1\", members: [{_id: 0, host: \"db\"}]})' | mongo --host db" & It's really really ugly, but it works. |
Not sure, if this is directly related, but i had a similiar issue. #!/bin/bash
if [ "$1" != "CHILD" ]
then
# we are the main process so we need to start our child
echo "STARTING CHILD"
/bin/bash $BASH_SOURCE CHILD &
else
# we are the CHILD so we run the actual init code:
echo "Starting BG init script. Wating for Mongo to listen on $MONGO_HOST"
## waiting for mongo to be available
until nc -z $MONGO_HOST 27017
do
sleep 1
done
echo "going on.. Initialize replset"
# initializing replicaset
mongo --eval "rs.initiate({ _id: \"$MONGO_REPLSET\", version: 1, members: [ { _id: 0, host : \"$MONGO_HOST\" }, ] });"
mongo --eval 'rs.status()'
fi This required me to set MONGO_HOST to the name of the service (in my compose file) and MOGO_REPLSET to the replSet Name. |
I actually didn't figure out how the workarounds mentioned here can be used to run a I need to setup a sharded cluster that has the config server and shards up and running. The only requirement here is to run a |
Basically, I'm trying to configure shards when running
mongos
:But the scripts in
docker-entrypoint-initdb.d
only run formongod
:mongo/3.6/docker-entrypoint.sh
Lines 192 to 318 in 59fba66
Does it make sense to run for
mongos
too?The text was updated successfully, but these errors were encountered: