5、查看设置的远程服务器端是否正常保存
[root@puppetserver bucket]# ll/var/lib/puppet/bucket/#默认保存路径
total 12
drwxrwx---. 4 puppet puppet 4096 Jul 2417:56 0
drwxrwx---. 3 puppet puppet 4096 Jul 2417:46 e
drwxrwx---. 3 puppet puppet 4096 Jul 2417:48 f
[root@puppetserver bucket]# tree f/
f/
└── e
└── f
└── 7
└── 3
└── d
└── 9
└── 6
└──fef73d96a75424c782191962f5aaf8ee
├── contents
└── paths
8 directories, 2 files
结果:保存成功,保存结果为以上目录结构
6、只恢复某一个节点到上一个版本
[root@agent1 modules]# puppet filebucketrestore /etc/my.cnffef73d96a75424c782191962f5aaf8ee#节点上操作
7、通过调试模式查看节点动态信息
[root@agent1 ssh]# puppet agent--server=puppetserver.bsgchina.com --verbose --no-daemonize
info: Retrieving plugin
info: Loading facts in/var/lib/puppet/lib/facter/backup_date.rb
info: Caching catalog for agent1.bsgchina.com
info: Applying configuration version'1374659257'
info: /File[/etc/my.cnf]: Filebucketed/etc/my.cnf to main with sum fef73d96a75424c782191962f5aaf8ee
notice: /File[/etc/my.cnf]/content: contentchanged '{md5}fef73d96a75424c782191962f5aaf8ee'to '{md5}09fb95f5505056b5a40c4905af3d636e'
info: /File[/etc/my.cnf]: Schedulingrefresh of Class[Mysql::Service]
info: Class[Mysql::Service]: Schedulingrefresh of Service[mysqld]
notice:/Stage[main]/Mysql::Service/Service[mysqld]: Triggered 'refresh' from 1 events
notice: Finished catalog run in 3.65seconds
结果:可正常恢复到上一个版本(由于我这里设置了5秒钟同步puppetserver端,可以看到以上my.cnf被修改过,而且MD5值与上一版本吻合)
8、恢复所有节点到上一个版本
[root@puppetserver etc]# puppet filebucketrestore --local/etc/puppet/modules/mysql/files/etc/my.cnffef73d96a75424c782191962f5aaf8ee
9、通过调试模式查看节点动态信息
[root@agent1 ssh]# puppet agent--server=puppetserver.bsgchina.com --verbose --no-daemonize
notice: Starting Puppet client version2.7.21
info: Retrieving plugin
info: Loading facts in /var/lib/puppet/lib/facter/backup_date.rb
info: Caching catalog foragent1.bsgchina.com
info: Applying configuration version'1374659257'
info: /File[/etc/my.cnf]: Filebucketed/etc/my.cnf to main with sum 09fb95f5505056b5a40c4905af3d636e
notice: /File[/etc/my.cnf]/content: contentchanged '{md5}09fb95f5505056b5a40c4905af3d636e' to '{md5}fef73d96a75424c782191962f5aaf8ee'
info: /File[/etc/my.cnf]: Schedulingrefresh of Class[Mysql::Service]
info: Class[Mysql::Service]: Schedulingrefresh of Service[mysqld]
结果:节点配置文件的MD5值更新为上一个版本的MD5值,恢复成功。
备份方案三、通过本地MD5文件进行备份恢复
[root@agent1 modules]# ll/var/lib/puppet/clientbucket/
total 40
drwxrwx--- 3 root root 4096 Jul 24 10:51 3
drwxrwx--- 3 root root 4096 Jul 22 14:55 7
drwxrwx--- 3 root root 4096 Jul 24 15:31 8
drwxrwx--- 4 root root 4096 Jul 24 10:52 e
drwxrwx--- 3 root root 4096 Jul 22 15:10 f
备份方案三为备份方案二的一部分,实验过程略。