Question

I have installed MongoDB using http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/ in my Ubuntu machine and the mongo instance is working fine.

I am able to do CRUD operations in the instance. I also installed the MonjaDB eclipse plugin and am able to see all databases/collections/documents in it.

Now, I want to create a sharded cluster in my machine. I am trying to create this way:

cluster = new ShardingTest({"shards" : 3, "chunksize" : 1})

It is giving the following error: Resetting db path '/data/db/test0' Wed Feb 12 15:46:43 Error: boost::filesystem::create_directory: Permission denied: "/data/db/test0" (anon):1

Also, I tried to create shards for existing collection. For this, first I tried to enable sharding in my database ("test")

sh.enableSharding("test") Wed Feb 12 15:48:14 uncaught exception: not connected to a mongos

Can someone please let me know, what might went wrong.

Thanks in advance,

Raghu

Was it helpful?

Solution

I can suggest that you follow the documentation from the MongoDB site to deploy your sharded cluster for the first time:

http://docs.mongodb.org/manual/tutorial/deploy-shard-cluster/

If you then wish to work through another product to aid in this then you can be more aware of what actually needs to be done and what is not happening.

OTHER TIPS

Try starting mongo shell with root user:

$ sudo mongo --nodb

and then in mongo shell:

> cluster = new ShardingTest({"shards" : 3, "chunksize" : 1})

If your problem persists check permissions and ownership for the directory "/data/db/". See mongodb Mongod complains that there is no /data/db folder answer.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top