开发者

Synchronizing Applications

I have a standalone network device. It needs to be reworked to function as part of a geographically distributed group of these devices. Synchronization between devices in the group need not occur frequently, not more than hourly. The application is rails with SQLite.

Mainly, we want to keep certain pieces of information collected on these devices in sync. Because of the deployment, it isn't feasible to add a large database cluster.

I have been considering CouchDB since replication and handling conflicts resulting from replication is a strong suit of it开发者_开发百科s.

What do you think of CouchDB as a mechanism to keep distributed network devices synchronized? Any thoughts or suggestions for an alternative approach?


What is the particular question?

CouchDB implements master-master replication which is exactly what you are asking for.

Or?


CouchDB would be a great fit for this, because as you say, it has master-master replication. Since you're replicating over the WAN, another huge add is that CouchDB was designed to handle going on and off the network gracefully, which will be a nice piece of fault tolerance.

A lot of people have used CouchDB for this type of situation. Take a look at some case studies (http://www.couchbase.com/customers/case-studies) and a recent blog post I wrote about using CouchDB to keep front end servers' session data synchronized (weblog.bocoup.com/storing-php-sessions-in-couchdb).

Also, it would help if you posted more information about your case so that we can help cater our answers.

Cheers.


CouchDB is fine. You might have some alternatives with Unix tools.

The simplest key/value database is files in a filesystem. They work great. If you only need key/value storage with basic replication, then rsync can do that. If your conflict resolution policy is, for example, always take the latest timestamped data, then you might get away with rsync.

First of all, you're probably running Unix/Linux. SSH and rsync will be included, unlike CouchDB.

Another advantage of rsync (actually its SSH tunnel) is of course identification, authentication, and authorization. Your device is presumably Unix/Linux, and there are a million ways to wire up Unix authorization. It's not a guarantee but nearly anything is doable: password files, NIS, LDAP, Kerberos, Samba/Active Directory. The list goes on.

With Couch you will have to figure out some kind of user management system.

  • Will you use oauth?
  • Will you have to write an authentication plugin?
  • Will you also replicate the _users database around? What about conflicts in the _users database?
  • Do you instead have a central _users database? How can you have a central users database if you can't have a central data database?

Couch, like MySQL, is a full-blown server. It will maintenance load that rsync won't.

  • Remember to compact your databases, compact your views, and run view cleanup
  • Remember to rotate the log files
  • Possibly back up your .couch files and your .ini config

In other words, can you do a quick and dirty rsync hack, or do you need the full Couch package?

CouchDB is a uniform, consistent platform regardless of OS. That can be good or bad. Not knowing your specifics, I would guess that rsync over SSH is the best short-term, but Couch is the best long-term. (But with so many software projects, long-term never seems to arrive.)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜