使用Apache+Passenger部署高效能PuppetMaster

來源:互聯網
上載者:User

標籤:puppet   apache+passenger   

前言:

最近在伺服器系統上安裝了最新的Puppet用戶端,發現跟老版本的PuppetMaster做同步時出現了一些問題,警告類的資訊很好解決,注釋掉設定檔templatedir該行即可,後來又對PuppetMaster做了次升級,直接升為最新的3.6.1,隨後發現PuppetMaster預設安裝的WEBrick的web伺服器效能較低且最新版本3.6.1存在bug以至於無法同時接受多台Agent用戶端請求,因此使用Apache+Passenger方案替代原WEBrick,提高並發效能,同時解決bug帶來的問題


環境:

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# 按提示解決軟體依賴關係後,再次運行命令安裝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虛擬機器主機檔案

$ 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# 按之前的提示添加如下內容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實際路徑及檔案名稱        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        # 設定Puppet訪問日誌(可選,預設日誌為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服務(puppetmaster),並重啟Apache服務

$ sudo /etc/init.d/puppetmaster stop$ sudo update-rc.d -f puppetmaster remove$ sudo /etc/init.d/apache2 restart$ sudo ss -talnp | grep apache2LISTEN     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、驗證是否部署成功

1)訪問HTTPS服務

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

2)PuppetAgent節點運行測試

# PuppetAgent:$ sudo puppet agent -t# PuppetMaster:查看apache訪問日誌是否有200狀態請求$ sudo tail /var/log/apache2/puppet_access.log172.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/


本文出自 “不死鳥一輝” 部落格,請務必保留此出處http://phenixikki.blog.51cto.com/7572938/1432633

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.