Mongodb
the steps
- ubutun
- docker
sudo snap install docker
- docker install MongoDB image
sudo docker pull mongo:latest
- create docker-compose.yml in /HOME
- start docker container
docker-compose up -d
- go into mongodb
docker-compose exec mongo bash mongo admin -u cbre -p
Note: you can do it in docker, but i suggest you do it from GUI client
show databases use deal -- show tables show collections db.hoge.insert({ name: "test" }) db.hoge.find() ... exit
-
access from python
- the sample code main.py
from pymongo import MongoClient # use docker image name instead of the hostname client = MongoClient('mongo', 27017)
- stop the container
docker-compose down
the reference https://qiita.com/mistolteen/items/ce38db7981cc2fe7821a
- install mongodbsqld
https://docs.mongodb.com/bi-connector/master/tutorial/install-bi-connector-debian/
mongosqld install --config /root/mongodb-bi-linux-x86_64-ubuntu1804-v2.13.4/example-mongosqld-config.yml
mongosql service installed
root@ip-10-0-0-6:~/mongodb-bi-linux-x86_64-ubuntu1804-v2.13.4#
systemctl start mongosql.service
systemctl enable mongosql.service
tail -f /var/log/mongosqld.log
- setup ssl for mongodbsdqld
https://docs.mongodb.com/bi-connector/current/tutorial/ssl-setup/