Solved

Flatfile database over NFS (CGI)

Posted on 1998-07-03
8
250 Views
Last Modified: 2010-03-18
We use two machines, one webserver and one for data which is nfs mounted on the webserver. Using a webinterface, I want people to add records to a flatfile database (using perl). I have to lock the file because I dont want two people adding records at the same time, this will mess up the database. I think I have to use the rpc.lockd daemon but it doesnt exist on my debian ditribution, Some people say this is impossible because of the caching of NFS.
0
Comment
Question by:bjornh
  • 4
  • 4
8 Comments
 
LVL 3

Expert Comment

by:marcelofr
ID: 1584663
Some people are right... you must avoid such a thing. There NO NFS locking implementation that really works... but...

I assume people whould like to read the file, not only add records... but, why don't you do it with sockets with perl?

Good Luck,

--Marcelo
0
 

Author Comment

by:bjornh
ID: 1584664
I know how to use sockets but what do you want to accomplish with that?

In my current implementation I use a semaphore file containing the pid of the proces and so far no more problems did occur. I think this should be completely safe, no other proces will read from the file when another proces is busy. Will this work or is it still dangerous (due to caching)?
0
 
LVL 3

Expert Comment

by:marcelofr
ID: 1584665
Of course... I believe the process opens the file, reads its contents, determines if the pid stored on it is still alive, if not, it writes its own pid to the file... How can you be sure all this is done atomically even without NFS... Any way you can have a process that auto-locks its own binary: this is better, but still you can have a race condition while loading the binary. You can go further, and use named pipes which will manage up to 4kb atomically and make it work locally, but then, why don't have the file local, and share it to the data server (I can hear you shouting that this approach breaks your servers functionalities ;-)

To can get close to 100% safe algoritm in your web server side, but you can't be sure of what you have on the data server side unless the filesystem is unmounted...

Good Luck

-- Marcelo
0
 

Author Comment

by:bjornh
ID: 1584666
Marcelo,

Thank you for your respone, I think you're right. If you answer the question I can give you the 100 points.

Thanks again,
Bjorn
0
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
LVL 3

Expert Comment

by:marcelofr
ID: 1584667
you forgot the check box ;-)
0
 

Author Comment

by:bjornh
ID: 1584668
Check box?
0
 
LVL 3

Accepted Solution

by:
marcelofr earned 100 total points
ID: 1584669
To "give the 100 points" you are supposed to check a box telling so (probably in the same page you are looking at now) and also rate the answer with an A, B etc. grade ;-)
0
 

Author Comment

by:bjornh
ID: 1584670
That's right. But to do that you have to _answer_ the question, I cant give you points if you only add a comment. Anyway, my database works perfect now.
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now