Home > Teknologi Maklumat > Unison File Synchroniser

Unison File Synchroniser

Hari ni nak cerita sikit pasal teknikal hehe.. kita selang seli lah, asyik pasal investment saja pun boring jugak kan..

OK, cerita hari ni pasal Unison File Synchroniser. Apa kebenda pulak ni?. Ha.. ini barang sebenarnya program yang boleh digunakan untuk configure mirroring service untuk auto synchronise data-data dalam direktori PC kita. Tapi dalam kes saya, saya perlu synchronisekan (copy data yang sama dari satu direktori ke direktori lain) data dari 2 server yang tidak berada dalam network yang sama.

Data utama ada di server di Internet dan akan berubah setiap 60 saat. Aplikasi yang nak access data tersebut ada dalam Intranet (network di pejabat). Masalahnya, macam mana aplikasi tersebut nak access data yang berada di Internet seolah-olah data tersebut ada di local directory? (dapat diaccess directly macam terus ke hard disk)

Ada few options untuk selesaikan masalah ni:

1) Guna FTP – buat script untuk auto download file2 yang berada di server di Internet secara berkala

2) Guna NFS – set “export” directory data yang akan di “mount” oleh local server

3) Guna rsync – aplikasi yang hampir sama dengan unison (backup & mirroring)

4) Guna unison – file synchroniser service (tak perlu FTP, aplikasi ni akan tau untuk download fail2 yang baru)

Selepas series of trial and error, setakat hari ni, saya pilih Unison berbanding options lain kerana “kesempoi-annya” hehehe.. ditambah pulak, unison boleh digandingkan dengan SSH untuk menjamin keselamatan (secure) hubungan di antara client dan server bila berhubung menerusi Internet.

Yang paling best sekali ialah unison dan SSH ni FREE. Ya betul, percuma saja bang.. tak payah beli pun. Tapi pada yang terkehel-kehel tak tahu nak configure, mungkin boleh upah orang yang tau buat hehehe…

Cuba tengok steps ringkas (ambik dari manual Unison) camne kita boleh synchronise dua directory di server berbeza:

———-

First, test that we can invoke Unison on the server from the client. Typing

        ssh remotehostname unison -version

should print the same version information as running

        unison -version

locally on the client. If remote execution fails, then either something is wrong with your ssh setup (e.g., “permission denied”) or else the search path that’s being used when executing commands on the server doesn’t contain the unison executable (e.g., “command not found”).

Create a test directory a.tmp in your home directory on the client machine.

Test that the local unison client can start and connect to the remote server. Type

          unison -testServer a.tmp ssh://remotehostname/a.tmp

Now cd to your home directory and type:

          unison a.tmp ssh://remotehostname/a.tmp

The result should be that the entire directory a.tmp is propagated from the client to your home directory on the server.

After finishing the first synchronization, change a few files and try synchronizing again. You should see similar results as in the local case.

If your user name on the server is not the same as on the client, you need to specify it on the command line:

          unison a.tmp ssh://username@remotehostname/a.tmp

Kalau nak tau lebih detail, boleh baca dekat sini:

http://www.cis.upenn.edu/~bcpierce/unison/download/releases/stable/unison-manual.html

----------

OK, bab nak mirror directory dah selesai.. Next task ialah menjadikan directory yang berjaya di “mirror” tadi tu dapat diaccess direct dari PC client. Camne nak buat tu?..

OK saya bagi hint dulu, kita boleh guna SAMBA. Apa kebenda pulak SAMBA ni?.. nak menari pulak ke? hehehe.. nanti saya cerita pasal SAMBA pulak, baru lengkap cerita ni..

Selamat mencuba! :)

  1. June 16th, 2009 at 22:35 | #1

    aiyak.. wa tarak paham la.. hahahahhahahaha

  2. md
    June 16th, 2009 at 22:40 | #2

    kayzen, hahaha..

  1. No trackbacks yet.