使用 Rsync + Inotify 实现双机文件热备份
Inotify 是一种强大的、细粒度的、异步的文件系统事件监控机制,linux内核从2.6.13起,加入了Inotify支持,通过Inotify可以监控文件系统中添加、删除,修改、移动等各种细微事件,利用这个内核接口,第三方软件就可以监控文件系统下文件的各种变化情况,而inotify-tools就是这样的一个第三方软件。与传统的cp、tar备份方式相比,rsync具有安全性高、备份迅速、支持增量备份等优点,通过rsync可以解决对实时性要求不高的数据备份需求,例如定期的备份文件服务器数据到远端服务器,对本地磁盘定期做数据镜像等。以上全是从网上抄来的,个人比较喜欢 Keepalived + DRBD
大致流程
主服务器
- 安装 Rsync 和 Inotify-tools
- 配置
/etc/rsyncd.secrects
- 配置
/usr/bin/inotify2rsync
- 将启动备份的执行脚本添加到开机加载文件中
- 创建同步目录并赋予权限
从服务器
- 安装 Rsync 进行同步
- 创建
/etc/rsyncd.conf
文件副本 - 配置
/etc/default/rsync
- 配置
/etc/rsyncd.secrects
- 配置
/etc/rsyncd.conf
- 启动 Rsync
Games A card sport in which the item is to accumulate cards with a better count than that of the supplier however not exceeding 21. What additionally makes blackjack popular is its social aspect. The selections of different players at the desk won't impact your hand. You're playing in} alone towards the supplier, Scoblete says, and do not know|they don't know} what may 1xbet korea have} and vice versa.
回复删除