5.在服务端安装puppet的dashboard
安装mysql
1 /* ---示例代码----*/
2
3
4 [root@master ~]# yum install -y mysql mysql-devel mysql-server
5
6 =======================省略线==================================================
7
8 Installed:
9
10 mysql.x86_64 0:5.1.73-3.el6_5 mysql-devel.x86_64 0:5.1.73-3.el6_5
11
12 mysql-server.x86_64 0:5.1.73-3.el6_5
13
14 Dependency Installed:
15
16 keyutils-libs-devel.x86_64 0:1.4-5.el6
17
18 krb5-devel.x86_64 0:1.10.3-33.el6
19
20 libcom_err-devel.x86_64 0:1.41.12-21.el6
21
22 libselinux-devel.x86_64 0:2.0.94-5.8.el6
23
24 libsepol-devel.x86_64 0:2.0.41-4.el6
25
26 openssl-devel.x86_64 0:1.0.1e-30.el6_6.4
27
28 perl-DBD-MySQL.x86_64 0:4.013-3.el6
29
30 perl-DBI.x86_64 0:1.609-4.el6
31
32 zlib-devel.x86_64 0:1.2.3-29.el6
33
34 Complete!
35
36 [root@master ~]#
37
38 /* ---示例代码----*/
优化mysql设置
编辑 /etc/my.cnf, 在[mysqld]字段,增加最后一行
1 /* ---示例代码----*/
2
3
4 [root@master ~]# vim /etc/my.cnf
5
6 /* ---示例代码----*/
启动Mysql服务
1 /* ---示例代码----*/
2
3
4 [root@master ~]# service mysqld start
5
6 [root@master ~]# chkconfig mysqld on
7
8 [root@master ~]# chkconfig --list |grep mysqld
9
10 mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
11
12 /* ---示例代码----*/
设置mysql密码,我这里使用是密码是123456
1 /* ---示例代码----*/
2
3
4 [root@master ~]# mysqladmin -u root password ‘123456‘
5
6 /* ---示例代码----*/
创建一个dashboard数据库
1 /* ---示例代码----*/
2
3
4 [root@master ~]# mysql -uroot -p123456 <<EOF
5
6 > CREATE DATABASE dashboard CHARACTER SET utf8;
7
8 > CREATE USER ‘dashboard‘@‘localhost‘ IDENTIFIED BY ‘123456‘;
9
10 > GRANT ALL PRIVILEGES ON dashboard.* TO ‘dashboard‘@‘localhost‘;
11
12 > FLUSH PRIVILEGES;
13
14 > EOF
15
16 [root@master ~]#
17
18 /* ---示例代码----*/
Passenger+Apache+Dashboard
这是让Apache支持ruby,由于Passenger不在centos官方源里,因此要添加epel的源
1 /* ---示例代码----*/
2
3
4 [root@master ~]# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
5
6 --2014-12-29 19:58:20-- http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
7
8 Resolving dl.fedoraproject.org... 209.132.181.25, 209.132.181.23, 209.132.181.26, ...
9
10 Connecting to dl.fedoraproject.org|209.132.181.25|:80... connected.
11
12 HTTP request sent, awaiting response... 200 OK
13
14 Length: 14540 (14K) [application/x-rpm]
15
16 Saving to: “epel-release-6-8.noarch.rpm”
17
18 100%[======================================>] 14,540 4.59K/s in 3.1s
19
20 2014-12-29 19:58:26 (4.59 KB/s) - “epel-release-6-8.noarch.rpm” saved [14540/14540]
21
22 [root@master ~]# rpm -ivh epel-release-6-8.noarch.rpm
23
24 warning: epel-release-6-8.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEY
25
26 Preparing... ########################################### [100%]
27
28 1:epel-release ########################################### [100%]
29
30 [root@master ~]# yum install mod_passenger puppet-dashboard
31
32 /* ---示例代码----*/
配置Dashboard
1 /* ---示例代码----*/
2
3
4 [root@master ~]# vim /usr/share/puppet-dashboard/config/database.yml
5
6 /* ---示例代码----*/
修改时区
1 /* ---示例代码----*/
2
3
4 [root@master ~]# vim /usr/share/puppet-dashboard/config/environment.rb
5
6 /* ---示例代码----*/
7
初始化数据库
1 /* ---示例代码----*/
2
3
4 [root@master ~]# cd /usr/share/puppet-dashboard/
5
6 [root@master puppet-dashboard]# rake RAILS_ENV=production db:migrate
7
8 /* ---示例代码----*/
配置Apache
我们需要整合Passenger和apache
1 /* ---示例代码----*/
2
3 [root@master ~]# cat > /etc/httpd/conf.d/passenger.conf << EOF
4
5 > LoadModule passenger_module modules/mod_passenger.so
6
7 > <IfModule mod_passenger.c>
8
9 > PassengerRoot /usr/share/rubygems/gems/passenger-3.0.17
10
11 > PassengerRuby /usr/bin/ruby
12
13 > PassengerHighPerformance on
14
15 > PassengerMaxPoolSize 12
16
17 > PassengerPoolIdleTime 1500
18
19 > PassengerStatThrottleRate 120
20
21 > RailsAutoDetect On
22
23 > </IfModule>
24
25 > <VirtualHost *:80>
26
27 > ServerName master.fisteam2.com
28
29 > DocumentRoot "/usr/share/puppet-dashboard/public/"
30
31 > <Directory "/usr/share/puppet-dashboard/public/">
32
33 > Options None
34
35 > AllowOverride AuthConfig
36
37 > Order allow,deny
38
39 > allow from all
40
41 > </Directory>
42
43 > ErrorLog /var/log/httpd/master.fisteam2.com_error.log
44
45 > LogLevel warn
46
47 > CustomLog /var/log/httpd/master.fisteam2.com_access.log combined
48
49 > ServerSignature On
50
51 > </VirtualHost>
52
53 > EOF
54
55 [root@master ~]#
56
57 /* ---示例代码----*/
启动服务
1 /* ---示例代码----*/
2
3 [root@master ~]# service httpd start
4
5 Starting httpd: httpd: Could not reliably determine the server‘s fully qualified domain name, using master.fisteam2.com for ServerName
6
7 [ OK ]
8
9 [root@master ~]# chkconfig httpd on
10
11 [root@master ~]# chkconfig --list | grep httpd
12
13 httpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
14
15 [root@master ~]#
16
17 /* ---示例代码----*/
配置puppet
让Dashboard使用Reports,现在默认agent是已经启用Report的功能,所以你就不需要设置agent,你只需要设置Server端就可以
1 /* ---示例代码----*/
2
3 [root@master ~]# vim /etc/puppet/puppet.conf
4
5 [master]
6
7 reports = store,http
8
9 reporturl = http://master.fisteam2.com:80/reports/upload
10
11 /* ---示例代码----*/
重启puppetmaster 服务
1 /* ---示例代码----*/
2
3 [root@master ~]# service puppetmaster restart
4
5 /* ---示例代码----*/
6
这时候就可以直接用 http://ip 访问puppet Dashboard
导入报告
1 /* ---示例代码----*/
2
3 [root@master puppet-dashboard]# cd /usr/share/puppet-dashboard/
4
5 [root@master puppet-dashboard]# rake RAILS_ENV=production reports:import
6
7 /* ---示例代码----*/
8
这时候你访问Dashboard,可以看到导入的任务.
4. 执行导入的reports
1 /* ---示例代码----*/
2
3 [root@master puppet-dashboard]# cd /usr/share/puppet-dashboard/
4
5 [root@master puppet-dashboard]# rake jobs:work RAILS_ENV="production"
6
7 /* ---示例代码----*/
8
一个Master,五个node测试效果
文件同步测试
Puppet master:
1 /* ---示例代码----*/
2
3 [root@master ~]# vim /etc/puppet/fileserver.conf
4
5 [fisteam2filesync]
6
7 path /etc/puppet
8
9 allow *
10
11 /* ---示例代码----*/
12
在下面加一个配置域,名字叫做fisteam2filesync,路径是/etc/puppet
1 /* ---示例代码----*/
2
3 [root@master ~]# vim /etc/puppet/manifests/site.pp
4
5 node default {
6
7 file {
8
9 "/tmp/fisteam2_puppet_testfile.txt":
10
11 content=>"good,test pass!\nfisteam2_puppet_testing\n";
12
13 }
14
15 }
16
17 /* ---示例代码----*/
18
上面的代码对默认连入的puppet客户端执行一个操作,在/tmp目录生成一个fisteam2_puppet_testfile.txt文件,内容是good,test pass! 回车换行fisteam2_puppet_testing回车换行.
初次创建pp文件,需要重启puppetmaster
1 /* ---示例代码----*/
2
3 [root@master ~]# service puppetmaster restart
4
5 Stopping puppetmaster: [ OK ]
6
7 Starting puppetmaster: [ OK ]
8
9 [root@master ~]#
10
11 /* ---示例代码----*/
12
NODE1~5测试
node1:
node2:
node3:
node4:
node5:
===================================================END====================================
本文出自 “王乾De技术博客” 博客,请务必保留此出处http://redking.blog.51cto.com/27212/1598251
CentOS6.5+puppet3.7.3 安装、配置及测试(三)
原文地址:http://redking.blog.51cto.com/27212/1598251