• Start the Config Server Database Instances
for example : 
mongod --configsvr --dbpath <path> --port <port>
mongod --configsvr --dbpath /data/configdb --port 27019
 
In production deployments, you must deploy exactly three config server instances, each running on different servers
to assure good uptime and data safety. In test environments, you can run all three instances on a single server.
 
  • Start the mongos Instances
for example : 
mongos --configdb <config server hostnames>
mongos --configdb cfg0.example.net:27019,cfg1.example.net:27019,cfg2.example.net:27019
 
  • deploy replica sets for each shard
A shard can be a standalone mongod or a replica set. In a production environment, each shard should be a replica set.
for example : 
cfg = ...

rs.initiate(cfg)

rs.conf()
rs.status()
rs.add("<hostname><:port>")

  • Add Shards to the Cluster
for example : 
sh.addShard("rs1/mongodb0.example.net:27017")
 
  • Enable Sharding for a Database
for example : 
sh.enableSharding("<database>")
 
  • Enable Sharding for a Collection

for example :

sh.shardCollection("<database>.<collection>", shard-key-pattern)
sh.shardCollection("events.alerts", { "_id": "hashed" } )
 
 

Deploy a Sharded Cluster的更多相关文章

  1. 通过一步步创建sharded cluster来认识mongodb

    mongodb是目前使用非常广泛的nosql(not only sql)之一,在db engines上排名非常靠前,下图是5月份的排名: 可以看到前面四个都是传统的关系型数据库,而mongodb在no ...

  2. MongoDB分片集群-Sharded Cluster

    分片概念 分片(sharding)是一种跨多台机器分布数据的方法, MongoDB使用分片来支持具有非常大的数据集和高吞吐量操作的部署. 换句话说:分片(sharding)是指将数据拆分,将其分散存在 ...

  3. 利用Mongodb的复制集搭建高可用分片,Replica Sets + Sharding的搭建过程

    参考资料 reference:  http://mongodb.blog.51cto.com/1071559/740131  http://docs.mongodb.org/manual/tutori ...

  4. Mongodb Manual阅读笔记:MongoDB教程

    Mongodb教程的说明,可以当手册用 Getting Started Install MongoDB on Linux Systems Install MongoDB on Red Hat Ente ...

  5. 免费试用MongoDB云数据库 (MongoDB Atlas)教程

    众所周知,MongoDB包括社区版和企业版,但不止如此,MongoDB公司还有MongoDB Atlas:Database as a Service. MongoDB Atlas delivers t ...

  6. mongodb集群——配置服务器放分片meta信息,说明meta里包含了哪些数据信息

    在搭建分片之前,先了解下分片中各个角色的作用. ① 配置服务器.是一个独立的mongod进程,保存集群和分片的元数据,即各分片包含了哪些数据的信息.最先开始建立,启用日志功能.像启动普通的mongod ...

  7. Node.js 操作Mongodb

    Node.js 操作Mongodb1.简介官网英文文档  https://docs.mongodb.com/manual/  这里几乎什么都有了MongoDB is open-source docum ...

  8. [C#项目开源] MongoDB 可视化管理工具 (2011年10月-至今)

    正文 该项目从2011年10月开始开发,知道现在已经有整整5年了.MongoDB也从一开始的大红大紫到现在趋于平淡. MongoCola这个工具在一开始定位的时候只是一个Windows版本的工具,期间 ...

  9. MongoDB常用命令

    本文整理了一年多以来我常用的MongoDB操作,涉及mongo-shell.pymongo,既有运维层面也有应用层面,内容有浅有深,这也就是我从零到熟练的历程. MongoDB的使用之前也分享过一篇, ...

随机推荐

  1. CentOS6.5下安装wine

    系统信息: Centos 6.5 i386 GUN/Linux 1. 首先安装一个epel rpm -ivh http://mirrors.yun-idc.com/epel/6/i386/epel-r ...

  2. FreeBSD ipfw App配置Examples

    Step # 1: Enabling IPFW Open /etc/rc.conf file # vi /etc/rc.conf Append following settings: firewall ...

  3. x2engine

    x2engine 各版本下载 https://bitnami.com/stack/x2crm/installer https://bitnami.com/redirect/to/36211/bitna ...

  4. syslog_test.c 简单的syslog函数

    #cat syslog_test.c #include<stdio.h> #include<stdlib.h> #include<syslog.h> int mai ...

  5. Java中的XML操作

    1.DOM方式解析(读取)XML文件 待解析(读取)的XML文件,直接放在项目根目录下即可 <?xml version="1.0" encoding="UTF-8& ...

  6. hdu 5012 Dice

    Problem Description There are 2 special dices on the table. On each face of the dice, a distinct num ...

  7. Hive MapJoin

    摘要 MapJoin是Hive的一种优化操作,其适用于小表JOIN大表的场景,由于表的JOIN操作是在Map端且在内存进行的,所以其并不需要启动Reduce任务也就不需要经过shuffle阶段,从而能 ...

  8. [原创作品] Express 4.x 接收表单数据

    好久没有写博客,从现在开始,将介绍用nodejs进行web开发的介绍.欢迎加群讨论:164858883. 之前的express版本在接收表单数据时,可以统一用res.params['参数名'],但在4 ...

  9. JAVA学习第三十课(经常使用对象API)- String类:类方法练习

    intern方法 public class Main { public static void main(String[] args) { String str1 = new String(" ...

  10. [RxJS] Resubscribing to a Stream with Repeat

    When you complete a stream, there’s no way to restart it, you must resubscribe. This lesson shows ho ...