zoukankan      html  css  js  c++  java
  • 快速搭建MongoDB分布式集群

    目录

    1. Prerequisites

    Suppose:
    (1) you have deploy a functioning network to install mongodb cluster.
    (2) you have gained the latest releases of MongoDB from 10gen.
    (3) you have installed mongodb in the path $MongoHome.
    (4) there are three folders, that are bin,dbs,logs, in $MongoHome folder.
    (5) there are four servers here to make four shards in the cluster.
    (6) their IP4 addresses are:
        +pc3:192.168.0.104
        +pc2:192.168.0.103
        +pc1:192.168.0.102
        host:192.168.0.100

    2. Steps to follow

    #1 biuld up mongod instance on every node.
        using the following CMD in Terminal on every shard marchine:
        -bash bash-install-shard...files.

    bash-install-shard

    #2 set up mongod instance of config server
        using the following CMD in Terminal on every config server marchine:
        -bash bash-install-config

    bash-install-config

    #3 initiate every replica set
        ssh every shard server, run mongo to login its local mongod instance,
        then write a config file for the relica set, and run rs.initate(config).
        see "shard initialize"file for more information.

    shard-initialize

    #4 start mongos server
        using the following CMD in Terminal on every mongos server marchine:
        -bash bash-install-mongos

    bash-install-mongos

    #5 add shards to the cluster
        login one of the mongos, use sh.addShard("shard1/192.168.0.100:27020") CMD to add every shard.
        see "Add shards to the cluster" file for more information.

    Add-shards-to-the-cluster

    Up to now a distributed MongoDB cluster with replica set has established, and its architecture may go like this:

    mongodb集群架构图

    3. Configuring your cluster to make it sharded

  • 相关阅读:
    MySQL常用函数大全讲解
    mysql 获取最近一个月每一天
    Mysql查询某个月的每一天的数据
    Mysql 查询一天中,每个小时数据的数量
    oracle 和 mysql 遍历当前月份每一天
    sql查询总结
    Qt样式表——选择器详解(父子关系,插图详细解释)
    Qt样式表之盒子模型(以QSS来讲解,而不是CSS)
    程序员晋升必备技能——单元测试框架(小豆君的干货铺)
    为什么川普反对中国补贴农业(渐进式发展是非常正确的,如果贸然改动农村土地制度,在城市还不能提供足够的就业岗位下将大量的农民推向城市……请欣赏一下巴西、印度城市的贫民窟)
  • 原文地址:https://www.cnblogs.com/geosky/p/3248076.html
Copyright © 2011-2022 走看看