AWS EC2 (Ubuntu) 몽고디비 설치 관련
2018. 10. 17. 20:56ㆍ서버 프로그래밍
우분투에서 몽고디비 설치
ubuntu@ibks-ifp-dev-com ~$ sudo apt-get install mongodb-server mongodb-clients
ubuntu@ibks-ifp-dev-com ~$ mongod --version db version v2.6.10 2017-11-06T11:18:46.890+0900 git version: nogitversion 2017-11-06T11:18:46.890+0900 OpenSSL version: OpenSSL 1.0.2g 1 Mar 2016 ubuntu@ibks-ifp-dev-com ~$ mongo --version MongoDB shell version: 2.6.10
http://devstory.ibksplatform.com/2017/11/linux-ubuntu-mongo-db.html
우분투에서 몽고디비 실행 및 중지
구동
sudo systemctl start mongodb
상태 확인
sudo systemctl status mongodb
정지
sudo systemctl stop mongodb
부팅 시 실행
sudo systemctl enable mongodb
우분투에서 몽고디비 제거
sudo apt-get remove mongodb-server mongodb-clients
sudo rm -r /var/log/mongodb
sudo rm -r /var/lib/mongodb
http://blog.naver.com/PostView.nhn?blogId=dkssud2623&logNo=220562078431
몽고디비 사용자 관리
Python 몽고디비 연동
http://api.mongodb.com/python/current/api/pymongo/mongo_client.html
How to connect to your remote MongoDB server
https://ianlondon.github.io/blog/mongodb-auth/
import pymongo
client = pymongo.MongoClient("mongodb://ian:secretPassword@123.45.67.89/cool_db") # defaults to port 27017
db = client.cool_db
# print the number of documents in a collection
print db.cool_collection.count()