发布于 2015-05-01 02:58:00 | 284 次阅读 | 评论: 0 | 来源: 网友投递
Puppet 集中配置管理系统
puppet是一种Linux、Unix、windows平台的集中配置管理系统,使用自有的puppet描述语言,可管理配置文件、用户、cron任务、软件包、系统服务等。puppet把这些系统实体称之为资源,puppet的设计目标是简化对这些资源的管理以及妥善处理资源间的依赖关系。
DashBoard是puppet的控制台,用于显示puppet master和puppet agent的相关信息。本文以默认的WEBRick提供Web服务。DashBoard 安装在master.test.com。并且在客户端配置文件做如下配置
#vim /etc/puppet/puppet.conf
[agent]
report = true
#rpm -ivh http://yum.puppetlabs.com/el/6Server/products/x86_64/puppetlabs-release-6-6.noarch.rpm
#yum -y install mysql mysql-devel mysql-server ruby ruby-devel ruby-irb ruby-mysql ruby-rdoc ruby-ri rubygems
#gem install rake
#yum install -y puppet-dashboard
1创建数据库
#vim /etc/my.cnf
max_allowed_packet = 32M
#service mysqld start
#chkconfig mysqld on
#mysql
mysql>create database dashboard CHARACTER SET utf8;
mysql>create user ‘dashboard‘@‘localhost‘ IDENTIFIED BY ‘dashboard‘;
mysql>grant all privileges on dashboard.* TO ‘dashboard‘@‘localhost‘;
mysql>flush privileges;
2修改配置文件
#vim /usr/share/puppet-dashboard/config/database.yml
production:
database: dashboard
username: dashboard
password: dashboard
encoding: utf8
adapter: mysql
#vim /usr/share/puppet-dashboard/config/settings.yml
time_zone: ‘Asia/Shanghai‘
3导入数据库,启动服务
#cd /usr/share/puppet-dashboard/config
#rake RAILS_ENV=production db:migrate
#service puppet-dashboard start
#chkconfig puppet-dashboard on
#rake RAILS_ENV=production db:raw:optimize #优化数据库
4导入现有报告
#cd /usr/share/puppet-dashboard
#rake RAILS_ENV=production reports:import
5配置实时发送报告
#vim /etc/puppet/puppet.conf
reports = store,tagmail,log,puppet_dashboard,http
reporturl = http://172.16.30.220:3000/reports
6开启报告
#rake RAILS_ENV=production jobs:work 2 &>1 &
7访问dashboard
http://172.16.30.220:3000/reports
1当puppet dashboard数据量过多的时候,需要优化数据库,可使用命令:
#rake RAILS_ENV=production db:raw:optimize
2清理dashborad一个月之前的数据:
#rake RAILS_ENV=production reports:prune upto=1 unit=mon
3备份puppet dashborad数据库:
#rake RAILS_ENV=production FILE=/my/backup/file.sql db:raw:dump
4恢复数据:
#rake RAILS_ENV=production FILE=production.sql db:raw:restore