Puppet automated Nginx + Mongrel load balancing configuration

Source: Internet
Author: User
Puppet automated Nginx + Mongrel server load balancer configuration preface * as the company's application demand increases, the number of servers will also increase. when the number of servers increases, we will find that a puppetmaster is under great pressure and the resolution is slow. What are the optimization methods at this time... puppet automated Nginx + Mongrel server load balancer configuration preface * as the company's application demand increases, the number of servers will also increase. when the number of servers increases, we will find that a puppetmaster is under high pressure and has slow resolution. Is there any optimization method at this time? The answer is! The Puppet official website has a similar solution. puppetmaster can configure multiple ports and combine them with WEB proxy, so that the puppetmaster's affordability can be improved by at least 10 times. Www.2cto.com I. hardware environment: Server System: CentOS6.0 x86_64 Ruby Version: ruby-1.8.7 Puppet version: puppet-2.7.20 Nginx version: nginx-1.2.6 2, Mongrel installation: to use puppet multi port configuration, you need to specify the mongrel type. it is not installed by default. you need to install it: run the following command on the puppetmaster server (provided that the epel redhat source of the corresponding version has been installed ): yum install-y rubygem-mongrel 3. configure puppetmaster to add the following two lines at the end of the/etc/sysconfig/puppetmaster file, representing the multi-port and mongrel types respectively. Echo-e "PUPPETMASTER_PORTS = (18140 18141 18142 18143) \ Users = \ "-servertype = mongrel -- ssl_client_header = HTTP_X_SSL_SUBJECT \">/etc/sysconfig/puppetmaster www.2cto.com 4. ensure that the system has installed pcre-devel before installing Nginx. regular library, then compile and install Nginx, and add the SSL module parameter cd/usr/src; wget-c. http://nginx.org/download/nginx-1.2.6.tar.gz ; Tar xzf nginx-1.2.6.tgz & cd nginx-1.2.6 &&. /configure -- prefix =/usr/local/nginx -- with-http_ssl_module & make install 5. configure Nginx: after Nginx is installed, you need to configure Nginx to proxy multiple local Puppetmaster ports. Nginx uses the default port 8140 of puppetmaster, the client requests Port 8140, and Nginx automatically loads the port 18140 18141 18142 18143. Vi/usr/local/nginx/conf/vhosts. the conf content is as follows: server {listen 8140; root/etc/puppet; ssl on; ssl_session_timeout 5 m; # The following is the Puppetmaster server certificate address ssl_certificate/var/lib/puppet/ssl/certs/certificate; ssl_certificate_key/var/lib/puppet/ssl/private_keys/certificate; ssl_client_certificate/var/lib/puppet/ssl/ca/ca_crt.pem; ssl_crl/var/lib/puppet/ssl/ca/ca_crl.pem; ssl_verify_c Lient optional; # File sections location/production/file_content/files/{types {} default_type application/x-raw; # mainly used to push files, define the file alias path alias/etc/puppet/files/;} # Modules files sections location ~ /Production/file_content/modules /. +/{root/etc/puppet/modules; types {} default_type application/x-raw; rewrite ^/production/file_content/modules /(. + )/(. +) $/$1/files/$2 break;} location/{# set to jump to puppetmaster server load balancer proxy_pass http://puppetmaster ; Proxy_redirect off; proxy_set_header Host $ host; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header X-Forwarded-For $ response; proxy_set_header X-Client-Verify $ response; proxy_set_header X-SSL-Subject $ ssl_client_s_dn; proxy_set_header X-SSL-Issuer $ scheme; proxy_buffer_size 10 m; proxy_buffers 1024 10 m; limit 10 m; proxy_temp_file_write _ Size 10 m; proxy_read_timeout 120;} add the following code to the Nginx. conf configuration file. Upstream puppetmaster {server 127.0.0.1: 18140; server 127.0.0.1: 18141; server 127.0.0.1: 18142; server 127.0.0.1: 18143; server 127.0.0.1: 18144;} include vhosts. conf; 6. verify the configuration and restart the puppetmaster and nginx services: [root @ 192-9-117-162 ~] #/Etc/init. d/puppetmaster restart;/usr/local/nginx/sbin/nginx stop puppetmaster: Port: 18140 [failed] Port: 18141 [failed] Port: 18142 [failed] Port: 18143 [failed] Port: 18144 [failed] start puppetmaster: Port: 18140 [OK] Port: 18141 [OK] Port: 18142 [OK] Port: 18143 [OK] Port: 18144 [OK] run puppet agent -- server = 192-9-117-162-app.com -- test on the client to test the puppet agent.
 
Related Article

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.