Puppet load balancing: nginx + passenger

Source: Internet
Author: User

As the 3.x Series no longer supports mongrel, nginx + passenger is used for load balancing. Previously, nginx + mongrel and puppet version were released in the 2.7 series, so they can still be used;

Environment Description:

Operating System: centos 5.8 64-bit

Puppet version: 3.1 Series

1, upgrade Ruby to 1.8.7, install rubygems # rpm-uvh http://rbel.frameos.org/rbel5 # Yum install-y Ruby rubygems ruby-devel.x86_64 2, install puppet server # rpm-IVH http://yum.puppetlabs.com/el/5/products/x86_64/puppetlabs-release-5-1.noarch.rpm # Yum install-y puppet-Server 3, install nginx dependent packages # Yum install-y GCC make PCRE-devel zlib-devel OpenSSL-devel Pam-devel curl-devel rpm-Build 4 install rake, rack and passenger Ruby gems # gem install rake rack passenger -- no-rdoc -- no-ri 5. Install the nginx compilation parameters as follows, must contain passag Module # tar-xjf pcre-8.32.tar.bz2-C/usr/local/src ---- PCRE download # tar-xzf nginx-1.2.1.tar.gz-C/usr/local/src ---- unzip nginx CD/usr // local/src/nginx-1.2.1. /configure -- prefix = $ nginx_path -- With-http_stub_status_module -- with-http_ssl_module -- With-PCRE =/usr/local/src/pcre-8.32 -- add-module = 'passenger-config -- Root '/EXT/nginx # Make # make install 6, combination with passpet # mkdir-P/etc/puppet/Rack/public # cp/usr/share/puppet/EXT/Rack/files/config.ru/etc/puppet/Rack /# chown-r puppet: puppet/etc/puppet/Rack/# nginx. the specific content in conf is as follows: User WWW; worker_processes 1; error_log/usr/local/nginx/logs/error. log; # error_log logs/error. log notice; # error_log logs/error. log Info; PID/usr/local/nginx. PID; # s Pecifies the value for maximum file descriptors that can be opened by this process. worker_rlimit_nofile 65535; events {use epoll; worker_connections 65535;} HTTP {server_tokens off; Include mime. types; default_type application/octet-stream; log_format main '$ remote_addr-$ remote_user [$ time_local] "$ request" ''$ Status $ body_bytes_sent" $ http_referer "'' "$ http_user_agent" "$ http_x_forwarded _ For "'; # access_log logs/access. log main; charset UTF-8; Limit 128; Limit 32 K; limit 4 64 K; limit 8 m; tcp_nopush on; tcp_nodelay on; keepalive_timeout 60; limit on; fastcgi_connect_timeout 300; fastcgi_send_timeout 300; fastcgi_read_timeout 300; fastcgi_buffer_size 64 K; fastcgi_buffers 4 64 K; FastCGI _ Busy_buffers_size 128 K; Limit 128 K; open_file_cache max = 65535 inactive = 10 s; Limit 30 s; Limit 1; gzip on; gzip_min_length 1 K; gzip_buffers 4 16 K; gzip_http_version 1.0; gzip_comp_level 2; gzip_types text/plain application/X-JavaScript text/CSS application/XML; gzip_vary on; # Passenger needed for puppet passenger_root/usr/lib/Ruby/gems/1.8 /Gems/passenger- 3.0.19; passenger_ruby/usr/bin/Ruby; passenger_max_pool_size 15; index index.html index.htm index. PHP; server {Listen 80; SERVER_NAME localhost; # access_log logs/host. access. log main; Location/{root HTML; Index. PHP index.html index.htm;} error_page 500 502 503 x.html; location =/50x.html {root HTML;} location ~. PHP $ {root HTML; # fastcgi_pass 127.0.0.1: 9000; fastcgi_pass Unix:/dev/SHM/PHP. socket; fastcgi_index index. PHP; fastcgi_param script_filename $ document_root/$ fastcgi_script_name; Include fastcgi_params ;}} server {Listen 8140 SSL; SERVER_NAME secure; passenger_enabled on; {{$ }; {http_x_client_verify $ ssl_clie Nt_verify; access_log/usr/local/nginx/logs/puppet_access.log; error_log/usr/local/nginx/logs/puppet_error.log; root/etc/puppet/Rack/Public; ssl_certificate/var/lib/puppet/SSL/certs/client.domain.com. PEM; ssl_certificate_key/var/lib/puppet/SSL/private_keys/client.domain.com. PEM; ssl_crl/var/lib/puppet/SSL/CA/ca_crl.pem; ssl_client_certificate/var/lib/puppet/SSL/CA/ca_crt.pem; ssl_ciphers SSL V2:-low:-export: RC4 + RSA; transport on; ssl_verify_client optional; ssl_verify_depth 1; ssl_session_cache shared: SSL: 128 M; ssl_session_timeout 5 m;} note the following, here, the hostname of puppet server is client.domain.com. As for the specific key path, you can change it according to your own environment and then adjust puppet. conf [main] [Agent] Server = client.domain.com [Master] certname = client.domain.com 7, verify that nginx # lsof-I: 8140 command PID user FD type device is enabled Size/off node name nginx 20855 root 9u IPv4 421091 0t0 tcp *: 8140 (Listen) nginx 20856 WWW 9u IPv4 421091 0t0 tcp *: 8140 (Listen) it can be found that port 8140 is up # puppet agent -- Test -- server client.domain.com info: Retrieving plugin info: caching catalog for client.domain.com info: Applying configuration version '100' notice: finished catalog run in 0.16 seconds found that it is ready for use # tail/usr/local/nginx/log/puppet _ Access. log view nginx log 192.168.200.220--[26/APR/2013: 21: 12: 15 + 0800] "Get/production/node/client.domain.com? HTTP/1.1 "200 3502"-""-"192.168.200.220--[26/APR/2013: 21: 12: 16 + 0800]" Get/production/file_metadatas/plugins? & Links = manage & recurse = true & checksum_type = MD5 & ignore = --- + % 0a ++-+ % 22.svn% 22% 0a ++-+ CVS % 0a ++-+ % 22.git% 22 HTTP/1.1 "200 283"-""-"192.168.200.220--[26/APR/2013: 21: 12: 17 + 0800] "post/production/CATALOG/client.domain.com HTTP/1.1" 200 1033 "-" "-" 192.168.200.220--[26/APR/2013: 21: 12: 17 + 0800] "Put/production/report/client.domain.com HTTP/1.1" 200 14 "-" "-" already logged, 8. adjust if the puppetmaster service has been started, remember to turn it off # chkconfig puppetmaster off # chkconfig nginx on

So far, the puppet Server Load balancer has ended. The combination of nginx and passenger and mongrel has been completed.

This article from the "TNT, O & M path" blog, please be sure to keep this source http://tntdba.blog.51cto.com/1199791/1187739

Puppet load balancing: nginx + passenger

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.