MySQL定时增量备份rsync+crontab(企业实战)

一、架构说明
为了防止企业MySQL坏掉导致数据丢失,衍生出此结构

二、环境准备
两台centos7
192.168.59.143(需要备份的服务器)
192.168.59.144(备份存储服务器)

三、两台安装rsync服务

yum -y install rsync

四、修改需要备份的服务器rsync的配置文件(192.168.59.143)

vim /etc/rsyncd.conf

添加如下配置
uid = root
gid = root
use chroot = no
max connections = 2
pid file = /var/run/rsyncd.pid
lock file = /var/run/rsync.lock
log file = /var/log/rsyncd.log
[app]           #模块
path = /data/   #备份路径
ignore errors
read only = false
list = false
auth users = backup
secrets file = /etc/rsync.passwd

在这里插入图片描述
编辑密码文件并赋予权限(两台都要做)

echo "rsync_user:rsync_user_pwd" > /etc/rsync.password
chmod -R 600 /etc/rsync.password

五、启动rsync
1.解决报错不启动

yum -y install xinetd
vim  /etc/xinetd.d/rsync

service rsync
{
disable = no
flags = IPv6
socket_type = stream
wait = no
user = root
server = /usr/bin/rsync
server_args = --daemon
log_on_failure += USERID
}
systemctl restart xinetd

六、编写任务计划

crontab -e

将以下命令写入脚本

/usr/bin/rsync -vzrtopg  --progress --password-file=/etc/rsync.passwd backup@192.168.59.143::app /data/

七、写增量脚本

  • 7
    点赞
  • 19
    收藏
    觉得还不错? 一键收藏
  • 10
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 10
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值