Reputation: 141
I am new to mongo-db,I tried to configure sharding by following the procedure in the mongo-db web-site..But i am getting some errors...... I will describe the steps which i have followed for configure sharding......I have tried sharding in windows-os......
Step 1:
*)In first machine i created two folders namely in the following path c:/data/db/a ;c:/data/db/config
*)Now i opened the command prompt and i used following command to configure shard-server.......
C:/Program Files/mongodb-win32-i386-1.6.2/bin/mongod --shardsvr --dbpath c:/data/db/a --port 10000
Step 2:
*)In second machine i created two folders namely in the following path c:/data/db/b ;c:/data/db/config
*)Again i opened the command prompt and i used following command to configure shard-server.......
*)Now i opened the command prompt and i used following command to configure shard-server.......
C:/Program Files/mongodb-win32-i386-1.6.2/bin/mongod --shardsvr --dbpath c:/data/db/a --port 10001
Step 3:
*)In first machine i opened the command prompt and i used following command to configure config-server....
C:/Program Files/mongodb-win32-i386-1.6.2/bin/mongod --configsvr --dbpath c:/data/db/config --port 20000
Step 4:
*)In second machine i opened the command prompt and i used following command to configure config-server....
C:/Program Files/mongodb-win32-i386-1.6.2/bin/ mongod --configsvr --dbpath c:/data/db/config --port 20001
Step 5:
*)I first machine i opened the command prompt and i used following command to configure mongos-server for first machine........
C:/Program Files/mongodb-win32-i386-1.6.2/bin/ mongos --configdb first-machine-ip:20000
*)Again i opened another command prompt and i used following command to configure mongos-server for second machine........
C:/Program Files/mongodb-win32-i386-1.6.2/bin/ mongos --configdb Second-machine-ip:20001
Step 6:
*)Now i run the mongo process as follows..
C:/Program Files/mongodb-win32-i386-1.6.2/bin/ mongo.exe first-machine-ip:27017/admin
Step 7:
*)To add & enable sharding i had followed the steps below.......
> use admin
switched to db admin
> db.runCommand( { addshard : "10.0.0.137:10000" } )
{ "shardAdded" : "shard0000", "ok" : 1 }
> db.runCommand( { addshard : "10.0.0.180:10001" } )
{ "shardAdded" : "shard0001", "ok" : 1 }
> db.runCommand( { enablesharding : "test" } )
{ "ok" : 1 }
> db.runCommand( { shardcollection : "test.block_seek_pos", key : {file_GUID : 1} } )
{ "collectionsharded" : "test.people", "ok" : 1 }
Step 8:
*)Now i had configured one ordinary backup.
*)Once the backup completed i checked all the command prompt prints......
*)I got the error as follows......in the mongos process terminal....
>>mongos db version v1.6.2, pdfile version 4.5 starting (--help for usage)
>>git version: aef371ecf5d2a824f16ccdc3b745f3702165602f
>>sys info: windows (5, 1, 2600, 2, 'Service Pack 3') BOOST_LIB_VERSION=1_35
>>waiting for connections on port 27017
>>[websvr] web admin interface listening on port 28017
>>couldn't find database [sgserver] in config db
>>can't find a shard to put new db on
>>DBException in process: can't find a shard to put new db on
>>couldn't find database [sgserver] in config db
>>can't find a shard to put new db on
>>DBException in process: can't find a shard to put new db on
>>couldn't find database [sgserver] in config db
>>can't find a shard to put new db on
>>DBException in process: can't find a shard to put new db on
>>going to add shard: { _id: "shard0000", host: "first-machine-ip:10000" }
>>going to add shard: { _id: "shard0001", host: "second-machine-ip:10001" }
>>couldn't find database [test] in config db
>>put [test] on: shard0000:first-machine-ip:10000
>>enabling sharding on: test
>>CMD: shardcollection: { shardcollection: "test.people", key: { file_GUID: 1.0 } }
>>enable sharding on: test.people with shard key: { file_GUID: 1.0 }
>>no chunks for:test.people so creating first: ns:test.people at: shard0000:first-machine->>ip:10000 lastmod: 1|0 min: { file_GUID: MinKey } max: { file_GUID: MaxKey }
>>couldn't find database [sgserver] in config db
>>put [sgserver] on: shard0001:second-machine-ip:10001
>>creating WriteBackListener for: first-machine-ip:10000
>>creating WriteBackListener for: second-machine-ip:10001
Anyone can help me out with this sharding.......I am awaiting for ur reply........
Advance Thanks, Sampath Kumar...
Upvotes: 3
Views: 4430
Reputation: 45307
I think that you're misunderstanding how mongos (the router) works:
*)I first machine i opened the command prompt and i used following command to configure mongos-server for first machine........ C:/Program Files/mongodb-win32-i386-1.6.2/bin/ mongos --configdb first-machine-ip:20000
This does not "configure" anything. The sharding commands need to be run from mongos
.
The following lines makes no sense because you haven't started a process on that port:
C:/Program Files/mongodb-win32-i386-1.6.2/bin/ mongo.exe first-machine-ip:27017/admin
Upvotes: 2