Discussion:
Read Only Remote DB (Replication?)
(too old to reply)
s***@gmail.com
2007-03-12 01:11:32 UTC
Permalink
Hi,

I'm *really* new to bdb so I apologize in advance for the question.

I have a db on a remote machine. Once initializated and filled up,
this db is not modified anymore.
I'd want to "connect" to this remote db from another machine, in a
read only mode.
My questions are:

1) Is replication the simplest/most correct way to achieve this? I
want to focus on the point that, once created, the db is accessed
*always* in read only.

2) When replication starts, is its content update driven by client's
db->get()s ? In my specific aplication, I have on thread which asks
for some data, the desired behaviour whould be to tell the client db
to start fetching the data from the master db. If the data is already
in the local copy of the db, then I use it, otherwise that get()
should fail as I expect (and desire, since for this specific case I
can't block until the data is ready).

3) If the db update is ::get() driven, does bdb have some kind of
prefetch based on locality or have I to implement my own policy?

Think to my application as a google-earth-like application. I have the
data in a remote repository, then on demand a client asks for some of
them and, if not already present, falls back to a lower resolution
representation of the data.

Thank you in advance!
ashok
2007-03-13 11:13:44 UTC
Permalink
Post by s***@gmail.com
Hi,
I'm *really* new to bdb so I apologize in advance for the question.
I have a db on a remote machine. Once initializated and filled up,
this db is not modified anymore.
I'd want to "connect" to this remote db from another machine, in a
read only mode.
1) Is replication the simplest/most correct way to achieve this? I
want to focus on the point that, once created, the db is accessed
*always* in read only.
2) When replication starts, is its content update driven by client's
db->get()s ? In my specific aplication, I have on thread which asks
for some data, the desired behaviour whould be to tell the client db
to start fetching the data from the master db. If the data is already
in the local copy of the db, then I use it, otherwise that get()
should fail as I expect (and desire, since for this specific case I
can't block until the data is ready).
3) If the db update is ::get() driven, does bdb have some kind of
prefetch based on locality or have I to implement my own policy?
Think to my application as a google-earth-like application. I have the
data in a remote repository, then on demand a client asks for some of
them and, if not already present, falls back to a lower resolution
representation of the data.
Thank you in advance!
Replication maintains one or more identical copies of the database.
So if the database was created on a remote machine,
do you want to have a local read-only replica on the machine where
you're accessing it?

If not, then replication is not a solution.

Can the disk/storage on the remote machine be accessed from the local
machine?
Don Anderson
2007-03-23 15:27:28 UTC
Permalink
Post by ashok
Post by s***@gmail.com
Hi,
I'm *really* new to bdb so I apologize in advance for the question.
I have a db on a remote machine. Once initializated and filled up,
this db is not modified anymore.
I'd want to "connect" to this remote db from another machine, in a
read only mode.
1) Is replication the simplest/most correct way to achieve this? I
want to focus on the point that, once created, the db is accessed
*always* in read only.
2) When replication starts, is its content update driven by client's
db->get()s ? In my specific aplication, I have on thread which asks
for some data, the desired behaviour whould be to tell the client db
to start fetching the data from the master db. If the data is already
in the local copy of the db, then I use it, otherwise that get()
should fail as I expect (and desire, since for this specific case I
can't block until the data is ready).
3) If the db update is ::get() driven, does bdb have some kind of
prefetch based on locality or have I to implement my own policy?
Think to my application as a google-earth-like application. I have the
data in a remote repository, then on demand a client asks for some of
them and, if not already present, falls back to a lower resolution
representation of the data.
Thank you in advance!
Replication maintains one or more identical copies of the database.
So if the database was created on a remote machine,
do you want to have a local read-only replica on the machine where
you're accessing it?
If not, then replication is not a solution.
Can the disk/storage on the remote machine be accessed from the local
machine?
I hope I can expand on what Ashok has told you.
If you are 100% readonly, then the easiest solution is to use
BDB without replication or transactions. Create your
database, make sure you sync it before closing, copy it to
to machine *where you are using it*. There is no need to
access a remote machine from your application -- actually that
is a harder problem. Rather, use BDB directly within your
application to access the database. Open it readonly to enforce
the fact that you won't change it.

Now if what you need is a database that is readonly from all clients
and changes slowly (or even quickly), then replication is totally
appropriate -
essentially all the changes to the master database get propogated to
all the clients. In that case, you need replication and transactions.
There are many other variations.

Hope that makes sense.

- Don

Loading...