First, Rsync_service configuration
vim/etc/rsyncd.conf ====== Create the configuration file, configured as follows
==================================================
#rsyncd_config_______________start
# #rsyncd. conf start##
#rsync uid,gid=65534 (default)
# #rsync Start model ===== rsync--daemon
UID = rsync #固定rsync用户
GID = rsync#
Use chroot = no#
Max connections =#有多少客户端可以同时连本服务器
Timeout =#超时时间 300=300s
PID file =/var/run/rsyncd.pid#进程pid文件目录
Lock file =/var/run/rsync.lock#排队访问服务器端
Log file =/var/log/rsyncd.log#进程故障日志
[Oldboy] #模块 equivalent to a shared directory, you can also set up a multi-module method: Pull the module to the last side to increase
Path =/oldboy/#定义模块路径
Ignore errors#忽略错误
Read Only = False#相当于可读可写
List = False#允许列表
Hosts allow = 10.0.0.0/24#允许的主机
Hosts deny = 0.0.0.0/32#拒绝网段
Auth users = rsync_backup#虚拟用户, process user
Secrets file =/etc/rsync.password#用户对应的密码文件
#exclude =a b excludes files that are not allowed to upload a=filename b=filename
#rsync_config_______________end
==================================================
Start rsync:
Rsync--daemon
See if the port is correct = = Default: 873
Netstat-lntup|grep
Netstat-lntup|grep 873
Cat/var/log/rsyncd.log can also look at the boot log
Create the/oldboy directory in the configuration file
Mkdir/oldboy-p
Create rsync process user and give Oldboy owner
Useradd rsync-s/sbin/nologin
Chown-r rsync.rsync/oldboy/
Write the account password into the password configuration file and give 600 permissions (security privileges)
echo "rsync_backup:abu888" >/etc/rsync.password
chmod 600/etc/rsync.password
Server-side configuration is complete.
Client Configuration
Client is very simple, install a rsync, the password to the password file inside the password file to reduce the permissions to 600
Yum Install Rsync-y
echo "Dev.dev." >/etc/rsync.password
chmod 600/etc/rsync.password
Practice and Usage ———— | must be in client operation, server side is not executable
Access via rsync daemon: Process mode
Pull:rsync [OPTION ...] [[email protected]] Host::src ... [DEST]
1, Pull:rsync-avz [email protected]::oldboy//data1--password-file=/etc/rsync.password
rsync [OPTION ...] rsync://[[email protected]]host[:]/src ... [DEST]
2, Pull:rsync-avz rsync://[email protected]/oldboy/data1/--password-file=/etc/rsync.password
=============================================================================================================== =============
Push:rsync [OPTION ...] Src... [[email protected]] HOST::D EST
1, push:rsync-avz/data1/[email protected]::oldboy/--password-file=/etc/rsync.password
rsync [OPTION ...] SRC ... rsync://[[email protected]]host[:P ort]/dest
2, Push:rsync-avz/data1/rsync://[email Protected]/oldboy--password-file=/etc/rsync.password
Exclude single push:--exclude=filename exclude multiple with {Filename,filename} and so on
1, Rsync-avz--exclude={aaa.sh,oldboy,abu.sh}/data1/[email protected]::oldboy/--password-file=/etc/rsync.password
Exclude multiple, write filename that needs to be excluded into a file, and then use the filename created by--exclude-from=
2, Rsync-avz--exclude-from=/paichu.log/data1/[email protected]::oldboy/--password-file=/etc/rsync.password
Exclude single Rafa:--exclude=filename exclude multiple with {Filename,filename} and so on
Rsync-avz--exclude={abu.sh,oldboy} [email protected]::oldboy//data1/--password-file=/etc/rsync.password
Rsync-avz--exclude-from=/paichu.log/data1/[Email protected]::oldboy/--password-file=/etc/rsync.password
Exclude multiple, write filename that needs to be excluded into a file, and then use the filename created by--exclude-from=
Rsync-avz--exclude-from=/root/paichu.log [email protected]::oldboy//data1/--password-file=/etc/rsync.password
rsync Sync without differences
--deltet
Rsync-avz--delete/data1/[Email protected]::oldboy/--password-file=/etc/rsync.password
Rsync-avz--delete/[email protected]::oldboy//data1--password-file=/etc/rsync.password
rsyncServer Summary:
1, vi/etc/rsyncd.conf (user, directory, module, virtual user, and password file)
2. Create a shared directory/oldboy
3. Create rsync users. and authorized access to/oldboy/
4. Create a password file, copy the path in the configuration file, and then add the password content.
Content Virtual user name: password
5. password file permissions 600
6, rsync--daemon and then put into/etc/rc.local
7, Tail/var/log/rsyncd.log
Rsync Client (multiple)
1, the password file and the server does not have any relationship. command when
--password-file=/etc/rsync.password Content: Password
2,/etc/rsync.password 600
3. Execute push or pull with command
Exclude:
1. Firewalls and SELinux
2, look at the log/var/log/rsyncd.log
3, the entire deployment process to consider the overall troubleshooting.
4, operating habits as a major event.
Ways to Kill a process:
1, [[email protected] oldboy]# Cat/var/run/rsyncd.pid
4970
[[email protected] oldboy]# kill ' Cat/var/run/rsyncd.pid '
2, [[email protected] oldboy]# Pkill rsync
http://oldboy.blog.51cto.com/2561410/775056 old boy teacher's Linux OPS personnel will open source operation and Maintenance tool system
Linux learning record ——— rsync