over 3 years ago

write concern

  • w option : to specify the required number of acknowledgments before returning
  • j option : to require writes to the journal before returning
  • wtimeout option : to specify a time limit to prevent write operations from blocking indefinitely.
  • w:0, j:0
  • w:1, j:0
  • w:1, j:1

Mongo driver website

api.mongodb.org

replica set

  • the minimum original number of nodes needed to assure the election of a new Primary is : 3
  • rs.help() : 顯示 replica set 的說明文件
  • rs.status() : 顯示 replica set 的狀態

connection using on PyMongo

using pymongo.MongoClient() to connect to a standalone server
using pymongo.MongoReplicaSetClient() to connect to a replica set

看 sharding 資料 (Cluster Configuration)

  • > db.printShardingStatus()
  • > sh.status()

列出有 sharding enable 的 database

use config
db.databases.find( { "partitioned": true } )

有關 sharding 的資料

  • mongos : 有使用 sharding 的環境,mongo shell & app 透過 mongos 來連結 mongo DB
  • mongos for “MongoDB Shard,” is a routing service for MongoDB shard configurations that processes queries from the application layer
← python 一些語法記錄 vim tutorial on 2014-12-22 →