Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Message from discussion MapReduce on SECONDARY in a ReplicaSet
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Stephen Steneker  
View profile  
 More options Sep 30 2012, 9:34 pm
From: Stephen Steneker <stephen.stene...@10gen.com>
Date: Sun, 30 Sep 2012 18:34:10 -0700 (PDT)
Local: Sun, Sep 30 2012 9:34 pm
Subject: Re: MapReduce on SECONDARY in a ReplicaSet

> Running 2.2.0 3 box replicaset with one primary.

> PRIMARY is write-intensive and loads data all day long from various
> sources.

> The 2 SECONDARY server are supposed to support the read-only end of the
> application.  However, the "reads" involve lots of map-reduces that produce
> large results we store in temporary collections for sorting, etc.

> All was working OK in dev when we had one machine.  Now, trying to go to
> production we just learned that we can't write the map-reduce results to a
> temporary collection on the SECONDARY.  (per
> http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-Outputoptions).
>  When we try (C# driver), we get Command 'mapreduce' failed: not master
> (response: { "errmsg" : "not master", "ok" : 0.0 }

Hi Mark,

If you want to run Map/Reduce on a secondary you will need to use SlaveOK
and the "inline" output option, which does not require write access.  Note
that inline results are limited to the maximum document size (currently
16Mb).  To save those results to a collection you would still have to
commit via the primary, from your C# code.

If you are using the C# 1.6 driver or newer, you can use the additional
Read Preferences supported by MongoDB 2.2:
 http://docs.mongodb.org/manual/applications/replication/#read-prefere...

Depending on the sort of processing you are doing, you may be able to use a
query filter to create a more efficient incremental Map/Reduce:
 http://www.mongodb.org/display/DOCS/MapReduce#MapReduce-IncrementalMa...

Another option for read-only queries in MongoDB 2.2 is the new Aggregation
Framework:
 http://docs.mongodb.org/manual/applications/aggregation/

Cheers,
Stephen


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.