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.

  • 相关阅读:
    日期正则表达式yyyyMMdd
    Markdown语法
    su: Authentication failure问题
    Git初始配置
    layui的layer.open()方法查看缩略图 原图缩放
    入驻博客园三年
    php学习笔记之动态生成一组单选button
    opencv直方图拉伸
    c++ 中const的使用
    LeetCode131:Palindrome Partitioning
  • 原文地址:https://www.cnblogs.com/myibm/p/5939320.html
Copyright © 2011-2022 走看看