LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 10-18-2007, 04:57 AM   #1
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Rep: Reputation: 15
A near realtime file system mirror application


Recently I started an open source project "cutils" on the
sourceforge:
http://sourceforge.net/projects/crablfs/

The document can be found at:
http://crablfs.sourceforge.net/#ru_data_man

This project's mirrord/fs_mirror tools is a near realtime file system
mirroring application across 2 or more hosts, to mirrors the many small
files from one to another as soon as possible when there is any
modification
.

I started these projects on LFS first, but these tools can also be
applied on other distributions, for instance, I used them alos on the
RHEL4 environment.

mirrord/fs_mirror makes use of inotify, which is a function afforded
by the recent Linux (from 2.6.12). It is a counterpart of FAM, since Linux
FAM has stopped so long.

I hope these tools can be useful to you.

Thanks.

Last edited by Chowroc; 10-28-2007 at 05:58 AM.
 
Old 10-18-2007, 08:52 PM   #2
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
it's great, I believe it especially important for enterprise fileserver, so how the progress? Any stuck?
 
Old 10-22-2007, 01:11 AM   #3
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kstan View Post
it's great, I believe it especially important for enterprise fileserver, so how the progress? Any stuck?
In fact I'm using it for my online environment now on the RHEL4s, also
runs on my own LFS 6.2.

This is the first version, which has serveral limitations and a huge space
for improvements, for example, now the pyinotify uses in memory watches,
I will change to Berkeley DB.
 
Old 10-22-2007, 07:51 PM   #4
kstan
Member
 
Registered: Sep 2004
Location: Malaysia, Johor
Distribution: Dual boot MacOS X/Ubuntu 9.10
Posts: 851

Rep: Reputation: 31
Quote:
Originally Posted by Chowroc View Post
In fact I'm using it for my online environment now on the RHEL4s, also
runs on my own LFS 6.2.

This is the first version, which has serveral limitations and a huge space
for improvements, for example, now the pyinotify uses in memory watches,
I will change to Berkeley DB.
I see, hope your project success, anyway why you need to use database? Simply load everything into ram during load the module faster isn't it? Or you use indexing for file search?

Regards,
Ks
 
Old 10-28-2007, 05:39 AM   #5
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Original Poster
Rep: Reputation: 15
Quote:
Originally Posted by kstan View Post
I see, hope your project success, anyway why you need to use database? Simply load everything into ram during load the module faster isn't it? Or you use indexing for file search?

Regards,
Ks
This roots to the limitation of the Pyinotify I currently use. The "Watch" instances takes too much memory. There are two ways:
1. Implement myself pyinotify and reduce the size of "Watch".
2. Use a powerful and simple database such as Berkeley DB and rely on its
memory management.

I will try both of them, and it's possible to afford both of them as choices to the users.

Thanks.
 
Old 10-28-2007, 05:56 AM   #6
Chowroc
Member
 
Registered: Dec 2004
Posts: 145

Original Poster
Rep: Reputation: 15
Now I meet a strange problem.

After the first sync init, it enters to the realtime replication state. I deployed them on 3 machines, and have run near half month. Suddenly one day, a host, I don't know what's wrong, I found fs_mirror get the empty
records from its mirrord agent. In normal conditions, these records should
be:
"CREATE:/var/www/html"
"FWRITE:/var/www/html/index.php"
"DELETE:/var/www/html/temp"
"MOVE'/var/www/html/aa', '/var/www/html/bb')"
...
But should be no empty records. This lead to fs_mirror to a dead infinite loop.

I restart the fs_mirror from the broken point, but the problem remains, after DEBUG I found the problem occurs at the same serial number every time(I use Berkeley DB as the log record(wmLog), and serial numbers are the keys), so I suspect that the problem is BDB, but I don't know how to test
and locate to the right place.

I tried to open the orignal db file in Python:
>>> import bsddb
>>> x = bsddb.btopen("/var/mirrord/wmlog"
>>> len(x)
623748
>>> x["6854"]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/bsddb/__init__.py", line 223, in __getitem__
return _DeadlockWrap(lambda: self.db[key]) # self.db[key]
File "/usr/lib/python2.5/bsddb/dbutils.py", line 62, in DeadlockWrap
return function(*_args, **_kwargs)
File "/usr/lib/python2.5/bsddb/__init__.py", line 223, in <lambda>
return _DeadlockWrap(lambda: self.db[key]) # self.db[key]
KeyError: '6854'
>>> x[str(6854)]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/bsddb/__init__.py", line 223, in __getitem__
return _DeadlockWrap(lambda: self.db[key]) # self.db[key]
File "/usr/lib/python2.5/bsddb/dbutils.py", line 62, in DeadlockWrap
return function(*_args, **_kwargs)
File "/usr/lib/python2.5/bsddb/__init__.py", line 223, in <lambda>
return _DeadlockWrap(lambda: self.db[key]) # self.db[key]
KeyError: '6854'
>>> x.first()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python2.5/bsddb/__init__.py", line 278, in first
rv = _DeadlockWrap(self.dbc.first)
File "/usr/lib/python2.5/bsddb/dbutils.py", line 62, in DeadlockWrap
return function(*_args, **_kwargs)
_bsddb.DBNotFoundError: (-30990, 'DB_NOTFOUND: No matching key/data pair found

Even I have stopped the mirrord daemon, the errors remain.

Then I tried to copy and move out the database file, and open the new dbfile:
>>> import bsddb
>>> x = bsddb.btopen("/tmp/wmlog")
>>> len(x)
0
the length is 0, and getitem get the same errors above.

Why this occurs when I copy the db file? Especially the len() is 0?!

I can only restart the mirrord, to rebuild the BDB data file, and so far,
this problem does not occurs again.

I don't know why there is a occasional problem like this? Is there any one be familiar with BDB can give me several advices?

Thanks.
 
Old 02-22-2008, 01:03 PM   #7
lefty.crupps
Member
 
Registered: Apr 2005
Location: Minneap USA
Distribution: Debian, Mepis, Sidux
Posts: 470

Rep: Reputation: 32
Will this new 'Cutils' program be able to keep in-sync mirrors of filesystems?

I would like an app which reads from the fastest host, and writes changes to all hosts, keeping them in sync. This would be great in a network environment with multiple fileservers for redundancy, where the loss of one server wouldn't affect the availability of files. The files couldn't be striped across multiple machines since this redundancy may be used with only two fileservers, for example. The application would have to keep full data on each machine, but also keep changes in sync.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
File sync between 2 servers in ~ realtime matts76 Linux - Software 6 08-12-2006 09:29 AM
Linux realtime file replication bretticus Linux - Software 4 11-03-2005 09:28 AM
How can I output realtime system resources to a label or textarea? JAVA randomx Programming 6 07-15-2004 06:41 PM
Promise ataraid - system crashes after rebuild of mirror tallship Linux - Hardware 4 12-07-2003 10:27 PM
What file system is best for this application: bluceree Linux - Software 4 02-20-2003 09:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 12:40 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration