您好,登錄后才能下訂單哦!
前言:
最近在服務器系統上安裝了最新的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 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、驗證是否部署成功
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.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/
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。