Four ways to implement web data synchronization =========================================== ======== nfs enables web data sharing rsync + inotify for web data synchronization rsync + sersync faster and more resource-saving implementation of web data synchronization unison + inotify for two-way web data synchronization = ============================================================ 1. nfs achieve web Data Sharing & n
Four ways to implement web data synchronization
========================================================
Nfs for web data sharing
Rsync + inotify for web data synchronization
Rsync + sersync faster and more resource-saving for web data synchronization
Unison + inotify achieve two-way web data synchronization
========================================================
I. nfs for web data sharing
| 12345678910111213 |
[root@jie1 ~]# vim /etc/httpd/conf/httpd.conf########################################ServerName 172.16.22.1:80#DocumentRoot "/var/www/html" ServerName www.jie.comDocumentRoot /web/htdocs</VirtualHost>#######################################[root@jie1 ~]# mkdir -pv /web/htdocs[root@jie1 ~]# Cd/web/htdocs # No webpage files on the server[root@jie1 ~]# ls[root@jie1 ~]# |
3) rsync service configuration
* ***** Create The rsync configuration file and password file ************
Touch/etc/rsyncd. conf (rsync configuration file)
Touch/etc/rsyncd. pwd (user's password file)
Chmod 600/etc/rsyncd. pwd (the permission must be set to 600; otherwise, the backup will fail)
| 1234567891011121314151617181920212223242526272829303132 |
[root@jie1 ~]# vim /etc/rsyncd.conf############vim /etc/rsyncd.conf########################################uid = nobody # Id of the backup, user IDgid = nobody # ID of the backup groupuse chroot = no # Banned from the source directorymax connections = 3 # Maximum number of connections. 0 indicates no limitstrict modes = yes# Check the permissions of the password filepid file= /var/run/rsyncd.pid # Pid file of the running processlog file= /var/log/rsyncd.log # Log file[htdocs] # Specify the name of the authenticated backup modulepath = /web/htdocs# Path of the directory to be backed upignore errors = yes# Ignore irrelevant IO errorsreadonly = no # If it is set to no, it can be passed to the corresponding directory on the server.write only = no # Set to no, indicating that the client can download fileshosts allow = 172.16.22.3 # IP address of the host that can connect to the rsync serverhosts deny = * # Set the host address to prohibit the connection to the rsync server. * indicates that all requests except those defined by hosts allow are rejected.uid = rootgid = rootauth users= backuper # User name of the connection modulesecrets file= /etc/rsyncd.pwd# Path for storing the password file of the connection module User name#####################################################################[root@jie1 ~]# Vim/etc/rsyncd. pwd # user's password file#####################################################################backuper:pwd123 # Username: password#####################################################################[root@jie1 ~]# Chmod 600/etc/rsyncd. pwd # grant permissions to 600[root@jie1 ~]# chkconfig rsync on[root@jie1 ~]# chkconfig xinetd on[root@jie1 ~] |