zoukankan      html  css  js  c++  java
  • windows下的mongodb分片配置

    1. 分片服务器设置
    mongod -port 10001 -dbpath=F:/DbSoft/mongodb/rs_data/master -directoryperdb --shardsvr -replSet retA --rest --oplogSize 64
    mongod -port 10002 -dbpath=F:/DbSoft/mongodb/rs_data/slaver -directoryperdb --shardsvr -replSet retA --rest --oplogSize 64
    mongod -port 10003 -dbpath=F:/DbSoft/mongodb/rs_data/arbiter -directoryperdb --shardsvr -replSet retA --rest --oplogSize 64

    2. 初始化
    D:/mongodb-win32-i386-1.8.0/bin>call mongo.exe 127.0.0.1:10000/admin
    MongoDB shell version: 1.8.0
    connecting to: 127.0.0.1:10000/admin
    > config={_id:"retA",members:[{"_id": 0,host:"127.0.0.1:10001"},{"_id":1,host:"127.0.0.1:10002"},{"_id":2,host:"127.0.0.1:10003"}]}

    {"_id":"setA","members":[{"_id":0,"host":"127.0.0.1:10000"},{"_id":1,"host":"127.0.0.1:10001"},{"_id":2,"host": "127.0.0.1:10002"}]}
    setA> rs.initiate(config);

    3. 配置服务器设置
    mongod -configsvr -port 20001 -dbpath=F:/DbSoft/mongodb/rs_data/set1

    4. 路由服务器设置
    mongos --configdb 127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003 --port 27017

    5. 设置分片
    >mongo 127.0.0.1:30001/admin
    > db.runCommand({addshard:"setA/127.0.0.1:10001,127.0.0.1:10002,127.0.0.1:10003",name:"ShardSetA"})

    6.如果需要设置多个分片
    重复步骤1~5.

  • 相关阅读:
    HDU 2116 Has the sum exceeded
    HDU 1233 还是畅通工程
    HDU 1234 开门人和关门人
    HDU 1283 最简单的计算机
    HDU 2552 三足鼎立
    HDU 1202 The calculation of GPA
    HDU 1248 寒冰王座
    HDU 1863 畅通工程
    HDU 1879 继续畅通工程
    颜色对话框CColorDialog,字体对话框CFontDialog使用实例
  • 原文地址:https://www.cnblogs.com/myibm/p/5939320.html
Copyright © 2011-2022 走看看