-
Notifications
You must be signed in to change notification settings - Fork 2
databases
Wenchang Liu edited this page Aug 15, 2019
·
1 revision
- currently used to manipulate graph data
- can be used to store graph data and user profiles
- To access mongoDB in python, use
client = pymongo.MongoClient(host='127.0.0.1', port=27017) wiki_db = client['WikiDB'] wiki_col = db.WikiDB MiddleSchoolMathDB = client['MiddleSchoolMathDB'] node_col = MiddleSchoolMathDB["nodes"] edge_col = MiddleSchoolMathDB["edges"]
- To move database between different servers:
- first, dump local data:
cd ~/local/mongodb/bin mongodump -h 127.0.0.1 -d "database_name (MiddleSchoolMathDB)" -o "path to store dumped files (/home/vcp/local/mongodb/dump/)"
- restore to the target server:
- bind ip address to target server (and change dbpath if needed):
mongod --bind_ip localhost,"origin server ip (10.110.165.244)" --dbpath="path to store data (./shard1)" --fork --logpath=./shard1/log.log
- restore:
mongorestore -h 10.110.165.244:27017 -d MiddleSchoolMathDB /home/vcp/local/mongodb/dump/MiddleSchoolMathDB/
- bind ip address to target server (and change dbpath if needed):
- first, dump local data: