rsync同步备份
一、服务器端、备份客户端安装 rsync 服务。
1、环境:
CentOS
主 IP:172.16.3.18
备 IP:172.16.3.19
2、安装 rsync 软件
#yum install rsync -y
3、iptables 开放 873 端口
#iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport -j ACCEPT
#service iptables save
#service iptables restart
二、server 服务端操作
IP: 172.16.3.18
1、需要备份的文件
web、service1、service2
2、rsync 配置文件示例(默认没有、需要收到创建)
# cat /etc/rsyncd.conf
uid = root
gid = root
use chroot = no
max connections =
timeout =
strict modes = yes
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
hosts allow = 172.16.3.18
# hosts deny = *
list = false
auth users = user
# rsync同步使用的账户
secrets file = /etc/user.passwd
# 需要手动创建密码文件 [web]
path = /home/web/
ignore errors
read only = no
write only = no [service1]
path = /opt/service1/
ignore errors
read only = no
write only = no [service2]
path = /opt/service2/
ignore errors
read only = no
write only = no
3、密码文件 /etc/user.passwd , (默认没有、需要收到创建)
# cat /etc/user.passwd
user:passwd
# 格式 用户:密码
4、启动默认守护进行:
#/usr/bin/rsync --daemon
5、检测进程
#ps -ef |grep rsync
#netstat -ano |grep
二、客户端 bak 设置操作
备 IP:172.16.3.19
1.创建密码文件 /etc/user.passwd , 只写密码就可以。 (默认没有、需要收到创建)
#cat /etc/user.passwd
passwd
# 格式 密码
2、服务的目录 同步 到备机 bak 上:
1、备机 bak 同步服务端上的web
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/user.passwd salt@172.16.3.18::service /opt/bak/web/
2、bak 同步 service1 服务
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/user.passwd salt@172.16.3.18::service1 /opt/bak/service1/
3、bak 同步 service2 服务
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/user.passwd salt@172.16.3.18::service2 /opt/bak/service2/
# 注意 被同步的bak目录 在后,如果在前就是备的同步主的了。
# 备机本地的 bak 同步到服务端;
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/user.passwd /opt/bak/web salt@172.16.3.18::web
三、 设置定时备份
1、同步脚本
# vi /opt/script/rsync-user.sh
/usr/bin/rsync -vzrtopg --delete --progress --password-file=/etc/user.passwd salt@172.16.3.18::service /opt/bak/web
2、定时同步(每周日零点进行同步)
crontab -e
0 0 * * 0 /opt/script/rsync-user.sh > /opt/script/rsync-user.txt
rsync同步备份的更多相关文章
- wordpress利用rsync同步备份
我搭建的wordpress服务器现在使用的系统是opensuse, 服务器上面已做脚本和计划任务将wordpress使用的数据库与web目录每天压缩备份放到 /data/backup目录下 opera ...
- rsync同步备份搭建
Rsync 是 Unix/Linux 下的一款应用软 在平常的运维中进常要对一些数据进行备份,以防止意外的服务器故障导致不可避免的后果,tar,cp只能适应一些小范围backup,对于几T甚至几P的数 ...
- rsync数据同步备份
一.rsync简介 (1)rsync是什么? rsync是一款开源的.快速的.多功能的.可实现全量及增量的本地或远程数据同步备份的优秀工具. (2)rsync作用比较 远程拷贝:有点类似ssh的scp ...
- 如何通过rsync+sersync 实现同步备份
3.rsync+sersync更快更节约资源实现web数据同步4.unison+inotify实现web数据双向同步 一:为什么要实现同步备份 服务器上有些重要文件或数据时,可以把他们多备份一份到其他 ...
- Rsync + sersync 实时同步备份
一 Rsync + Sersync 实时同步介绍 1.Rsync 服务搭建介绍 云机上搭建Rsync server,在本地搭建Rsync Clinet. 2. Sersync 服务搭建介绍 ...
- 搭建中小规模集群之rsync数据同步备份
NFS重要问题 1.有关NFS客户端普通用户写NFS的问题. 1)为什么要普通用户写NFS. 2)exports加all_squash. Rsync介绍 什么是Rsync? Rsync是一款开源的.快 ...
- CentOS 6.5 rsync+inotify实现数据实时同步备份
CentOS 6.5 rsync+inotify实现数据实时同步备份 rsync remote sync 远程同步,同步是把数据从缓冲区同步到磁盘上去的.数据在内存缓存区完成之后还没有写入到磁盘 ...
- Linux下简单粗暴使用rsync实现文件同步备份【转】
这篇来说说如何安全的备份,还有一点不同的是上一篇是备份服务器拉取数据,这里要讲的是主服务器如何推送数据实现备份. 一.备份服务器配置rsync文件 vim /etc/rsyncd.conf #工作中指 ...
- 同步备份工具之 rsync
1.常用同步方法 SCP. NFS. SFTP. http. samba. rsync. drbd(基于文件系统同步,效率高) 2.rsync 介绍 rsync,英文全称是 remote synchr ...
随机推荐
- c#异步方法调用
var t1 = new Task(() => GkeyTest()); DisplaylistboxMSG("初始化:" + t1.Status.ToString()); ...
- Ubuntu系统下容器化部署gitlab
容器化部署gitlab 获取镜像文件 1. 下载镜像文件 docker pull beginor/gitlab-ce:-ce. 2. 创建GitLab 的配置 (etc) . 日志 (log) .数据 ...
- Python - 实现矩阵转置
有个朋友提出了一个问题:手头上现在有一个二维列表,比如[[1, 2, 3], [4, 5, 6], [7, 8, 9], [10, 11, 12]],现在要把该二维列表变成为[[1, 4, 7, 10 ...
- js学习之存储
一.Cookie和Session的区别 1.cookie数据存放在客户的浏览器上,session数据放在服务器上(一般以内存.数据库.文件形式). 2.session会在一定时间内保存在服务器上.当访 ...
- 27、获取图片验证需要的uuId
export function getUUID() { return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => ...
- 《JavaScript高级程序设计》笔记:附录A ECMAScript Harmony
一般性变化 常量 用const关键字声明常量,声明的变量在初始赋值后,就不能进行修改了,如下代码: const MAX_SIZE = 25; MAX_SIZE = 10; //报错 块级作用域及其他作 ...
- ZooKeeper基础:快速部署
本文主要介绍ZooKeeper的快速部署安装,更多信息请参考ZooKeeper 概述 ZooKeeper是一个分布式的,开放源码的分布式应用程序协调服务,是Google的Chubby一个开源的实现,是 ...
- Sql 语句中 IN 和 EXISTS 的区别
IN 语句:只执行一次 确定给定的值是否与子查询或列表中的值相匹配.in在查询的时候,首先查询子查询的表,然后将内表和外表做一个笛卡尔积,然后按照条件进行筛选.所以相对内表比较小的时候,in的速度较快 ...
- c#: 剪切板监视实现
CR TubeGet中有用户需要剪切板监视功能,记录代码以做备忘: using System; using System.Runtime.InteropServices; using System.W ...
- H3C CSMA/CA