您好,登錄后才能下訂單哦!
公司有需要做線上設備的主備數據實時同步,其中有些注意事項,詳細信息如下:
http://qiuyt.blog.51cto.com/1229789/1742977
1,Rsync:873
2,注意需要關閉iptables
3,實時查看sersync進程及rsync進程 是否正常運行
4,使用Sersync自動同步之前 使用rsync手動同步測試
5,rsync version 3.0.6 system:Centos 2.6.32-279.el6.x86_64
6,Master:192.168.1.202 ,Slave:192.168.1.206
1,檢測系統環境是否支持
[root@Nagios inotify-tools-3.14]# uname -m x86_64 [root@Nagios inotify-tools-3.14]# uname -r 2.6.32-279.el6.x86_64
一、RSYNC Client Configuration
2,創建rsyncd.conf 配置文件,如果存在需要CP進行備份。
sync server #created by qyt 20160218 #rsyncd.conf start# uid = root gid = root user chroot = no max connections = 2000 timeout = 600 pod file = /var/run/rsyncd.pid lock file = /var/run/rsync.lock log file = /var/log/rsyncd.log ignore errors read only = false list = false hosts allow = 192.168.1.202/24 hosts deny = 0.0.0.0/32 auth users = rsync_backup secrets file = /etc/rsync.password ############################################### [cfgs] comment = www by qyt 20160218 path = /usr/local/nagios/etc/cfgs #################################################3 [objects] comment = bbs by qyt 20160218 path = /usr/local/nagios/etc/objects #################################################3 EOF
3,創建相關待同步目錄
mkdir -p /data0/www/bbs/ /data0/www/www/ /data0/www/blog/
(同時創建多個目錄,也就是需要同步的目錄,如果目錄存在請忽略)
推送用戶要有對被同步目錄的寫入更新的權限
3,認證
配置Password ,自行定義,[[ 但需要與/etc/rsyncd.conf 配置文件中secrets= * 定義內容相同 ]]
echo "rsync_backup:123" > /etc/rsync.password chmod 600 /etc/rsync.password #for check cat /etc/rsync.password ll /etc/rsync.password
4,配置好后,使用如下命令,開啟rsync守護進程
rsync --daemon ps -ef|grep rsync netstat -lnt|grep 873 lsof -i :873
[root@Nagios /etc]$ps -ef|grep rsync root 2048 1 0 17:52 ? 00:00:00 /usr/bin/rsync --daemon root 3544 2237 0 19:24 pts/0 00:00:00 grep rsync [root@Nagios /etc]$netstat -lnt|grep 873 tcp 0 0 0.0.0.0:873 0.0.0.0:* LISTEN tcp 0 0 :::873 :::*
5,設置開機自啟動
echo "##rsync service daemon by qyt 20160218" >>/etc/rc.local echo "/usr/local/bin/rsync--daemon" >>/etc/rc.local grep daemon /etc/rc.local
6,重啟服務
pkill rsync rsync --daemon ps -ef|grep rsync
二、Rsync Master Configuration
1,手動測試同步rsync(測試之前停掉防火墻 否則會引起失敗)
2,在Master上配置rsync權限,只需要配置密碼就OK了。
echo "123" > /etc/rsync.password chmod 600 /etc/rsync.password #for check cat /etc/rsync.password ll /etc/rsync.password
3,創建測試文件
touch /usr/local/nagios/etc/cfgs/cfgs.log /usr/local/nagios/etc/objects/objects.log
tree /usr/local/nagios/etc/ ├── cfgs │ ├── cfgs.log ├── objects │ ├── objects.log
3,執行同步,手動執行
rsync -avzP /usr/local/nagios/etc/cfgs/ rsync_backup@192.168.1.206::cfgs/ --password-file=/etc/rsync.password
rsync -avzP /usr/local/nagios/etc/objects/ rsync_backup@192.168.1.206::objects/ --password-file=/etc/rsync.password
[root@Nagios etc]# rsync -avzP /usr/local/nagios/etc/cfgs/ rsync_backup@192.168.1.206::cfgs/ --password-file=/etc/rsync.password sending incremental file list ./ cfgs.log 0 100% 0.00kB/s 0:00:00 (xfer#1, to-check=4/11) sent 312 bytes received 30 bytes 684.00 bytes/sec total size is 87568 speedup is 256.05
4,然后去backup server(nagios02)上去驗證,是否有同步過去的文件
[root@Nagios02 /usr/local/nagios/etc]$tree ├── cfgs │ ├── cfgs.log ├── objects │ ├── objects.log 成功
三、Sersync Configuration
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。