• MongoDB 分片


    mongod --port 32770 --shardsvr --dbpath "D:dbmongodatashardmongodb1" --logpath "D:dbmongodatashardmongodb1.log"  --serviceName "mongodb1" --serviceDisplayName "mongodb1" --install
    mongod --port 32771 --shardsvr --dbpath "D:dbmongodatashardmongodb2" --logpath "D:dbmongodatashardmongodb2.log"  --serviceName "mongodb2" --serviceDisplayName "mongodb2" --install
    
    mongod --port 26010 --configsvr --replSet cs --dbpath "D:dbmongodatashardmongodbConfig" --logpath "D:dbmongodatashardmongodbConfig.log"  --serviceName "mongodbConfig" --serviceDisplayName "mongodbConfig" --install
    mongod --port 26011 --configsvr --replSet cs --dbpath "D:dbmongodatashardmongodbConfig1" --logpath "D:dbmongodatashardmongodbConfig1.log"  --serviceName "mongodbConfig1" --serviceDisplayName "mongodbConfig1" --install
    
    mongo 127.0.0.1:26010
    cfg = {  
        _id:'cs',  
        configsvr:true,  
        members:[  
            {_id:0,host:'127.0.0.1:26010'}  
         ]  
    };  
      
    rs.initiate(cfg); 
    rs.add({_id:1,host:'127.0.0.1:26011'})  
    
    mongos --port 8001 --configdb cs/127.0.0.1:26010,127.0.0.1:26011 --logpath "D:dbmongodatashardmongos.log"  --serviceName "mongos-a" --serviceDisplayName "mongos-a" --install
    mongo 127.0.0.1:8001  
    sh.addShard('127.0.0.1:32770')  
    sh.addShard('127.0.0.1:32771')  
    sh.status()  
    sh.enableSharding('aedata')  
    sh.shardCollection('aedata.ac01_test',{'id':1,'idcard':1})  
    use aedata  
    db.createUser({user:'aedata', pwd:'111111',roles:[{role:'readWrite',db:'aedata'}]})  
    use aedata  
    for(var i=10000; i<=20000; i++){ db.ac01_test.save({id:i,idcard:"card"+i}); }  
    db.ac01_test.count()  
    db.ac01_test.stats()  
  • 相关阅读:
    TCP报文发送工具
    Java基础—注解的使用
    STM32以太网ETH
    EC20 minipcie版4g模块开发笔记
    usb端点(endpoint)知识详解
    STM32 usb_mem.c和usb_sil.c文件的分析
    USB的中断说明
    STM32 可编程电压监测器(PVD)实现数据掉电保存
    关于FSMC地址线的理解
    STM32F4—fsmc的配置步骤
  • 原文地址:https://www.cnblogs.com/chenyishi/p/9118439.html
走看看 - 开发者的网上家园