Last active
April 7, 2018 20:36
-
-
Save BruceZu/6054cc22ad8a298999013f3edee14330 to your computer and use it in GitHub Desktop.
Mongo replset in docker. Python access and verify Mongo replset.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
mongo replica set 3.4.4 local docker engine (bridge) |
connect mongo arbiter in docker
$ docker exec -it forticloudplatform_mongo_1 mongo mongodb://forticloudplatform_mongo_arbiter_1
run python from local 'worker' Docker container
$ docker exec -it $(docker ps | grep worker | cut -d" " -f 1) python
find out all place where the code need update: configuration and code
(.venv) bzu@bruce-laptop:~/project/FortiCloudPlatform$ grep -Rr "MONGODB" . --exclude-dir=".venv" --exclude-dir=".idea" --exclude-dir=".git"
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
=================
on sshhop prepare python environment same as the test environment : 3.5
Reference
http://api.mongodb.com/python/current/examples/index.html
http://api.mongodb.com/python/current/api/pymongo/mongo_client.html
https://github.com/mongodb/mongo-python-driver?jmp=docs
https://stackoverflow.com/questions/22035257/django-non-rel-connecting-to-multiple-hosts-in-a-replica-set