使用Apache+Passenger部署高性能PuppetMaster

前言:

創(chuàng)新互聯(lián)于2013年成立,先為貴德等服務(wù)建站,貴德等地企業(yè),進(jìn)行企業(yè)商務(wù)咨詢服務(wù)。為貴德企業(yè)網(wǎng)站制作PC+手機(jī)+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。

最近在服務(wù)器系統(tǒng)上安裝了最新的Puppet客戶端,發(fā)現(xiàn)跟老版本的PuppetMaster做同步時出現(xiàn)了一些問題,警告類的信息很好解決,注釋掉配置文件templatedir該行即可,后來又對PuppetMaster做了次升級,直接升為最新的3.6.1,隨后發(fā)現(xiàn)PuppetMaster默認(rèn)安裝的WEBrick的web服務(wù)器性能較低且最新版本3.6.1存在bug以至于無法同時接受多臺Agent客戶端請求,因此使用Apache+Passenger方案替代原WEBrick,提高并發(fā)性能,同時解決bug帶來的問題

環(huán)境:

Ubuntu 12.04 64-LTS

PuppetMaster: 3.6.1(升級前版本為3.4.3)

PuppetAgent: 3.6.1

1、安裝Apache2

$ sudo apt-get install apache2 ruby1.8-dev rubygems
$ sudo a2enmod ssl
$ sudo a2enmod headers

2、安裝Rack/Passenger

$ sudo gem install rack passenger
$ sudo passenger-install-apache2-module
# 按提示解決軟件依賴關(guān)系后,再次運(yùn)行命令安裝passenger模塊
Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.44
  PassengerDefaultRuby /usr/bin/ruby1.8
</IfModule>

$ sudo mkdir /etc/puppet/rack
$ sudo mkdir /etc/puppet/rack/{public,tmp}
$ sudo scp /usr/share/puppet/ext/rack/config.ru /etc/puppet/rack/
$ sudo chown -R puppet:root /etc/puppet/rack

3、配置Puppet虛擬主機(jī)文件

$ sudo cp /usr/share/puppet/ext/rack/example-passenger-vhost.conf /etc/apache2/sites-available/puppet.conf
$ sudo vim /etc/apache2/sites-available/puppet.conf
# 按之前的提示添加如下內(nèi)容
LoadModule passenger_module /var/lib/gems/1.8/gems/passenger-4.0.44/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /var/lib/gems/1.8/gems/passenger-4.0.44
  PassengerDefaultRuby /usr/bin/ruby1.8
  PassengerHighPerformance on
  PassengerMaxPoolSize 12
  PassengerPoolIdleTime 1500
# PassengerMaxRequests 1000
  PassengerStatThrottleRate 120
# RackAutoDetect Off                 # 注釋該行
# RailsAutoDetect Off                # 注釋該行
</IfModule>

Listen 8140

<VirtualHost *:8140>
        SSLEngine on
        SSLProtocol             ALL -SSLv2
        SSLCipherSuite          ALL:!aNULL:!eNULL:!DES:!3DES:!IDEA:!SEED:!DSS:!PSK:!RC4:!MD5:+HIGH:+MEDIUM:!LOW:!SSLv2:!EXP
        SSLHonorCipherOrder     on
        # 修改為SSL實(shí)際路徑及文件名
        SSLCertificateFile      /var/lib/puppet/ssl/certs/test.cominggo.com.pem
        SSLCertificateKeyFile   /var/lib/puppet/ssl/private_keys/test.cominggo.com.pem
        SSLCertificateChainFile /var/lib/puppet/ssl/certs/ca.pem
        SSLCACertificateFile    /var/lib/puppet/ssl/certs/ca.pem
        # If Apache complains about invalid signatures on the CRL, you can try disabling
        # CRL checking by commenting the next line, but this is not recommended.
        SSLCARevocationFile     /var/lib/puppet/ssl/crl.pem
        SSLVerifyClient optional
        SSLVerifyDepth  1
        # The `ExportCertData` option is needed for agent certificate expiration warnings
        SSLOptions +StdEnvVars +ExportCertData

        # This header needs to be set if using a loadbalancer or proxy
        RequestHeader unset X-Forwarded-For

        RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
        RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
        RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e

        DocumentRoot /etc/puppet/rack/public/
        RackBaseURI /
        <Directory /etc/puppet/rack/>
                Options None
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>
        ## Logging        # 設(shè)置Puppet訪問日志(可選,默認(rèn)日志為other_vhosts_access.log)
        ErrorLog "/var/log/apache2/puppet_error.log"
        ServerSignature Off
        CustomLog "/var/log/apache2/puppet_access.log" combined
</VirtualHost>

$ cd /etc/apache2/sites-available/
$ sudo a2ensite puppet.conf

4、移除WEBrick服務(wù)(puppetmaster),并重啟Apache服務(wù)

$ sudo /etc/init.d/puppetmaster stop
$ sudo update-rc.d -f puppetmaster remove
$ sudo /etc/init.d/apache2 restart
$ sudo ss -talnp | grep apache2
LISTEN     0      128      *:8140         *:*      users:(("apache2",30037,5),("apache2",29472,5),("apache2",29467,5))
LISTEN     0      128      *:80           *:*      users:(("apache2",30037,3),("apache2",29472,3),("apache2",29467,3))
LISTEN     0      128      *:443          *:*      users:(("apache2",30037,4),("apache2",29472,4),("apache2",29467,4))

5、驗(yàn)證是否部署成功

1)訪問HTTPS服務(wù)

# 訪問頁面:https://test.cominggo.com:8140/
The environment must be purely alphanumeric, not ''

2)PuppetAgent節(jié)點(diǎn)運(yùn)行測試

# PuppetAgent:
$ sudo puppet agent -t

# PuppetMaster:查看apache訪問日志是否有200狀態(tài)請求
$ sudo tail /var/log/apache2/puppet_access.log
172.16.2.22 - - [20/Jun/2014:19:11:53 +0800] "GET /production/file_metadata/modules/zabbix/check.sh?source_permissions=use&links=manage HTTP/1.1" 200 5987 "-" "-"
172.16.2.22 - - [20/Jun/2014:19:11:53 +0800] "GET /production/file_metadata/modules/zabbix/zabbix-release_2.2-1+precise_all.deb?source_permissions=use&links=manage HTTP/1.1" 200 6003 "-" "-"
172.16.2.22 - - [20/Jun/2014:19:11:53 +0800] "GET /production/file_metadata/modules/zabbix/game.conf?source_permissions=use&links=manage HTTP/1.1" 200 5971 "-" "-"
172.16.2.22 - - [20/Jun/2014:19:11:53 +0800] "GET /production/file_metadatas/modules/game/release/data?checksum_type=md5&recurse=true&links=manage HTTP/1.1" 200 44519 "-" "-"
172.16.2.22 - - [20/Jun/2014:19:11:54 +0800] "GET /production/file_metadata/modules/zabbix/netif.py?source_permissions=use&links=manage HTTP/1.1" 200 5987 "-" "-"
172.16.2.22 - - [20/Jun/2014:19:11:56 +0800] "PUT /production/report/t1.cominggo.com HTTP/1.1" 200 5683 "-" "-"

參考:

官方文檔:http://docs.puppetlabs.com/guides/passenger.html

KissPuppet博客:http://kisspuppet.com/2013/11/08/apache-passenger/

當(dāng)前名稱:使用Apache+Passenger部署高性能PuppetMaster
地址分享:http://bm7419.com/article28/pcgjjp.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供動態(tài)網(wǎng)站、搜索引擎優(yōu)化響應(yīng)式網(wǎng)站、定制網(wǎng)站全網(wǎng)營銷推廣、做網(wǎng)站

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

微信小程序開發(fā)