centos 6.5 rsync同步迁移
来源:互联网 发布:php 计算数组长度 编辑:程序博客网 时间:2024/06/16 10:54
Rsync 版本
rsync version 3.0.6 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: 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, no 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.
服务器同步任务需求
服务器A与服务器B同步备份,这里只说明服务器A同步到服务器B,服务器B还原到服务器A。
考虑安全因素,使用普通用户进行同步。
使用cronjob,定时同步。
错误提示
错误发生在rsync 3.0.6版本,64位 CentOS5.5 系统。
首页这篇文章主要解决的错误是以下:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
*** 是你/etc/rsyncd.conf 中配置的模块,我这里用
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
uid = nobody
gid = nobody
max connections = 4
read only = true
#hosts allow = 202.207.177.180
hosts allow = *
transfer logging = true
log format = %h %o %f %l %b
log file = /var/log/rsyncd.log
slp refresh = 300
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
[root@mail video]# ps -ef | grep rsync
root 27284 1 0 10:26 ? 00:00:00 rsync –daemon –config=/etc/rsyncd.conf
root 30516 29986 0 18:35 pts/3 00:00:00 grep rsync
[root@mail video]# kill -9 27284
[root@mail video]# rsync –daemon –config=/etc/rsyncd.conf
一般错误都会发生在服务器B,注意这部分的讲解!
通过CentOS yum install rsync,安装rsync服务。
在rsync安装之后,运行以下指令同步备份:
地址rsync://lixiphp@203.171.237.245/test,lixiphp为服务器A用户,203.171.237.245服务器A IP地址或者域名 test为服务器A配置模块
密码存放在/home/admin/admin_backups/password.rsync,这里存放位置,可自由安排。
password.rsync内容格式为: password
设置权限为只读:
解决错误
用户密码错误
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
检查服务器A存储密码文件和服务器B密码文件。
服务器A密码文件 /etc/rsyncd.secrets 格式为: username:password
服务器B密码文件 password.rsync 格式为:password
文件权限错误
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
检查服务器A存储密码文件和服务器B密码文件。
服务器A密码文件 /etc/rsyncd.secrets 权限为600: chmod 600 /etc/rsyncd.secrets
服务器B密码文件 password.rsync 权限为600:chmod 600 password.rsync
定时任务
内容如下:
#/bin/sh
rsync -vzrtopg –progress –delete –password-file=/home/admin/admin_backups/password.rsync rsync://lixiphp@203.171.237.245/test /home/admin/admin_backups/test
添加定时任务:
添加以下内容:
每个一分钟从服务器A同步到服务器B!
服务器B向下备份到服务器A
请确保服务器A同步用户lixiphp,对模块test所在目录有读、写、执行的权限。
yum install -y rsync
[root@mail video]# rsync –versionrsync version 3.0.6 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: 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, no 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.
服务器同步任务需求
服务器A与服务器B同步备份,这里只说明服务器A同步到服务器B,服务器B还原到服务器A。
考虑安全因素,使用普通用户进行同步。
使用cronjob,定时同步。
错误提示
错误发生在rsync 3.0.6版本,64位 CentOS5.5 系统。
首页这篇文章主要解决的错误是以下:
复制代码代码如下:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
*** 是你/etc/rsyncd.conf 中配置的模块,我这里用
复制代码代码如下:
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
Rsync 配置
#vi /etc/rsyncd.conf
复制代码代码如下:
uid = nobody
gid = nobody
max connections = 4
read only = true
#hosts allow = 202.207.177.180
hosts allow = *
transfer logging = true
log format = %h %o %f %l %b
log file = /var/log/rsyncd.log
slp refresh = 300
log file = /var/log/rsyncd.log
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsyncd.lock
[web]
path = /home/admin/public_html
comment = Mirror to Hk server
read only = true
list = false
auth users = lixiphp
[test]
path = /home/admin/domains/test
read only = false
auth users = lixiphp
secrets file = /etc/rsyncd.secrets
配置普通用户密码
复制代码代码如下:
[root@mail video]# vi /etc/rsyncd.secrets
格式为: username:password
复制代码代码如下:
rsync_user:rsyncofpass
设置权限为只读:
复制代码代码如下:
chmod 600 /etc/rsyncd.secrets
首次启动rsync
复制代码代码如下:
rsync –daemon –config=/etc/rsyncd.conf
如果提示
复制代码代码如下:
failed to create pid file /var/run/rsyncd.pid: File exists
使用指令
rm -rf /var/run/rsyncd.pid
重启已经在运行的rsync
复制代码代码如下:
[root@mail video]# ps -ef | grep rsync
root 27284 1 0 10:26 ? 00:00:00 rsync –daemon –config=/etc/rsyncd.conf
root 30516 29986 0 18:35 pts/3 00:00:00 grep rsync
[root@mail video]# kill -9 27284
[root@mail video]# rsync –daemon –config=/etc/rsyncd.conf
这样服务器A配置成功!
服务器B配置一般错误都会发生在服务器B,注意这部分的讲解!
通过CentOS yum install rsync,安装rsync服务。
在rsync安装之后,运行以下指令同步备份:
复制代码代码如下:
rsync -vzrtopg –progress –delete –password-file=/home/admin/admin_backups/password.rsync rsync://lixiphp@203.171.237.245/test /home/admin/admin_backups/test
地址rsync://lixiphp@203.171.237.245/test,lixiphp为服务器A用户,203.171.237.245服务器A IP地址或者域名 test为服务器A配置模块
密码存放在/home/admin/admin_backups/password.rsync,这里存放位置,可自由安排。
password.rsync内容格式为: password
复制代码代码如下:
rsyncofpass
设置权限为只读:
复制代码代码如下:
chmod 600 /home/admin/admin_backups/password.rsync
解决错误
用户密码错误
复制代码代码如下:
@ERROR: auth failed on module test
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
检查服务器A存储密码文件和服务器B密码文件。
服务器A密码文件 /etc/rsyncd.secrets 格式为: username:password
服务器B密码文件 password.rsync 格式为:password
文件权限错误
复制代码代码如下:
password file must not be other-accessible
continuing without password file
Password:
@ERROR: auth failed on module ***
rsync error: error starting client-server protocol (code 5) at main.c(1503) [receiver=3.0.6]
检查服务器A存储密码文件和服务器B密码文件。
服务器A密码文件 /etc/rsyncd.secrets 权限为600: chmod 600 /etc/rsyncd.secrets
服务器B密码文件 password.rsync 权限为600:chmod 600 password.rsync
定时任务
复制代码代码如下:
[root@hk admin_backups]# vi backup.sh
内容如下:
复制代码代码如下:
#/bin/sh
rsync -vzrtopg –progress –delete –password-file=/home/admin/admin_backups/password.rsync rsync://lixiphp@203.171.237.245/test /home/admin/admin_backups/test
添加定时任务:
复制代码代码如下:
[root@hk admin_backups]# crontab –e
添加以下内容:
复制代码代码如下:
*/1 * * * * /home/admin/admin_backups/backup.sh > /dev/null 2>&1
每个一分钟从服务器A同步到服务器B!
服务器B向下备份到服务器A
复制代码代码如下:
rsync -vzrtopg –progress –delete –password-file=/home/admin/admin_backups/password.rsync /home/admin/admin_backups/test rsync://lixiphp@203.171.237.245/test
请确保服务器A同步用户lixiphp,对模块test所在目录有读、写、执行的权限。
0 0
- centos 6.5 rsync同步迁移
- CentOS 6.5下Rsync远程同步
- CentOS/使用rsync同步
- rsync 同步centos源
- centos rsync同步权限问题
- CentOS rsync文件同步配置
- CentOS 6 rsync 文件同步
- CentOS 6.5 rsync+inotify实现数据实时同步备份
- Centos 6.5 rsync+inotify 两台服务器文件实时同步
- CentOS 6.3 Rsync文件同步
- centos搭建rsync远程同步服务器
- CentOS系统rsync文件同步安装配置
- centos 通过rsync实现远程文件同步
- Centos 7系统rsync远程同步
- rsync同步
- rsync 同步
- rsync同步
- rsync同步
- *(leetcode) Binary Tree Inorder Traversal
- HDU5031
- java进阶之字符串替换的思考
- 重新签名apk文件(手工用命令行)
- 基础入门:关于java数组的深度思考
- centos 6.5 rsync同步迁移
- epoll
- 组合数学中 序数法生成一个序列
- 当前Java软件开发中几种认识误区
- Eclipse Preferences 配置
- 三色球排序的问题,相同的球放到一起,让你按顺序输出红白蓝三种颜色的球,可以用012来表示,要求只能扫描一次数组
- 聚易付安卓版服务评测
- MFC 中 有关去除字符串中包含的所有回车符和换行符的有关问题
- 手机文件无法读取怎么恢复