linux 同步备份 rsyncd 相关设置
17:25 2013/10/18------------------ rsync linux 同步备份服务器 配置
vi /etc/rsyncd.conf 配置文件
/usr/bin/rsync --daemon 守护进程方式 启动
lsof -i:873 查看启动进程
iptables -A INPUT -p tcp --dport 873 -j ACCEPT 开启防火墙
rsync 配置文件
#pid file = /usr/local/rsync/rsyncd.pid #运行进程的ID写到哪里 原文中有的,我没有使,日志文件
#模块选项
[test] # 这里是认证的模块名,在client端需要指定
max connections = 5 #客户端最大连接数,默认0(没限制)
uid = root #指定该模块传输文件时守护进程应该具有的uid
gid = root #指定该模块传输文件时守护进程应该具有的gid
path = /var/www # 需要做备份的目录
ignore errors # 可以忽略一些无关的IO错误
read only = no #no客户端可上传文件,yes只读
write only = no #no客户端可下载文件,yes不能下载
hosts allow = * #充许任何主机连接
hosts deny = 10.5.3.77 #禁止指定的主机连接
auth users = root # 认证的用户名,如果没有这行,则表明是匿名
secrets file = /etc/rsync.pass # 指定认证口令文件位置
----
/usr/bin/rsync -vzrtopg --delete --progress root@192.168.1.107::test /ranmufei/
参考
http://www.iteye.com/topic/604436
http://blog.sina.com.cn/s/blog_5eda2dda01015fcs.html
测试通过的配置 用普通用户操作 默认服务器已经安装了 软件 centos 6.4 默认已经安装
1 服务器端的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 = /var/www
comment = Mirror to Hk server
read only = true
list = false
auth users = freefei
[test]
path = /var/www
read only = false
auth users = freefei
secrets file = /etc/rsyncd.secrets
2 服务器端 创建密码文件
vim /etc/rsyncd.secrets
格式 为 freefei:123456
3 客户端
客户端只需要配置密码文件即可
vim /etc/rsync.pass
注意这里的密码 格式为 123456 (只有密码 没有用户名 和服务器端不同)
4 备份文件夹
备份test模块下的文件同步到 客户端 的“/ranmufei” 文件夹下
/usr/bin/rsync -vzrtopg --delete --progress freefei@192.168.1.107::test /ranmufei --password-file=/etc/rsync.pass
5 rsync 开机启动
vi /etc/rc.local
加上
/usr/bin/rsync --daemon --config=/etc/rsyncd.conf
6 设置自动备份(定时备份 )
自动备份有两种方式 1 一种是用 系统的定时任务 定时执行 同步命令。
crontab 定时命令
*/1 * * * * /usr/bin/rsync -vzrtopg --delete --progress freefei@192.168.1.107::test /ranmufei --password-file=/etc/rsync.pass
每天上午9点20执行rysnc备份任务:
20 9 * * * /usr/bin/rsync -vzrtopg --delete --progress freefei@192.168.1.107::test /ranmufei --password-file=/etc/rsync.pass
2 另外一种是吧要执行的任务写到shell中 等待执行
7 机器防火墙设置 rsync
防火墙问题处理
(1) 修改防火墙文件 vi /etc/sysconfig/iptables
删除全部 重新添加上
# Firewall configuration written by system-config-firewall
# Manual customization of this file is not recommended.
*filter
:INPUT DROP [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -p tcp -m tcp --dport 8080 -j ACCEPT
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -p icmp -j ACCEPT
-A INPUT -i lo -j ACCEPT
#ssh
-A INPUT -m state --state NEW -m tcp -p tcp --dport 22 -j ACCEPT
#http
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
#mysql
-A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT
#rsync
-A INPUT -m state --state NEW -m tcp -p tcp --dport 873 -j ACCEPT
-A INPUT -j REJECT --reject-with icmp-host-prohibited
-A FORWARD -j REJECT --reject-with icmp-host-prohibited
COMMIT
保存 重启
注意 两台服务器都要这样弄
开启:service iptables start
关闭:service iptables stop
http://wenku.baidu.com/view/c326120f844769eae009edfc.html
http://blog.csdn.net/tsuliuchao/article/details/4742796
数据库备份
注意 wdlinux 一键安装包 要开启管理面板 切记要在防火墙里面 加上 8080端口开启
linux 同步备份 rsyncd 相关设置的更多相关文章
- Linux Rsync实现文件同步备份(转载)
原文地址:Linux Rsync实现文件同步备份作者:夷北 转自:http://www.mike.org.cn/blog/index.php?load=read&id=639###pp=0 [ ...
- linux定时备份mysql并同步到其它服务器
数据在任何一家公司里面都是最核心的资产,定期备份则是为了保证数据库出现问题的时候能够及时回滚到最近的备份点,将损失缩小到最小 这篇文章将会两部分来说明:1.mysql的定期备份:2.同步到其它服务器 ...
- linux定时备份mysql数据并同步到其他服务器
(备份还原操作) ###导出数据库 /usr/bin/mysqldump -u root -pwd database > database20180808.sql ###导入数据库 mysql ...
- Linux下简单粗暴使用rsync实现文件同步备份【转】
这篇来说说如何安全的备份,还有一点不同的是上一篇是备份服务器拉取数据,这里要讲的是主服务器如何推送数据实现备份. 一.备份服务器配置rsync文件 vim /etc/rsyncd.conf #工作中指 ...
- rsync从linux到linux的文件同步备份
rsync从linux到linux的文件同步备份 一.环境 需要备份文件的服务器(服务器端):192.168.1.201 (RHEL 5) 接收备份文件的服务器(客户端):192.168.1.202 ...
- Linux下实现Rsync目录同步备份
需求:对于开发机器做目录的数据备份 测试机IP:192.168.1.100 WEB目录:/bckup/ 下面我将用一台机器来备份上面测试机 /bckup下的所有数据,并实现时时同步 备份机器IP: ...
- Linux 之 网络相关设置
网络相关设置 参考教程:[千峰教育] 命令: ping: 作用:通常用于检测网络设备的连通性. 格式:ping IP/域名 选项:-c,指定方式测试数据包的次数 实例:ping www.baidu.c ...
- python 之调用Linux shell命令及相关高级应用
最近根据老大要求,将数据进行同步备份,结合第三方提供的工具.第三方服务其实是有python demo的,本想研究下实际的python sdk搞个demo开发的,但是发现有些组建装起来确实头大,而且本公 ...
- CentOS 6.5 rsync+inotify实现数据实时同步备份
CentOS 6.5 rsync+inotify实现数据实时同步备份 rsync remote sync 远程同步,同步是把数据从缓冲区同步到磁盘上去的.数据在内存缓存区完成之后还没有写入到磁盘 ...
随机推荐
- 移动端下拉刷新、加载更多插件dropload.js(基于jQuery/Zepto)
移动端下拉刷新.加载更多插件dropload.js(基于jQuery/Zepto) 原文:http://www.grycheng.com/?p=1869 废话不多说,先让大家看一下案例效果: DEMO ...
- Bridage
对于有两个以上的维度的对象,如下图:这张图的业务逻辑是这样的,Hayes,USR以及Emie都是上网的猫,现在有两条线路,一条是传统Dial,还有一条线路是专线,不需要拨号,这样每创建一种线路就意味着 ...
- scrollView and tableView
As we all know, tableView is the subclass of scrollView, tableView has every properties that scroll ...
- HDU 2993 MAX Average Problem dp斜率优化
MAX Average Problem Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Othe ...
- Qt写的截图软件包含源代码和可执行程序
http://blog.yundiantech.com/?log=blog&id=14 Qt写的截图软件包含源代码和可执行程序 http://download.csdn.net/downloa ...
- Zlib压缩算法在Java与Delphi间交互实现(压缩XML交互)
一个典型应用中,使用delphi作为客户端,J2EE服务端,两者之间用XML作为数据交换,为了提高效率,对XML数据进行压缩,为此需要找到一种压缩/解压算法能够两个平台之间交互处理,使用ZLIB算法就 ...
- 14.6.1 InnoDB Startup Configuration 启动配置
14.6.1 InnoDB Startup Configuration 启动配置 首先描述关于InnoDB 配置设计数据库文件,日志文件,page size 和内存buffer 的配置. 推荐你定义数 ...
- 重构第四天 : 用多态替换条件语句(if else & switch)
面相对象的一个核心基础就是多态,当你要根据对象类型的不同要做不同的操作的时候,一个好的办法就是采用多态,把算法封装到子类当中去. 重构前代码: public abstract class Custom ...
- java学习面向对象之接口
上一节当中我们说道抽象类,抽象类当中的方法可以是抽象的也可以是非抽象的,那么当抽象类中所有方法都是抽象的时候,我们就可以把它重新定义为接口.代码示例: abstract class Animal { ...
- POI做题记录:第二届POI
Trees Memory limit: 32 MB Trees occur very often in computer science. As opposed to trees in nature, ...