Windows installation:
Solve the problem:ProgramIncorrect configuration ......"
Install"Microsoft Visual C ++ 2008 SP1 redistributable package (x86)"
1 Preface
In our daily work, we often encounter the following situations: in static applications, to reduce the pressure on the publishing system for web access, the multi-level Cache architecture is used, multiple www servers located at the backend of the Cache architecture must maintain data consistency and must be close to real-time data consistency with the publishing system, ensure that the data accessed by all users is consistent and up-to-date. In dynamic applications, multiple servers are used for redundancy to ensure application reliability, the application data on each server must be consistent.
There are obvious drawbacks in the above two architectures. For example, in the synchronization system, we use rsync to synchronize data, and the data is transmitted between different hosts in the form of a compressed package, therefore, data needs to be compressed before and after each transmission, which increases the system load, especially when several hundred megabytes of large packets are encountered, which not only occupies the bandwidth, in addition, the subsequent compressed packages are blocked, which affects the real-time processing of website content. In addition, dynamic application updates occupy a large amount of time in our daily work and are repetitive and boring, one thing that is completely technical is that for some applications that only have two or three servers, it takes a little time and effort to update a single update, however, for some important applications with a large volume of traffic and a large number of servers, such as BBS and advertisements, an update usually takes at least half an hour, and many servers are prone to errors.
Based on the above reasons, I have consulted other colleagues and made some introductions on the Internet. I have made some explorations in file synchronization, the following are some of the tools I have found that can reduce our system pressure and our maintenance workload. They are: Unison, inotify, csync2, and tsync.
This document briefly introduces the features, working principles, installation and usage, and configuration policies of various tools, instead of focusing on the specific implementation of their work. For detailed documents, refer to Internet connection. Similarly, I will not describe all their usage, but simply describe the usage that can be used in our work.
2 unison
2.1 unison Introduction
Unison is a file synchronization tool that can be used on Windows and UNIX platforms. It can ensure consistency between the two folders (local or online. Unison has the same features as some other synchronization tools or file systems, but also has its own features:
LCross-platform use;
LNo special requirements on kernel and user permissions;
LUnison is bidirectional. It can automatically process the parts without conflict in the two-point copy. Conflicting parts will be displayed so that the user can choose to update the policy;
LAs long as the two hosts can be connected, you can run unison. You can directly use socket connection or Secure SSH connection, which does not require high bandwidth, use a compression transfer protocol similar to rsync.
2.2 install unison
Unison has a text interface and a graphic interface. Here we only show you how to use it on the text interface.
Download:
Http://www.cis.upenn.edu /~ Bcpierce/unison
In Windows, the file is a. exefile, And the unison-2.13.16-win-text.exefile is renamed as unison.exe in the C: Windows directory, and can be executed on the command line.
In Linux, You need to compile and install the source code package. You need a tool named objective caml compiler. The version must be at least 3.0.7. You can download it from here:
Http://caml.inria.fr/
The ocaml installation script is as follows:
# Tar-zxf ocaml-3.09.3.tar.gz
# Cd ocaml-3.09.3
#./Configure
# Make World OPT
# Make install
Bytes
The installation script is as follows:
# Tar-zxf unison-2.13.16.tar.gz
# Cd unison 2.13.16
# Make uistyle = text
# Make install
The executable file unison Will be generated, and the CP will be sent to the system path.
# Cp./unison/usr/local/bin
2.3 use unison
Unison can be used on a host, synchronize two folders, or use it on the network.
2.3.1 local use (Brief Introduction)
Usage:
# Unison dir1 dir2
If two folders are detected to be different, unison Will prompt you to select the appropriate operation. For example:
Filename [F]
Indicates that there are new files in the folder on the right. Are you sure you want to synchronize them to the folder on the left? F indicates force. input? We will provide a more detailed introduction.
New File D/H []
The two folders are inconsistent. Similarly, enter? A detailed introduction is provided.
2.3.2 Remote use
LSSH mode:
Usage:
# Unison dir1 SSH: // username @ remotehostname (IP) // absolute/path/to/dir2
Synchronize the local directory dir1 with the remote host/absolute/path/to/dir2. Generally, two hosts are required to be connected over ssh.
LSocket mode:
Unison manual said this is a very insecure method, but it can be used only for data synchronization between desktops and laptops.
Usage:
On one end of the host, a daemon is required:
# Unison-socket Port
Host on the other end:
# Unison dir1 socket: // remotehost (IP): Port // absolute/path/to/dir2
The relative path can be used in the usage of the unison command, that is, the current path relative to the command running the unison command. However, in my opinion, using the absolute path is not prone to errors, we recommend that you use absolute paths to indicate the folders to be synchronized.
2.3.3 use unison with the configuration file
Although you can specify the parameters required for running the unison command line, we recommend that you use the configuration file to configure the unison. The reason is simple, viewing the configuration file is easier to understand than viewing the command line and more manageability.
The default configuration folder is located in ~ Currentuser/. Unison, that is, the current user's home directory, Windows is located in C: documents and settingscurrentuser. Unison, the default configuration file name is default. PRF.
Run the following command:
# Unison config
Unison will read ~ The configuration in the currentuser/. unison/config. PRF file.
The following is a simple configuration file example (used for synchronization of two folders in the BBS application ):
Root =/var/www/bbsnew
Root = SSH: // support@192.168.239.172 // var/www/bbsnew
Force =/var/www/bbsnew
Ignore = path WEB-INF/tmp
Ignore = path WEB-INF/work *
Auto = true
Log = true
Logfile =/home/support/. unison/itbbs_239.172.log
Two root accounts indicate the folders to be synchronized.
Force indicates to synchronize the local/var/www/bbsnew folder to the remote end.
Ignore = path indicates that the WEB-INF/tmp directory under root is ignored, that is, it is not synchronized during synchronization.
Auto indicates that the default update Rule is automatically applied. It should be taken as the local folder here, and there will be no update conflict. You can use the default update rules.
Log = true indicates that the running information is output on the terminal.
Logfile specifies that the output is written to the log file at the same time.