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 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, you need to add SSL module parameters 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/ng Restart -- with-http_ssl_module & make install 5. Configure Nginx: After Nginx is installed, You need to configure Nginx to proxy local Puppetmaster multiple ports, Nginx uses puppetmaster default port 8140, the client requests port 8140 and Nginx automatically loads these ports to port 18140 18141 18142 18143 18144. 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 $ proxy_add_x_forwarded_for; Proxy_set_header X-Client-Verify $ scheme; proxy_set_header X-SSL-Subject $ scheme; 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;} In Nginx. add the following code to the 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.
 

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.