The multi-machine data synchronization mechanism Unison + inotify-tools was accidentally encountered in the QQ group this morning when I heard a problem about two-way Real-Time Synchronization of different machines. When I thought of it, I found that the database (mysql ), it seems that the two-way real-time synchronization technology seems very limited, not to mention the need to achieve two-way Real-Time Synchronization of multiple machines, a variety of Google, Baidu document search on the Internet at a time, I hope to query the outstanding cases for reference, and finally the results will be fruitless. I will talk about two-way file synchronization on the Internet, which can achieve real-time cases, but on the DB layer, the traversal fails and no related cases are found. The following is the synchronization mechanism of unison and inotify. The synchronization mechanism is very good in the web cluster, and the two-way real-time data file synchronization is very good; record this article to keep relevant records! Unison: achieve two-way synchronization Inotify tools: Monitoring File System OpenSSH: file transmission between remote hosts the following is the definition of related software found on the Internet; Unison is a cross-platform file synchronization tool, not only supports local synchronization, but also supports synchronization through network protocols such as SSH, RSH, and Socket. Even better, Unison supports two-way synchronization. You can synchronize data from A to B, or from B to A without additional settings. Inotify is a file change notification mechanism, which was introduced in Linux kernel from 2.6.13. Kqueue, which is famous in BSD and Mac OS systems, can efficiently track Linux File System Changes in real time. In recent years, fsnoop has been used as the backend. Almost all mainstream Linux distributions support the Inotify mechanism. Inotify-tools is a set of c development interface library functions provided for inotify file monitoring tools in linux. It also provides a series of command line tools, these tools can be used to monitor file system events. Inotify-tools are written in c. In addition to requiring Kernel support for inotify, they do not depend on others. The following is an expanded spectrum for multi-level configuration of Bidirectional real-time synchronization. In a group set, the data is synchronized between multiple hosts, while the unison synchronization function only supports Dual Servers. Therefore, we have designed a star topology to synchronize multiple hosts. The design idea is to use the two-way synchronization function of unison to specify a master server (server1) with a star structure, and the remaining servers perform two-way synchronization with it. In this way, file changes on any server can be spread through this structure to achieve multi-machine synchronization. The disadvantage of this structure is that once server1 fails, synchronization will fail. Therefore, if necessary, it can form a star structure of the dual master server to make up; source http://blog.csdn.net/songxixi/article/details/8787923