• notice
  • Congratulations on the launch of the Sought Tech site

rsync realizes file synchronization between servers

    Rsync's official website address: https://rsync.samba.org.The latest version of rsync is version 3.1.2.The principle of rsync is not complicated.Start an rsyncd service on the server side, and the default product is 873.Then the client can synchronize files (upload and download files) to the server side.Rsync installation command:

wget https://download.samba.org/pub/rsync/src/rsync-3.1.2.tar.gz cd rsync-3.1.2 mkdir /opt/modules/rsync./configure --prefix=/opt/modules/rsync make make install

     After the installation is successful, start to write the configuration file, the default configuration file path called is the /etc/rsyncd.conf file.Open and write the following content:

#The following users and groups run rsync server side uid < /var/log/rsyncd.log #Note that webtest is a module here.Use it after host when synchronizing::The module name is the name here [webtest] #Storage after receiving the file on the server Path path ]# /usr/local/rsync/bin/rsync --daemon [ root@kermitAt this time, the server is started successfully.Next, we will use the client to send files to the server.The client does not need to install anything.The server basically has this rsync command, which can be used directly.However, you need to configure the password file before using it, because we definitely need a password when sending a file to the server, but the password cannot be displayed in the command in plaintext, right? So you have to write to the configuration file, such as the /etc/client.pass file.The password format here is different from the above /etc/server.pass.You only need to write the password here.For example, if you correspond to the configuration above, write it directly here.11111 is fine.Similarly, the permissions of the password file of this client must also be inaccessible to other users, otherwise an error will be reported when loading the password file: @ERROR: auth failed on module webtest.

    Why does rsync have this requirement for this password file? Others are also easy to understand.This is a password file with important passwords stored in it.Therefore, other users cannot be allowed to have access rights, otherwise the server will not be safe at all.OK, then use the command to send the file to the server:

[ At this time, the server is started successfully.Next, we will use the client to send files to the server.The client does not need to install anything.The server basically has this rsync command, which can be used directly.However, you need to configure the password file before using it, because we definitely need a password when sending a file to the server, but the password cannot be displayed in the command in plaintext, right? So you have to write to the configuration file, such as the /etc/client.pass file.The password format here is different from the above /etc/server.pass.You only need to write the password here.For example, if you correspond to the configuration above, write it directly here.11111 is fine.Similarly, the permissions of the password file of this client must also be inaccessible to other users, otherwise an error will be reported when loading the password file: @ERROR: auth failed on module webtest.

    Why does rsync have this requirement for this password file? Others are also easy to understand.This is a password file with important passwords stored in it.Therefore, other users cannot be allowed to have access rights, otherwise the server will not be safe at all.OK, then use the command to send the file to the server:

[ auth failed on module webtest.

    Why does rsync have this requirement for this password file? Others are also easy to understand.This is a password file with important passwords stored in it.Therefore, other users cannot be allowed to have access rights, otherwise the server will not be safe at all.OK, then use the command to send the file to the server:

[ auth failed on module webtest.

    Why does rsync have this requirement for this password file? Others are also easy to understand.This is a password file with important passwords stored in it.Therefore, other users cannot be allowed to have access rights, otherwise the server will not be safe at all.OK, then use the command to send the file to the server:

[root@kermit ~]# rsync -avSH --password-file=/etc/client.pass aa.php [email protected] ::webtest sending file list sent 27 bytes received incremental 8 bytes 70.00 bytes/sec total size is 66 speedup is 1.89
    Use the following command to read the module from the remote server:

[ root@kermit ~]< /span># rsync -vzrtopg --progress --delete --password-file=/etc/client.pass [email protected]/sec total size is 76 speedup is 0.27
     But it should be noted that write only=yes is written in the configuration file above me.In this case, it is impossible to read from the server side.At this time, the log error will be reported when the above read command is executed: ERROR: module is write only.Need to be changed to read only = false and write only = false.In this way, the client can read and write to the server.module is write only.Need to be changed to read only = false and write only = false.In this way, the client can read and write to the server.module is write only.Need to be changed to read only = false and write only = false.In this way, the client can read and write to the server.

Tags

Technical otaku

Sought technology together

Related Topic

0 Comments

Leave a Reply

+