Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6977957
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:41:36+00:00 2026-05-27T17:41:36+00:00

Newbie using mongo 2.0.1 32-bit on windows tried testing out shards as follows: (4)

  • 0

Newbie using mongo 2.0.1 32-bit on windows tried testing out shards as follows:

(4) processes: 2 shards + config srver + mongos w tiny chunksize

mongod.exe --shardsvr  --port 10001  --dbpath <folder1>       > shard1.log
mongod.exe --shardsvr  --port 10002  --dbpath <folder2>       > shard2.log
mongod.exe --configsvr --port 20000  --dbpath <configfolder>  > config.log
mongos.exe --configdb localhost:20000 --chunkSize 1           > mongos.log

I ran the shell and set up 2 shards:

mongos> use admin
switched to dbadmin

mongos> db.runCommand( { addshard : "localhost:10001" } );
{ "shardAdded" : "shard0000", "ok" : 1 }

mongos> db.runCommand( { addshard : "localhost:10002" } );
{ "shardAdded" : "shard0001", "ok" : 1 }

Then I enabled sharding for a test database (dbTest) and collection (cTest):

mongos> db.runCommand( { enablesharding  : "dbTest" } );
{ "ok" : 1 }

mongos> db.runCommand( { shardcollection : "dbTest.cTest", key : { Name : 1 } } );
{ "collectionssharded" : "dbTest.cTest", "ok" : 1 }

Finally I populated the cTest collection (indexed by Name) with 1,000,005 sample records:

mongos> use dbTest
switched to db dbTest

db.cTest.drop();
db.cTest.ensureIndex({ Name : 1 });
db.cTest.save({Name: "Frank", Age:56, Job: "Accountant", State: "NY"});
db.cTest.save({Name: "Bill" , Age:23,                    State: "CA"});
db.cTest.save({Name: "Janet", Age:34, Job: "Dancer"                 });
db.cTest.save({Name: "Andy",  Age:44                                });
db.cTest.save({Name: "Zach",  Age:23, Job: "Fireman",    State: "CA"});
i=1;
while(i<=1000) 
{ 
  j=1;
  while (j<=1000) 
  { 
    db.cTest.save({Name:"Person("+i+","+j+")", Age:i+j}); 
    j = j+1
  }; 
  i=i+1; 
};

HOWEVER …

It appears that nothing actually got sharded. In the config database, db.chunks.count() is zero, and I can see from windows explorer file sizes that all the data went into the physical file setup setup for the first shard, and none to the second.

Can anyone spot what I’ve done wrong, and also provide some tips on how to admin & debug this type of thing & see what’s going on ?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:41:37+00:00Added an answer on May 27, 2026 at 5:41 pm

    Once you “shardcollection”, don’t drop it. It will remove metadata about sharded collection.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a newbie using Ninject and I can't figure out how to inject into
I'm using Mercurial and am a bit of a newbie. I just committed a
[unit testing newbie] [c#] Consider the following scenario: I'm using Silverlight and calling a
Being a newbie to using matplotlib ,I was trying out some code ,from examples
Im newbie to integrate Flash,php and mysql using xamp. I tried alot to rectify
I am (newbie) using Kohana V 3.0.3 and my directory structure is: pojectsys (kohana's
I am newbie at using DataSet. I am writing a program with VB.NET, there
I am quite a newbie in OOP using java and I'm learning as I
I am a newbie java dev using netbeans IDE 7.1.1 and im watching this
Newbie question since I'm not up to speed using maven at all. I'm trying

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.