In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains "how to use rsync to achieve website mirroring and backup", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Now let the editor take you to learn "how to use rsync to achieve website mirroring and backup"!
Server side
# more / etc/rsyncd.conf
Uid = nobody
Gid = nobody
Use chroot = no
Max connections = 4
Pid file = / var/run/rsyncd.pid
Lock file = / var/run/rsync.lock
Log file = / var/log/rsyncd.log
[wap]
Path = / usr/local/backup
Ignore errors
Read only = yes
List = no
Hosts allow = 192.168.1.2
Hosts deny = 0.0.0.0amp 32
Auth users = backup
Secrets file = / etc/rsyncd.secrets
# more / etc/rsyncd.secrets
Backup:backup
# chmod 600 / etc/rsyncd.secrets
# chown root.root / etc/rsyncd.secrets
# rsync-daemon
Client
# more / etc/rsync.pass
Backup
# more / etc/rsync.sh
Rsync-avP backup@192.168.1.1::www / usr/local/backup
-- password-file=/etc/rsync.pass
FAQ
Q: how to rsync via ssh without entering a password?
A: you can go through the following steps
1. Set up SSH keys on server A through ssh-keygen. Do not specify a password. You will see identity and identity.pub files under ~ / .ssh.
two。 Create a subdirectory in the home directory on server B. ssh
3. Copy the identity.pub of A to server B
4. Add identity.pub to ~ [user b] / .ssh/authorized_keys
5. So user An on server A can ssh to server B as user B with the following command
E.g. Ssh-l userB serverB
This allows user An on server A to log in to server B without a password for ssh as user B.
Q: how do I use rsync through a firewall without compromising security?
A: the answer is as follows:
There are usually two situations, one is that the server is inside the firewall, and the other is that the server is outside the firewall. In either case, ssh is usually used, so it's best to create a new backup user and configure sshd to allow only that user to enter through RSA authentication. If the server is inside the firewall, it is best to limit the IP address of the client and deny all other connections. If the client is inside the firewall, you can simply allow the firewall to open the ssh outgoing connection of TCP port 22 to ok.
Q: can I back up the files that have been changed or deleted?
A: of course:
You can use things such as rsync-other-options-backupdir =. / backup-2000-2-13. To achieve such a command.
So if the source file: / path/to/some/file.c changes, the old file will be moved to. / backup-2000-2-13/path/to/some/file.c
Here, this directory needs to be set up by hand.
Q: which ports do I need to open on the firewall to accommodate rsync?
A: it depends on the situation
Rsync can transfer files directly through the tcp connection of port 873, or through the ssh of port 22, but you can also change its port with the following command:
Rsync-port 8730 otherhost::
Or
Rsync-e 'ssh-p 2002' otherhost:
Q: how can I just copy the directory structure through rsync and ignore the files?
A:rsync-av-- include'* /-- exclude'* 'source-dir dest-dir
Q: why do I always make "Read-only file system" mistakes?
A: see if you forgot to set "read only = no"
Q: why do I have the error of'@ ERROR: invalid gid''?
A:rsync is run with uid=nobody;gid=nobody by default. If there is no nobody group on your system, this error will occur. You can try gid= nogroup or something else.
Q: what is the failure to bind port 873?
A: if you are not running this daemon with root privileges, this error will occur because the ports below port 1024 are privileged ports. You can change it with the-- port parameter.
Q: why did my authentication fail?
A: from your command line:
What you use is:
>; bash$ rsync-a 144.16.251.213::test test
>; Password:
>; @ ERROR: auth failed on module test
>
>; I dont understand this. Can somebody explain as to how to acomplish this.
>; All suggestions are welcome.
It should be the problem caused by not logging in with your user name. Try rsync-a max@144.16.251.213::test test
At this point, I believe you have a deeper understanding of "how to use rsync to achieve website mirroring and backup". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.