搭建backup服务器rsyncdaemon服务模式之二rsync客户端配置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了搭建backup服务器rsyncdaemon服务模式之二rsync客户端配置相关的知识,希望对你有一定的参考价值。
1.检查客户端是否有rsync服务:
[[email protected] ~]# rsync --version
rsync version 3.0.6 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, iconv, symtimes
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
[[email protected] ~]# rpm -qa rsync
rsync-3.0.6-12.el6.x86_64
2.客户端编辑/etc/rsync.password留下密码oldboy
[[email protected] ~]# echo "oldboy" >/etc/rsync.password
[[email protected] ~]# cat /etc/rsync.password
oldboy
因为有密码所以是600全新
[[email protected] ~]# chmod 600 /etc/rsync.password
[[email protected] ~]# ll /etc/rsync.password
-rw------- 1 root root 0 Aug 3 00:43 /etc/rsync.password
3.创建backup目录,目的:打包,推送,删除。本地临时备份目录
[[email protected] ~]# mkdir -p /backup
[[email protected] ~]# cd /backup
[[email protected] backup]# touch stu{01..100}
[[email protected] backup]# ls
stu001 stu011 stu021 stu031 stu041 stu051 stu061 stu071 stu081 stu091
stu002 stu012 stu022 stu032 stu042 stu052 stu062 stu072 stu082 stu092
stu003 stu013 stu023 stu033 stu043 stu053 stu063 stu073 stu083 stu093
stu004 stu014 stu024 stu034 stu044 stu054 stu064 stu074 stu084 stu094
stu005 stu015 stu025 stu035 stu045 stu055 stu065 stu075 stu085 stu095
stu006 stu016 stu026 stu036 stu046 stu056 stu066 stu076 stu086 stu096
stu007 stu017 stu027 stu037 stu047 stu057 stu067 stu077 stu087 stu097
stu008 stu018 stu028 stu038 stu048 stu058 stu068 stu078 stu088 stu098
stu009 stu019 stu029 stu039 stu049 stu059 stu069 stu079 stu089 stu099
stu010 stu020 stu030 stu040 stu050 stu060 stu070 stu080 stu090 stu100
4.推送到服务器端
根据: https://www.samba.org/ftp/rsync/rsync.html
SYNOPSIS
Local: rsync [OPTION...] SRC... [DEST] Access via remote shell: Pull: rsync [OPTION...] [[email protected]]HOST:SRC... [DEST] Push: rsync [OPTION...] SRC... [[email protected]]HOST:DEST Access via rsync daemon: Pull: rsync [OPTION...] [[email protected]]HOST::SRC... [DEST] rsync [OPTION...] rsync://[[email protected]]HOST[:PORT]/SRC... [DEST] Push: rsync [OPTION...] SRC... [[email protected]]HOST::DEST rsync [OPTION...] SRC... rsync://[[email protected]]HOST[:PORT]/DEST
[[email protected] ~]# rsync -avz /backup/ [email protected]::backup/ --password-file=/etc/rsync.password
rsync客户端
1.生成连接服务器需要的密码文件
echo "oldboy" >/etc/rsync.password
cat /etc/rsync.password
2.为密码文件配置权限
chmod 600 /etc/rsync.password
ls -l /etc/rsync.password
3.同步文件
推送:
rsync -avz /tmp/ [email protected]::oldboy --password-file=/etc/rsync.password
rsync -avz /tmp rsync://[email protected]/backup/ --password-file=/etc/rsync.password
拉取:
rsync -avz [email protected]::oldboy /tmp/ --password-file=/etc/rsync.password
rsync -avz rsync://[email protected]/backup/ /tmp --password-file=/etc/rsync.password
提示:上述backup为模块名,不是路径
本文出自 “sandshell” 博客,请务必保留此出处http://sandshell.blog.51cto.com/9055959/1953172
以上是关于搭建backup服务器rsyncdaemon服务模式之二rsync客户端配置的主要内容,如果未能解决你的问题,请参考以下文章
linux---集群架构初探搭建backup服务器之rsync