Find the answer to your Linux question:
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 17
Say I'm running a database in my house, I connect to this database with many different applications and computers on a LAN, and that works fine. Now my frined connects ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Jan 2003
    Posts
    3

    Can linux syncronize directories?


    Say I'm running a database in my house, I connect to this database with many different applications and computers on a LAN, and that works fine. Now my frined connects to my server as well to grab info that he needs as well through the WAN. Now say my connection to the outside world was cut one day, forgot to pay phone/cable bill, my house burns down, or in my case someone blew up the telephone transformer/hub thing and knocked out the phones for the whole block. Now my friend can't connect to my computer or even call me. I can still work fine but if he needs something he's screwed. Is there a way to syncronize directories between two linux machines over a network connection? So if it ever does happen again, we can resume working in our locations, and when the connection does come back the information will rebuild. Keeping in mind that I am working with database files so data could not be over writen from A to B, it would have to be able to merged and or purged information between A and B. OR should I just start learning to program, cause the only way I'll get something like taht is if I make it?

  2. #2
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    I don't know about databses, but if all you need if a filesystem, check out the Coda filesystem at http://www.coda.cs.cmu.edu/. Coda has some semantic differences from normal unix filesystems, but I haven't tried it myself, so I'm not sure how tricky it is. But it does have offline synchronization, which you seem to need. It also has authentication support, which makes it better to use over the internet.
    It might be possible to make mysqld synchronize with a mirror server, but I really don't know much about it.

  3. #3
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    Don't use coda, I believe they stopped developing for it. If you are using say mysql as your db server, you can use mysql replication. I used it at work to take load off of the main server by replicating databases to other mysql servers. You can then query for into from those servers but you can NOT write to them. Another way to sync files is by using rsync. There are also a few distributed file systems like openafs, nfs, intermezzo that you can use.

  4. #4
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    There's nothing wrong with coda. The last public release was made the 2002/12/13, so it's still being developed. nfs should of course not be used for this, as it has no support at all for offline synchronization, except if you code it yourself, but that wasn't really the point, though. Intermezzo might be used, but it still has EXPERIMENTAL status in the kernel tree. I haven't heard of openafs, though, and it's not built in to the public kernel tree. I'll have to check it out.
    Also, coda has support for both authentication and link encryption, so if it should be used over the internet, it should probably be preferred.
    Coda can, however, absolutely not be used for storing a database used by several database servers at once. Actually, no file system can, since database servers usually have internal caching algorithms, but coda couldn't even be used with servers without internal caching, since it has session-based semantics.
    I'm guessing that it is a file system you need, since you ask if linux can synchronize directories, not databases. Correct me if I'm wrong.

  5. #5
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    I wouldn't use a distibuted fs at all for this. Just write a perl script to rsync the data over to the other server and then restart the db server. I still think the preferred method would be using built in replication on the db server.
    BTW, nfsv4 will synch after a client reconnects to the server.

  6. #6
    Linux Guru
    Join Date
    Oct 2001
    Location
    Täby, Sweden
    Posts
    7,578
    The problem with replication is, as you said yourself, that you have no write support while the connection is down. And having perl scripts to rsync and similar stuff just isn't as elegant as having a filesystem that syncs automatically, if I may bring forth my humble opinion.
    Anyway, we don't know if he was referring to a real SQL database or just a filetree, so any discussion is relatively pointless until we find out.
    And concerning NFSv4; if I'm not mistaken, it's not stable yet, is it? It's not until RH8 that RedHat has shipped kernels that even use NFSv3 by default.

  7. #7
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    The way replication works in mysql 3.23.X is that it replicates data out from a master server to other slave servers for read only. In mysql 4.X you can have numerous master servers with replicated data at which you can write to. The problem I see with a distributed fs is that what happens when the db server daemon makes a change to the db then is replicated to the slave over the filesystem. The daemon on the slave server won't know the change was made and reload the db. I see doing it this way, there will be a great chance of the db's getting out of synch and could cause stability issues with the db server daemon.

  8. #8
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    the nfsv4 patches for the 2.4.x kernel seem to be less buggy then nfsv3. So I see no reason in not using nfsv4 unless its in a production enviroment which I would be very cautious with.

  9. #9
    Linux Enthusiast
    Join Date
    Jun 2002
    Location
    San Antonio
    Posts
    621
    you are both missing a huge problem, what about shared data? Without communication neither side knows what the other side has modified, or wants to modify. So say comp A sets row 2, column 1 to "a" and computer B (offline) tries to set the same row/column to "b". A will not know that B even wants to modify it, and once B does reconnect, who is right? Will computer B be let known that the data it has been working with is incorrect? How far did B go based on the face that that cell was "b"? Lots of bad mojo going on here.
    I respectfully decline the invitation to join your delusion.

  10. #10
    Linux Engineer
    Join Date
    Jan 2003
    Location
    Lebanon, pa
    Posts
    994
    That is why you use mysql replication. There is one master which all changes are made on and multiple slaves which you can query data from. This is exactly what he needs to do.

Page 1 of 2 1 2 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •