On Friday, November 16, 2012 8:33:24 PM UTC, jean carlo wrote:
> I really appreciated your help Gregor :), this is a real option, the
> problem is in olddb we have sharded collections. So I don't want loss this
> data when I use moveprimary function, we have 3 shards.
> If I choice this solution. Mongos could know where is each collections ?
> Suppose I have about 6 collections without sharding. And I want to spread
> out this collection throw each shards. At the end, mongos might know where
> is each collection?
> fortunately theses collections aren't so big
> On Fri, Nov 16, 2012 at 3:50 PM, gregor <gre...@10gen.com <javascript:>>wrote:
>> actually you can do this on a big collection too it will just take longer
>> :)
>> On Friday, November 16, 2012 8:19:41 PM UTC, gregor wrote:
>>> If it's not a big collection and it's called "smallcol" and is in db
>>> "olddb" you could
>>> mongodump --db olddb --collection smallcol
>>> http://docs.mongodb.org/**manual/reference/mongodump/#**
>>> cmdoption-mongodump--**collection<http://docs.mongodb.org/manual/reference/mongodump/#cmdoption-mongodu...>
>>> and then create a db with a different primary shard (use moveprimary to
>>> control that) (say "newdb" and do a
>>> monogorestore --db newdb --collection smallcol dump/
>>> http://docs.mongodb.org/**manual/reference/mongorestore/**
>>> #cmdoption-mongorestore--db<http://docs.mongodb.org/manual/reference/mongorestore/#cmdoption-mong...>
>>> make sure and do the dump and restore through mongos. then you can do a
>>> On Friday, November 16, 2012 8:02:53 PM UTC, jean carlo wrote:
>>>> Uhmmm the problem with cloneCollection is that you have to run in the
>>>> server (or replica) where you want to store the collection, so, I should
>>>> run this command from a primary replica of one no-primary shard, and not
>>>> over mongos, right?.
>>>> What I did was,
>>>> I've created a collection over test database throw mongos. this
>>>> collection was stored in primary shard, that's ok.
>>>> So I connect to another primary replica of other shard which is not
>>>> primary shard, and I ran this command.
>>>> testset3:PRIMARY> db.runCommand({**cloneCollection:"test.users",**
>>>> from:"primary.replica.primary.**shard:10000",query:{},**
>>>> copyIndexes:false})
>>>> { "ok" : 1 }
>>>> It cloned all the users collection in the shar3. Then when I did an
>>>> explain in mongos this is what happened
>>>> mongos> db.users.find().explain()
>>>> {
>>>> "cursor" : "BasicCursor",
>>>> "isMultiKey" : false,
>>>> "n" : 1,
>>>> "nscannedObjects" : 1,
>>>> "nscanned" : 1,
>>>> "nscannedObjectsAllPlans" : 1,
>>>> "nscannedAllPlans" : 1,
>>>> "scanAndOrder" : false,
>>>> "indexOnly" : false,
>>>> "nYields" : 0,
>>>> "nChunkSkips" : 0,
>>>> "millis" : 0,
>>>> "indexBounds" : {
>>>> },
>>>> "server" : "chewbacca:10000",
>>>> "millis" : 0
>>>> }
>>>> It still search the collection in primary shard, and if I remove this
>>>> collections, mongos does not know that this collection is in another shard.
>>>> Is there a way to tell a mongos that this collections is in another
>>>> shard which is not the primary shard without change the primary shard??
>>>> On Fri, Nov 16, 2012 at 1:58 PM, gregor <gre...@10gen.com> wrote:
>>>>> My bad you are right. If you do a cloneCollection "data" from database
>>>>> "a" with primary shard "shard1" to database "b" with primary shard "shard2"
>>>>> then b.data.find() returns nothing? Are you calling cloneCollection from
>>>>> mongos? What does b.data.find().explain(0 reutrn?
>>>>> On Friday, November 16, 2012 5:39:04 PM UTC, jean carlo wrote:
>>>>>> Thank you very much for you reply gregor.
>>>>>> About movePrimary, I've read the documentation and it seem to need a
>>>>>> empty shard to do the movePrimary
>>>>>> *
>>>>>> Important
>>>>>> Only use movePrimary<http://docs.mongodb.org/manual/reference/commands/#movePrimary>
>>>>>> when:
>>>>>> *
>>>>>> - *the database does not contain any collections with data, or*
>>>>>> - *you have drained all sharded collections using the removeShard<http://docs.mongodb.org/manual/reference/commands/#removeShard>
>>>>>> command.*
>>>>>> *See Remove Shards from an Existing Sharded Cluster<http://docs.mongodb.org/manual/tutorial/remove-shards-from-cluster/> for
>>>>>> a complete procedure.*
>>>>>> because all my shards has data and this is a production cluster.
>>>>>> I'm rigtht?
>>>>>> On Fri, Nov 16, 2012 at 12:46 PM, gregor <gre...@10gen.com> wrote:
>>>>>>> If you have sharded a database all unsharded collections in that
>>>>>>> shard are help on the primary shard
>>>>>>> http://docs.mongodb.org/**manual**/reference/glossary/#**term-**
>>>>>>> primary-shard<http://docs.mongodb.org/manual/reference/glossary/#term-primary-shard>
>>>>>>> You can move the primary shard with this command.
>>>>>>> http://docs.mongodb.org/**manual**/reference/command/**movePrimary**
>>>>>>> / <http://docs.mongodb.org/manual/reference/command/movePrimary/>
>>>>>>> All unsharded collections will move to the new primary. The only way
>>>>>>> to have unsharded collections on different shards is to have them in
>>>>>>> different databases with different primary shards.
>>>>>>> On Friday, November 16, 2012 5:05:50 PM UTC, jean carlo wrote:
>>>>>>>> Hi guys, I have 3 shards and each has a replica of three machines.
>>>>>>>> When I have created a collection not sharded throw mongos, this
>>>>>>>> collections is stored in the first shard1 ( I do not why) and the others
>>>>>>>> not sharded collection too.
>>>>>>>> So this is a problem, beacause my cluster has a lot of traffic over
>>>>>>>> this collections not sharded and we have a whole cluster where only one
>>>>>>>> machine ( the primary replica of the shar1) get all the traffic.
>>>>>>>> How can I move this collections to another replica, or shard?. And
>>>>>>>> how can I set the mongos to know where is this collection which has been
>>>>>>>> moved?
>>>>>>>> I do a cloneCollection from a primary replica (shard1) to another
>>>>>>>> primary replica(shar2) and thas works but when I do a insert throw mongos,
>>>>>>>> it still insert over the collection in shar1 and does not over the shar2.
>>>>>>>> --
>>>>>>>> Este mensaje y sus adjuntos se dirigen exclusivamente a su
>>>>>>>> destinatario, puede contener información privilegiada o confidencial y es
>>>>>>>> para uso exclusivo de la persona o entidad de destino. Si no es usted. el
>>>>>>>> destinatario indicado, queda notificado de que la lectura, utilización,
>>>>>>>> divulgación y/o copia sin autorización puede estar prohibida en virtud de
>>>>>>>> la legislación vigente. Si ha recibido este mensaje por error, le rogamos
>>>>>>>> que nos lo comunique inmediatamente por esta misma vía y proceda a su
>>>>>>>> destrucción.
>>>>>>>> The information contained in this transmission is privileged and
>>>>>>>> confidential information intended only for the use of the
>>>>>>>> individual or entity named above. If the reader of this message is not the
>>>>>>>> intended recipient, you are hereby notified that any dissemination,
>>>>>>>> distribution or copying of this communication is strictly prohibited. If
>>>>>>>> you have received this transmission in error, do not read it. Please
>>>>>>>> immediately reply to the sender that you have received this communication
>>>>>>>> in error and then delete it.
>>>>>>> --
>>>>>>> You received this message because you are subscribed to the Google
>>>>>>> Groups "mongodb-user" group.
>>>>>>> To post to this group, send email to mongod...@googlegroups.com
>>>>>>> To unsubscribe from this group, send email to
>>>>>>> mongodb-user...@**googlegroups.**com
>>>>>>> See also the IRC channel -- freenode.net#mongodb
>>>>>> --
>>>>>> Saludos
>>>>>> Jean Carlo Rivera
>>>>>> +584164281538
>>>>>> -------
>>>>>> --
>>>>>> Este mensaje y sus adjuntos se dirigen exclusivamente a su
>>>>>> destinatario, puede contener información privilegiada o confidencial y es
>>>>>> para uso exclusivo de la persona o entidad de destino. Si no es usted. el
>>>>>> destinatario indicado, queda notificado de que la lectura, utilización,
>>>>>> divulgación y/o copia sin autorización puede estar prohibida en virtud de
>>>>>> la legislación vigente. Si ha recibido este mensaje por error, le rogamos
>>>>>> que nos lo comunique inmediatamente por esta misma vía y proceda a su
>>>>>> destrucción.
>>>>>> The information contained in this transmission is privileged and
>>>>>> confidential information intended only for the use of the individual
>>>>>> or entity named above. If the reader of this message is not the intended
>>>>>> recipient, you are hereby notified that any dissemination, distribution or
>>>>>> copying of this communication is strictly prohibited. If you have received
>>>>>> this transmission in error, do not read it. Please immediately reply to the
>>>>>> sender that you have received this communication in error and then delete
>>>>>> it.
>>>>> --
>>>>> You received this message because you are subscribed to the Google
>>>>> Groups "mongodb-user" group.
>>>>> To post to this group, send email to mongod...@googlegroups.com
>>>>> To unsubscribe from this group, send email to
>>>>> mongodb-user...@googlegroups.**com
>>>>> See also the IRC channel -- freenode.net#mongodb
>>>> --
>>>> Saludos
>>>> Jean Carlo Rivera
>>>> +584164281538
>>>> -------
>>>> --
>>>> Este mensaje y sus adjuntos se dirigen exclusivamente a su
>>>> destinatario, puede contener información privilegiada o confidencial y es
>>>> para uso exclusivo de la persona o entidad de destino. Si no es usted. el
>>>> destinatario indicado, queda notificado de que la lectura, utilización,
>>>> divulgación y/o copia sin autorización puede estar prohibida en virtud de
>>>> la legislación vigente. Si ha recibido este mensaje por error, le rogamos
>>>> que nos lo comunique inmediatamente por esta misma vía y proceda a su
>>>> destrucción.
>>>> The information contained in this transmission is privileged and
>>>> confidential information intended only for the use of the individual
>>>> or entity named above. If the reader of this message is not the intended
>>>> recipient, you are hereby notified that any dissemination, distribution or
>>>> copying of this communication is strictly prohibited. If you have received
>>>> this transmission in error, do not read it. Please immediately reply to the
>>>> sender that you have received this communication in error and then delete
>>>> it.
>>> --
>> You received this message because you are subscribed to the Google
>> Groups "mongodb-user" group.
>> To post to this group, send email to mongod...@googlegroups.com<javascript:>
>> To unsubscribe from this group, send email to
>> mongodb-user...@googlegroups.com <javascript:>
>> See also the IRC channel -- freenode.net#mongodb
> --
> Saludos
> Jean Carlo Rivera
> +584164281538
> -------
> --
> Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario,
> puede contener información privilegiada o confidencial y es para uso
> exclusivo de la persona o entidad de destino. Si no es usted. el
> destinatario indicado, queda notificado de que la lectura, utilización,
> divulgación y/o copia sin autorización puede estar prohibida en virtud de
> la legislación vigente. Si ha recibido este mensaje por error, le rogamos
> que nos lo comunique inmediatamente por esta misma vía y proceda a su
> destrucción.
> The information contained in this transmission is privileged and
> confidential information intended only for the use of the individual or
> entity named above. If the reader of this message is not the intended
> recipient, you are hereby notified that any dissemination, distribution or
> copying of this communication is strictly prohibited. If you have received
> this transmission in error, do not read it. Please immediately reply to the
> sender that you have received this communication in error and then delete
> it.