|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
小知识:CentOS(CommunityEnterpriseOperatingSystem,中文意思是:社区企业操作系统)是Linux发行版之一。
跟着公司运用需求的增长,须要赓续的扩大,办事器数目也随之增长,当办事器数目赓续增长,我们会发明一台puppetmaster压力年夜,解析迟缓,并且时不时涌现“timeout”之类的报错,那这时候有甚么优化的方法吗?我们在Puppet官网上找寻处理计划,发明puppetmaster可以设置装备摆设多端口,联合WEB署理(推举Nginx),如许puppetmaster蒙受才能至多可以晋升数倍以上,相当于在很年夜水平上优化了puppet的处置才能。
1.遵守后面的情况设定,我们这里的办事器情况及软件版天职别为:
办事器体系:CentOS5.8x86_64
Ruby版本:ruby-1.8.5
Puppet版本:puppet-2.7.9
Nginx版本:nginx-0.8.46
2.Mongrel装置
要应用puppet多端口设置装备摆设,须要指定mongrel类型,默许没有装置,须要装置:
yuminstall-yrubygem-mongrel
3.设置装备摆设puppetmaster
在/etc/sysconfig/puppetmaster文件末尾添加以下两行,分离代表多端口、mongrel类型,内容以下所示:
PUPPETMASTER_PORTS=(81418142814381448145)
PUPPETMASTER_EXTRA_OPTS="--servertype=mongrel--ssl_client_header=HTTP_X_SSL_SUBJECT"
4.装置Nginx办事
装置之前请确保体系曾经装置pcre-devel正则库,然后再编译装置Nginx,须要添加SSL模块参数支撑,Nginx的装置进程以下所示:
yum-yinstallpcre-devel
cd/usr/local/src
wgethttp://nginx.org/download/nginx-0.8.46.tar.gz
tarzxvfnginx-0.8.46.tar.gz
cdnginx-0.8.46
./configure--prefix=/usr/local/nginx--with-http_ssl_module
make&&makeinstall&&cd../
添加www用户组及用户,敕令以下所示:
groupaddwww
useradd-gwwwwww
5.我们根据puppet需求来修正设置装备摆设文件nginx.conf,内容以下所示:
userwww;
worker_processes8;
events{
worker_connections65535;
}
http{
includemime.types;
default_typeapplication/octet-stream;
sendfileon;
tcp_nopushon;
keepalive_timeout65;
#界说puppet客户端拜访puppet-server端日记格局
log_formatmain$remote_addr-$remote_user[$time_local]"$request"$request_length$request_time$time_local
$status$body_bytes_sent$bytes_sent$connection$msec"$http_referer"
"$http_user_agent"$http_x_forwarded_for$upstream_response_time$upstream_addr$upstream_status;
access_log/usr/local/nginx/logs/access.logmain;
upstreampuppetmaster{
server127.0.0.1:8141;
server127.0.0.1:8142;
server127.0.0.1:8143;
server127.0.0.1:8144;
server127.0.0.1:8145;
}
server{
listen8140;
root/etc/puppet;
sslon;
ssl_session_timeout5m;
#以下为puppetmaster办事器端证书地址
ssl_certificate/var/lib/puppet/ssl/certs/server.cn7788.com.pem;
ssl_certificate_key/var/lib/puppet/ssl/private_keys/server.cn7788.com.pem;
ssl_client_certificate/var/lib/puppet/ssl/ca/ca_crt.pem;
ssl_crl/var/lib/puppet/ssl/ca/ca_crl.pem;
ssl_verify_clientoptional;
#Filesections
location/production/file_content/files/{
types{}
default_typeapplication/x-raw;
#界说puppet推送路径别号
alias/etc/puppet/files/;
}
#Modulesfilessections
location~/production/file_content/modules/.+/{
root/etc/puppet/modules;
types{}
default_typeapplication/x-raw;
rewrite^/production/file_content/modules/(.+)/(.+)$/$1/files/$2break;
}
location/{
##设置跳转到puppetmaster负载平衡
proxy_passhttp://puppetmaster;
proxy_redirectoff;
proxy_set_headerHost$host;
proxy_set_headerX-Real-IP$remote_addr;
proxy_set_headerX-Forwarded-For$proxy_add_x_forwarded_for;
proxy_set_headerX-Client-Verify$ssl_client_verify;
proxy_set_headerX-SSL-Subject$ssl_client_s_dn;
proxy_set_headerX-SSL-Issuer$ssl_client_i_dn;
proxy_buffer_size10m;
proxy_buffers102410m;
proxy_busy_buffers_size10m;
proxy_temp_file_write_size10m;
proxy_read_timeout120;
}
}
}
6.修正完nginx.conf文件今后,我们要启动nginx及puppet-server,这时候应当若何操作呢?
1.我们起首封闭puppetmaster过程,然后先启动nginx,否则nginx是会启动掉败的,敕令以下所示:
/usr/local/nginx/sbin/nginx
nginx占用puppetmaster默许的8140端口后,我们可以用以下敕令来检讨8140端口能否被nginx接收,以下所示:
lsof-i:8140
此敕令显示成果注解8140被nginx过程接收,以下所示:
COMMANDPIDUSERFDTYPEDEVICESIZE/OFFNODENAME
nginx4121root6uIPv4206680t0TCP*:8140(LISTEN)
nginx4122www6uIPv4206680t0TCP*:8140(LISTEN)
我们再启动puppetmaster,敕令以下所示:
servicepuppetmasterstart
假如ruby版本为1.8.5的话,等会运转puppetmaster会有以下正告,以下所示:
Startingpuppetmaster:
Port:8141**Rubyversionisnotup-to-date;loadingcgi_multipart_eof_fix
[OK]
Port:8142**Rubyversionisnotup-to-date;loadingcgi_multipart_eof_fix
[OK]
Port:8143**Rubyversionisnotup-to-date;loadingcgi_multipart_eof_fix
[OK]
Port:8144**Rubyversionisnotup-to-date;loadingcgi_multipart_eof_fix
[OK]
Port:8145**Rubyversionisnotup-to-date;loadingcgi_multipart_eof_fix
[OK]
这段正告值的意思为:
Itsjustawarning.MongrelwantsaRubyversionofatleast1.8.6.
Butitstillrunsjustfinewithpreviousversions.Justignorethewarning.
翻译为中文的意思是:
Mongrel须要ruby至多是1.8.6以上的版本,但它依然在以后版本运转,请忽咯以后正告,为了包管全部puppet运转情况的稳固,我这里选择照样沿用1.8.5版本的ruby.
小知识:CentOS完全免费,不存在REDHATAS4需要序列号的问题。 |
|