トップ «前の日記(2018年07月29日) 最新 次の日記(2018年09月01日)» 編集

Masa's blog

検索キーワード:

2018年08月12日 How to configure for rsync deamon [長年日記]

_ How to configure for rsync deamon

I'm going to get backup 192.168.0.26 from 192.168.0.100 :)

/etc/rsyncd.conf in 192.168.0.26

uid = root
gid = root
[root_partition]
        comment = root partition of my client-pc
        path = /
        read only = true
        hosts allow = 192.168.0.100
        hosts deny = *

Run rsync with daemon mode in 192.168.0.26

/etc/rc.d/rc.local

if [ -x /usr/bin/rsync ]
then
        /usr/bin/rsync --daemon --config=/etc/rsyncd.conf
fi

Backup command in 192.168.0.100

rsync -a --delete -v                            \
        --exclude "/proc/"                      \
        --exclude "/sys/"                       \
        --exclude "/dev/shm/"                   \
        --exclude "/run/"                       \
        rsync://192.168.0.26/root_partition     \
        /backup_dir_for_192.168.0.26

_ Tips about binlog of MySQL

/etc/my.cnf

[mysqld]
default-storage-engine=innodb
log-bin=mysql-bin
expire_logs_days = 5

Backup

$ mysqldump -u root -p password --all-databases >backup.dump

Restore from backup

$ mysql -u root -p password <backup.dump

And restore from binlog

$ mysqlbinlog --start-datetime="2018-08-12 08:45:00" --stop-datetime="2018-08-12 17:15:00" /var/lib/mysql/mysql-bin.XXXXXX | mysql -u root -p password