Conversion to capped collection - Taking more time to be converted.

224 views
Skip to first unread message

kumar

unread,
May 10, 2012, 1:07:52 PM5/10/12
to mongodb-user

Hi All,

I prepare a replica set. In our mongo database, one collection is
available that has around 39GB storage space.

I executed "convertToCapped" command at primary node to covert that
collection as capped one of 3.61GB size.

That command has taken more than 28 hours. Still, it is getting
executed. Primary node is taking around 100% CPU spike due to that
command.

Is there anyway to convert to capped collection with in less execution
time?

Thanks,
Kumar








Scott Hernandez

unread,
May 10, 2012, 1:50:51 PM5/10/12
to mongod...@googlegroups.com
The command has to allocate and then copy all of the documents so you
are probably just seeing that behavior.

Is the disk very active also?
> --
> 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.
> For more options, visit this group at http://groups.google.com/group/mongodb-user?hl=en.
>

kumar

unread,
May 11, 2012, 12:22:50 AM5/11/12
to mongodb-user

Hi Scott,

Thanks for reply. Yes, Disk is very active.

That collection has around 220 million documents. I want to maintain
20 million documents after conversion to capped one.

Is it better to use "remove" command to remove remaining documents and
then using "convertToCapped" command?

I am worrying about replication errors (RS102 stale error) at
secondary node when we use remove command to remove lot of documents
at primary node.

-Kumar



On May 10, 10:50 pm, Scott Hernandez <scotthernan...@gmail.com> wrote:
> The command has to allocate and then copy all of the documents so you
> are probably just seeing that behavior.
>
> Is the disk very active also?
>
>
>
>
>
>
>
> On Thu, May 10, 2012 at 10:07 AM, kumar <kumar.a...@gmail.com> wrote:
>
> > Hi All,
>
> > I prepare a replica set.  In our mongo database, onecollectionis
> > available that has around 39GB storage space.
>
> > I executed "convertToCapped" command at primary node to covert that
> >collectionascappedone of  3.61GB size.
>
> > That command has takenmorethan 28 hours. Still, it is getting
> > executed.  Primary node istakingaround 100% CPU spike due to that
> > command.
>
> > Is there anyway to convert tocappedcollectionwith in less execution

kumar

unread,
May 11, 2012, 2:29:04 PM5/11/12
to mongodb-user


Conversion to capped collection was not happened. But, I am not able
to access primary node.

When I have used "mongo" command, I am getting below error:

MongoDB shell version: 2.0.4
connecting to: localhost:17017/test
Socket recv() errno:104 Connection reset by peer 127.0.0.1:17017
SocketException: remote: 127.0.0.1:17017 error: 9001 socket exception
[1] server [127.0.0.1:17017]
DBClientCursor::init call() failed
Error: Error during mongo startup. :: caused by ::
DBClientBase::findN: transport error: localhost:17017 query:
{ whatsmyuri: 1 } shell/mongo.js:86
exception: connect failed

What might be the reason to get above error?

Thanks,
Kumar









On May 11, 9:22 am, kumar <kumar.a...@gmail.com> wrote:
> Hi Scott,
>
> Thanks for reply.  Yes, Disk is very active.
>
> Thatcollectionhas around 220 million documents. I want to maintain

Scott Hernandez

unread,
May 11, 2012, 2:45:03 PM5/11/12
to mongod...@googlegroups.com
It is probably better to create a new capped collection and insert
your 20 million docs in there you want to keep. It will keep the churn
down. Then you can rename the collection if you need to.
Reply all
Reply to author
Forward
0 new messages