Different indexes for master and slave

130 views
Skip to first unread message

Nicolas Fouché

unread,
Sep 25, 2009, 11:03:13 AM9/25/09
to mongodb-user
Hi,

in our architecture, we do a LOT of writes (backend) and a LOT of
reads (frontend and backend).

The backend is connected to the master, and the frontend is connected
to the slave. We have indexes dedicated to backend queries and indexes
dedicated to frontend queries. I wonder if it would be possible to
create different indexes for a master and its slaves to save space and
enhance write performance.

Creating an index in a slave raises an error in "mongod". Could the
replication feature only replicate data, and not indexes creation/
deletion ?

Thanks.

Eliot Horowitz

unread,
Sep 25, 2009, 11:07:30 AM9/25/09
to mongod...@googlegroups.com
Interesting.
It could probably be an option.
Can you add a case at http://jira.mongodb.org/ with exactly what you'd
like and we'll see if its doable.

Nicolas Fouché

unread,
Sep 25, 2009, 11:22:35 AM9/25/09
to mongodb-user
I cannot find any other database system doing this thing, could be a
big + for MongoDB !

The ticket: http://jira.mongodb.org/browse/SERVER-315

On 25 sep, 17:07, Eliot Horowitz <eliothorow...@gmail.com> wrote:
> Interesting.
> It could probably be an option.
> Can you add a case athttp://jira.mongodb.org/with exactly what you'd

zahariash

unread,
Sep 25, 2009, 2:02:21 PM9/25/09
to mongodb-user
On 25 Wrz, 17:22, Nicolas Fouché <nico...@silentale.com> wrote:
> I cannot find any other database system doing this thing, could be a
> big + for MongoDB !

I think that mysql replication can do that. You can simply turn off
replication for current connection (SET SQL_LOG_BIN=0), create index
and finally turn replication on (SET SQL_LOG_BIN=1). Or you just can
create index only on slave in master-slave replication.

I think that feature will be very useful.

dwight_10gen

unread,
Sep 25, 2009, 2:12:34 PM9/25/09
to mongodb-user
this is an interesting idea and would not be a bad thing to add.

you *might* be able to add additional indexes on the slave with:

> db.getMongo().setSlaveOk()
> db.collection.ensureIndex(...);

likewise you could dropIndex() on the slave. however, if later an
index were added or dropped on the master that would still propogate
through; would be nicer to have some sort of "my indexes are different
forever" option.

want to try the above and let us know if it works?
Reply all
Reply to author
Forward
0 new messages