zoukankan      html  css  js  c++  java
  • MongoDB分布式

    结构:
    ShardServer1:27020
    ShardServer2:27021
    ShardServer3:27022
    ShardServer4:27023
    ConfigServer:27100
    RouteProcess:40000
    --设置shard服务器
    mongod --port 27020--dbpath "D:/MongoDB/Data/shard/s0" --logpath "D:/MongoDB/Data/shard/log/s0.log" --logappend --fork
    mongod --port 27021--dbpath "D:/MongoDB/Data/shard/s1" --logpath "D:/MongoDB/Data/shard/log/s1.log" --logappend --fork
    mongod --port 27022--dbpath "D:/MongoDB/Data/shard/s2" --logpath "D:/MongoDB/Data/shard/log/s2.log" --logappend --fork
    mongod --port 27023--dbpath "D:/MongoDB/Data/shard/s3" --logpath "D:/MongoDB/Data/shard/log/s3.log" --logappend --fork
    --config服务器
    mongod --port 27100--dbpath "D:/MongoDB/Data/shard/config" --logpath "D:/MongoDB/Data/shard/log/config.log" --logappend --fork
    ---Route
    mongos --port 40000--configdb localhost:27100--fork --logpath "D:/MongoDB/Data/shard/log/route.log" --chunkSize 500 
    --登录
    mongo admin --port 40000
    ---添加分片
    db.runCommand({ addshard:"localhost:27020"})
    db.runCommand({ addshard:"localhost:27021"})
    db.runCommand({ addshard:"localhost:27022"})
    db.runCommand({ addshard:"localhost:27023"})
    ---#设置分片存储的数据库
    db.runCommand({ enablesharding:"test"})
    db.runCommand({ shardcollection:"test.log", key:{ id:1,time:1}})
  • 相关阅读:
    软件工程课堂作业——计算最优惠价格
    团队项目——NABC
    二位数组
    第二次冲刺阶段 站立会议06
    第二阶段冲刺 站立会议05
    第二阶段冲刺 站立会议04
    第二阶段冲刺 站立会议03
    课程建议
    站立会议02
    第二阶段冲刺 站立会议01
  • 原文地址:https://www.cnblogs.com/Wcode/p/6484253.html
Copyright © 2011-2022 走看看