SlideShare une entreprise Scribd logo
1  sur  22
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
HAProxy
By ChinaNetCloud
Pioneers in OaaS – Operations-as-a-Service
January, 2015
www.ChinaNetCloud.com
Copyright 2015 ChinaNetcloud Training Program
ChinaNetCloud Training
2
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Introduction
● HAProxy key part of most large systems
● World's most powerful software load balancer
● A little complex
● Interesting and fun
3
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Load Balancer Overview
● Listen on front-end ports, usually 80/443
● Forwards to a back-end pool of servers
● Has health checks of back-end
● Only send to Healthy & UP servers
● Has sticky sessions, usually using cookies
● Web servers see LB as client, with LB's IP
● Use X-Forwarded-for Header to send real IP
● Important for web server logs
4
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Load Balancer Overview
● Single LB, many web
● Two LB, many web
5
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
High-Avail HAProxy
● Two HAProxy
● Run KeepAlived to manage failover
● Have front-end VIP
● We have standard config, Wiki
● Usually Physical / Private
● On Public Cloud use ELB or Heartbeat
6
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
HA Load Balancer – Public Cloud
● Amazon, Aliyun – Have their ELB/SLB in front
● Use their to help bandwidth and failover
● AWS – Need ELB for HA between zones
● Aliyun – Need SLB for single bandwidth point
● Still use two HAProxy
● HAProxy more powerful, configurable
● HAProxy can be monitored (Nginx can't)
7
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Parts of HAProxy
● Front-End Listeners
● Back-End Pools
● ACLs
● Rewrites
● Logs
● Monitoring
8
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Front-End
● Listening part of HAProxy
● Pretty simple
● Has IP, port to listen on
● Has networking options, like timeouts
● Includes vhost, name to listen on
● Can have several front-ends
● Usually for different domains, www., images., etc.
● Can go to same or different back-ends
9
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Back End Pools
● Part that does the work
● Lots of options
● Also does logging, error handling
● And health checks of backend servers
● Has a backend server list
● Each server has options, weights, health checks
10
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
ACLs – Control & Multi-Pool
● Can split traffic by URL, host
● For vhost split, use second Front-end
● For URL split, use ACLs
● Based on Headers, URL, or Path
● If-then structure
● Also can avoid scans, DDoS
● Example:
● acl is_www_domain_com hdr_end(host) -i domain.com
● use_backend www_ex_com if is_www_example_com
11
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Rewrites
● Has basic rewrites
● Can be useful, especially cross-domain
● Usually better to rewrite on web server
12
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Configuration
● Single file
● Has Global default second, for all Front/Back
● Has section for each Front & Back
● Not much to change, other than pools & URLs
● Sometimes change timeouts
● Sometimes advanced features like keepalive
● Sometimes Tomcat needs more changes
● server srv-example-web1_80 10.9.1.205:80 cookie
srv-example-web1_80 check maxconn 2000
13
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Session Stickiness
● Makes sure same user goes to same server
● Especially in one session
● Very important for Java
● Not very important for PHP if uses shared cache
● Can cause instability on big systems
● Done with separate (not session) cookie
● Remove cookie name in server list to disable
14
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Logs
● Very powerful and useful
● Uses syslog, so /var/log/haproxy …
● Shows disconnect reason/state
● 4 letter code like CRNI, RHEP
● See manual for meaning
● Show is Client or Backend server disconnected
– Also often shows why or how
● Also shows if session/cookie was used
15
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Monitoring
● Very good
● Keeps stats by pool and by servers
● Records status, errors, but not timing
● Unusual words:
● Sessions – Concurrent connections
● Session Rate – Request rate
● Two ways to use (Can also manage servers)
● API called via Socket
● GUI web interface
16
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
GUI Web Monitor
● Lots of good detail
17
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
SSL in HAProxy
● Just got support in June, 2014 – Version 1.5
● Starting to see in production use
● Until now, we had to:
● Have to use Nginx in front
● Set Nginx on port 443 as proxy
● Sends traffic to Haproxy on port 80 or 81
– Use 81 if need to keep SSL traffic separate
● Now we can use directly in version 1.5
● See docs on how to configure
18
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Multi-Process
● HAProxy is single process – use single CPU
● Usually okay, but can limit scaling
● 250,000 connections, but only 2,500 requests/sec
● 50,000+ requests/sec, but only 2,500 concurrent con
● Need special config and discussion to use
● It CAN run multi-process, but monitoring is wrong
● All monitoring by process, so gets confused
● Messy
19
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Summary
● HAProxy important and powerful
● Very configurable
● Has pools
● Great logs
● Good luck !
20
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Lab
● Create VM on AWS
● Install Nginx & Apache
● Configure Nginx on port 81 and Apache on 82
● Install HAProxy from RPM & Wiki
● Create frontend & backend for nginx, test
● Add ACL and Apache backend pool
● Split URLs between Nginx & Apache, test
● Look at monitor page, use CLI tools
● Look at logs, look up status codes
21
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
About ChinaNetCloud
Www.ChinaNetCloud.com – +86-21-6422-1946 – Sales@ChinaNetCloud.com
ChinaNetCloud is a Shanghai-based, full-service Internet managed services provider
(MSP). We architect, build, optimize, and manage large-scale systems for e-commerce,
games, apps, mobile, media, and more.
We deliver Reliability, Performance, Scale, Security, and cost savings via our Operations-
as-a-Service (OaaS) platform, which includes 7x24 operations, deep predcitive
monitoring, networking, security scanning, backups, databases, upgrades,rapid
troubleshooting, configuration changes, and much more.
Our OaaS platform is state-of-the-art with a wide variety of sophisticated tools ranging
from deep design to audit, migration, management, monitoring, backups, CMDB, load
testing, capacity planning, performance analysis, portals, and much more.
Over six years, we've helped hundreds of internet companies improve their systems,
focusing on Reliability, Performance, Scalability, Security, and Cost-Savings.
Let us help you today!
22
ChinaNetCloudRunning the World's Internet Servers 管理全球服务器
Contact ChinaNetCloud
Silicon Valley Office:
440 North Wolfe Road
Sunnyvale, 94085 USA ChinaNetCloud
www.ChinaNetCloud.com
Sales@ChinaNetCloud.com
Shanghai Headquarters:
X2 Space 10601
1238 Xietu Lu
Shanghai, 200032 China
Beijing Office:
Lee World Business Building #305
57 Middl Xingfu Village Rd., Chaoyang
Beijing, 100027 China
T: +86-21-6422-1946

Contenu connexe

Tendances

Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1
PacSecJP
 
Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014
bryan_call
 

Tendances (20)

Using HAProxy to Scale MySQL
Using HAProxy to Scale MySQLUsing HAProxy to Scale MySQL
Using HAProxy to Scale MySQL
 
HA Proxy logs - The Art of Logging
HA Proxy logs - The Art of LoggingHA Proxy logs - The Art of Logging
HA Proxy logs - The Art of Logging
 
Introduction to Haproxy
Introduction to HaproxyIntroduction to Haproxy
Introduction to Haproxy
 
Load Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - SlidesLoad Balancing MySQL with HAProxy - Slides
Load Balancing MySQL with HAProxy - Slides
 
Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1Stuart Larsen, attacking http2implementations-rev1
Stuart Larsen, attacking http2implementations-rev1
 
Attacking http2 implementations (1)
Attacking http2 implementations (1)Attacking http2 implementations (1)
Attacking http2 implementations (1)
 
How To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - SlidesHow To Set Up SQL Load Balancing with HAProxy - Slides
How To Set Up SQL Load Balancing with HAProxy - Slides
 
HTTP2:新的机遇与挑战
HTTP2:新的机遇与挑战HTTP2:新的机遇与挑战
HTTP2:新的机遇与挑战
 
Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014Choosing A Proxy Server - Apachecon 2014
Choosing A Proxy Server - Apachecon 2014
 
Kea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISCKea DHCP – the new open source DHCP server from ISC
Kea DHCP – the new open source DHCP server from ISC
 
HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know? HTTP 2.0 – What do I need to know?
HTTP 2.0 – What do I need to know?
 
ReplacingSquidWithATS
ReplacingSquidWithATSReplacingSquidWithATS
ReplacingSquidWithATS
 
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse ProxyNginx A High Performance Load Balancer, Web Server & Reverse Proxy
Nginx A High Performance Load Balancer, Web Server & Reverse Proxy
 
NGINX: High Performance Load Balancing
NGINX: High Performance Load BalancingNGINX: High Performance Load Balancing
NGINX: High Performance Load Balancing
 
Varnish SSL / TLS
Varnish SSL / TLSVarnish SSL / TLS
Varnish SSL / TLS
 
Denser, cooler, faster, stronger: PHP on ARM microservers
Denser, cooler, faster, stronger: PHP on ARM microserversDenser, cooler, faster, stronger: PHP on ARM microservers
Denser, cooler, faster, stronger: PHP on ARM microservers
 
Apache Traffic Server & Lua
Apache Traffic Server & LuaApache Traffic Server & Lua
Apache Traffic Server & Lua
 
Load balancing at tuenti
Load balancing at tuentiLoad balancing at tuenti
Load balancing at tuenti
 
Apache Traffic Server
Apache Traffic ServerApache Traffic Server
Apache Traffic Server
 
HTTP/2 Introduction
HTTP/2 IntroductionHTTP/2 Introduction
HTTP/2 Introduction
 

En vedette

En vedette (9)

What's New in HAProxy
What's New in HAProxyWhat's New in HAProxy
What's New in HAProxy
 
Velocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attackVelocity 2011 - Our first DDoS attack
Velocity 2011 - Our first DDoS attack
 
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a MonthUSENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
USENIX LISA15: How TubeMogul Handles over One Trillion HTTP Requests a Month
 
Aniki - The ORM as our great brother.
Aniki - The ORM as our great brother.Aniki - The ORM as our great brother.
Aniki - The ORM as our great brother.
 
Embracing Open Source: Practice and Experience from Alibaba
Embracing Open Source: Practice and Experience from AlibabaEmbracing Open Source: Practice and Experience from Alibaba
Embracing Open Source: Practice and Experience from Alibaba
 
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
2014 OSDC Talk: Introduction to Percona XtraDB Cluster and HAProxy
 
Keepalived & HA-Proxy as an alternative to commercial loadbalancer - August 2014
Keepalived & HA-Proxy as an alternative to commercial loadbalancer - August 2014Keepalived & HA-Proxy as an alternative to commercial loadbalancer - August 2014
Keepalived & HA-Proxy as an alternative to commercial loadbalancer - August 2014
 
DDoS Attacks
DDoS AttacksDDoS Attacks
DDoS Attacks
 
Multi-Layer DDoS Mitigation Strategies
Multi-Layer DDoS Mitigation StrategiesMulti-Layer DDoS Mitigation Strategies
Multi-Layer DDoS Mitigation Strategies
 

Similaire à ChinaNetCloud Training - HAProxy Intro

Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
ConFoo
 
Drupal Performance and Scaling
Drupal Performance and ScalingDrupal Performance and Scaling
Drupal Performance and Scaling
Gerald Villorente
 

Similaire à ChinaNetCloud Training - HAProxy Intro (20)

Basics of NGINX
Basics of NGINXBasics of NGINX
Basics of NGINX
 
How Sysbee Manages Infrastructures and Provides Advanced Monitoring by Using ...
How Sysbee Manages Infrastructures and Provides Advanced Monitoring by Using ...How Sysbee Manages Infrastructures and Provides Advanced Monitoring by Using ...
How Sysbee Manages Infrastructures and Provides Advanced Monitoring by Using ...
 
Zero Downtime JEE Architectures
Zero Downtime JEE ArchitecturesZero Downtime JEE Architectures
Zero Downtime JEE Architectures
 
Scalable Architecture 101
Scalable Architecture 101Scalable Architecture 101
Scalable Architecture 101
 
Kaseya Connect 2013: Optimizing Your K Server - Best Practices in Kaseya Infr...
Kaseya Connect 2013: Optimizing Your K Server - Best Practices in Kaseya Infr...Kaseya Connect 2013: Optimizing Your K Server - Best Practices in Kaseya Infr...
Kaseya Connect 2013: Optimizing Your K Server - Best Practices in Kaseya Infr...
 
Best practices of notes traveler deployment
Best practices of notes traveler deploymentBest practices of notes traveler deployment
Best practices of notes traveler deployment
 
OpenNebulaConf2018 - Is Hyperconverged Infrastructure what you need? - Boyan ...
OpenNebulaConf2018 - Is Hyperconverged Infrastructure what you need? - Boyan ...OpenNebulaConf2018 - Is Hyperconverged Infrastructure what you need? - Boyan ...
OpenNebulaConf2018 - Is Hyperconverged Infrastructure what you need? - Boyan ...
 
MySQL X protocol - Talking to MySQL Directly over the Wire
MySQL X protocol - Talking to MySQL Directly over the WireMySQL X protocol - Talking to MySQL Directly over the Wire
MySQL X protocol - Talking to MySQL Directly over the Wire
 
App Deployment on Cloud
App Deployment on CloudApp Deployment on Cloud
App Deployment on Cloud
 
MySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disksMySql's NoSQL -- best of both worlds on the same disks
MySql's NoSQL -- best of both worlds on the same disks
 
Drupal Performance and Scaling
Drupal Performance and ScalingDrupal Performance and Scaling
Drupal Performance and Scaling
 
ESB vs API management
ESB vs API managementESB vs API management
ESB vs API management
 
RedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with ChefRedMart Migrating from EC2 to VPC with Chef
RedMart Migrating from EC2 to VPC with Chef
 
Maximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINXMaximizing PHP Performance with NGINX
Maximizing PHP Performance with NGINX
 
WebDev Simplified React.js.pptx
WebDev Simplified React.js.pptxWebDev Simplified React.js.pptx
WebDev Simplified React.js.pptx
 
oVirt – open your virtual datacenter
oVirt – open your virtual datacenteroVirt – open your virtual datacenter
oVirt – open your virtual datacenter
 
23 LAMP Stack #burningkeyboards
23 LAMP Stack #burningkeyboards23 LAMP Stack #burningkeyboards
23 LAMP Stack #burningkeyboards
 
Magento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 Speed OptimizationMagento Meetup New Delhi- Magento2 Speed Optimization
Magento Meetup New Delhi- Magento2 Speed Optimization
 
Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017Dynomite @ RedisConf 2017
Dynomite @ RedisConf 2017
 
Apache Airflow in Production
Apache Airflow in ProductionApache Airflow in Production
Apache Airflow in Production
 

Plus de ChinaNetCloud

运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
ChinaNetCloud
 

Plus de ChinaNetCloud (20)

AWS ELB Tips & Best Practices
AWS ELB Tips & Best PracticesAWS ELB Tips & Best Practices
AWS ELB Tips & Best Practices
 
OpsStack--Integrated Operation Platform
OpsStack--Integrated Operation PlatformOpsStack--Integrated Operation Platform
OpsStack--Integrated Operation Platform
 
ChinaNetCloud Online Lecture:Something About Tshark
ChinaNetCloud Online Lecture:Something About TsharkChinaNetCloud Online Lecture:Something About Tshark
ChinaNetCloud Online Lecture:Something About Tshark
 
ChinaNetCloud Online Lecture: Fight Against External Attacks From Different L...
ChinaNetCloud Online Lecture: Fight Against External Attacks From Different L...ChinaNetCloud Online Lecture: Fight Against External Attacks From Different L...
ChinaNetCloud Online Lecture: Fight Against External Attacks From Different L...
 
Steve Mushero on Entrepreneurship - 创业 - 崔牛会
Steve Mushero on Entrepreneurship - 创业 - 崔牛会Steve Mushero on Entrepreneurship - 创业 - 崔牛会
Steve Mushero on Entrepreneurship - 创业 - 崔牛会
 
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
Dev-Ops与Docker的最佳实践 QCon2016 北京站演讲
 
云中漫步 颠覆创新_创业邦春季创新峰会主题演讲 Cloud Innovation in China
云中漫步 颠覆创新_创业邦春季创新峰会主题演讲 Cloud Innovation in China云中漫步 颠覆创新_创业邦春季创新峰会主题演讲 Cloud Innovation in China
云中漫步 颠覆创新_创业邦春季创新峰会主题演讲 Cloud Innovation in China
 
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
运维安全 抵抗黑客攻击_云络安全沙龙4月上海站主题分享
 
AWS Summit OaaS Talk by ChinaNetCloud
AWS Summit OaaS Talk by ChinaNetCloudAWS Summit OaaS Talk by ChinaNetCloud
AWS Summit OaaS Talk by ChinaNetCloud
 
Running Internet Systems in China - The Details You Need to Succeed in Chines...
Running Internet Systems in China - The Details You Need to Succeed in Chines...Running Internet Systems in China - The Details You Need to Succeed in Chines...
Running Internet Systems in China - The Details You Need to Succeed in Chines...
 
Making Internet Operations Easier
Making Internet Operations EasierMaking Internet Operations Easier
Making Internet Operations Easier
 
Internet Cloud Operations - ChinaNetcloud & AWS Event Beijing
Internet Cloud Operations - ChinaNetcloud & AWS Event BeijingInternet Cloud Operations - ChinaNetcloud & AWS Event Beijing
Internet Cloud Operations - ChinaNetcloud & AWS Event Beijing
 
Big Data Security (ChinaNetCloud - Guiyang Conference)
Big Data Security (ChinaNetCloud - Guiyang Conference)Big Data Security (ChinaNetCloud - Guiyang Conference)
Big Data Security (ChinaNetCloud - Guiyang Conference)
 
Internet System Security Overview
Internet System Security OverviewInternet System Security Overview
Internet System Security Overview
 
Why Work at ChinaNetCloud
Why Work at ChinaNetCloudWhy Work at ChinaNetCloud
Why Work at ChinaNetCloud
 
Cloud Operations Challenges - Talk by ChinaNetCloud at Joint Cisco event
Cloud Operations Challenges - Talk by ChinaNetCloud at Joint Cisco eventCloud Operations Challenges - Talk by ChinaNetCloud at Joint Cisco event
Cloud Operations Challenges - Talk by ChinaNetCloud at Joint Cisco event
 
Automatically Managing Internet Operations In The Cloud - 云计算平台的自动化运维
Automatically Managing  Internet Operations  In The Cloud - 云计算平台的自动化运维Automatically Managing  Internet Operations  In The Cloud - 云计算平台的自动化运维
Automatically Managing Internet Operations In The Cloud - 云计算平台的自动化运维
 
ChinaNetCloud - Aliyun Joint Event on Cloud Operations
ChinaNetCloud - Aliyun Joint Event on Cloud Operations ChinaNetCloud - Aliyun Joint Event on Cloud Operations
ChinaNetCloud - Aliyun Joint Event on Cloud Operations
 
Clouds in China
Clouds in ChinaClouds in China
Clouds in China
 
ChinaNetCloud - Public Clouds in China Overview
ChinaNetCloud - Public Clouds in China OverviewChinaNetCloud - Public Clouds in China Overview
ChinaNetCloud - Public Clouds in China Overview
 

Dernier

PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
galaxypingy
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
ydyuyu
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
Asmae Rabhi
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Monica Sydney
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Monica Sydney
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
ydyuyu
 

Dernier (20)

Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrStory Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
Story Board.pptxrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr
 
PowerDirector Explination Process...pptx
PowerDirector Explination Process...pptxPowerDirector Explination Process...pptx
PowerDirector Explination Process...pptx
 
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
20240509 QFM015 Engineering Leadership Reading List April 2024.pdf
 
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
best call girls in Hyderabad Finest Escorts Service 📞 9352988975 📞 Available ...
 
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
20240510 QFM016 Irresponsible AI Reading List April 2024.pdf
 
Microsoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck MicrosoftMicrosoft Azure Arc Customer Deck Microsoft
Microsoft Azure Arc Customer Deck Microsoft
 
20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf20240508 QFM014 Elixir Reading List April 2024.pdf
20240508 QFM014 Elixir Reading List April 2024.pdf
 
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime NagercoilNagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
Nagercoil Escorts Service Girl ^ 9332606886, WhatsApp Anytime Nagercoil
 
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency""Boost Your Digital Presence: Partner with a Leading SEO Agency"
"Boost Your Digital Presence: Partner with a Leading SEO Agency"
 
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
APNIC Policy Roundup, presented by Sunny Chendi at the 5th ICANN APAC-TWNIC E...
 
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
哪里办理美国迈阿密大学毕业证(本硕)umiami在读证明存档可查
 
Best SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency DallasBest SEO Services Company in Dallas | Best SEO Agency Dallas
Best SEO Services Company in Dallas | Best SEO Agency Dallas
 
75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx75539-Cyber Security Challenges PPT.pptx
75539-Cyber Security Challenges PPT.pptx
 
Power point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria IuzzolinoPower point inglese - educazione civica di Nuria Iuzzolino
Power point inglese - educazione civica di Nuria Iuzzolino
 
Real Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirtReal Men Wear Diapers T Shirts sweatshirt
Real Men Wear Diapers T Shirts sweatshirt
 
Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.Meaning of On page SEO & its process in detail.
Meaning of On page SEO & its process in detail.
 
APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53APNIC Updates presented by Paul Wilson at ARIN 53
APNIC Updates presented by Paul Wilson at ARIN 53
 
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi EscortsRussian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
Russian Escort Abu Dhabi 0503464457 Abu DHabi Escorts
 
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi EscortsIndian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
Indian Escort in Abu DHabi 0508644382 Abu Dhabi Escorts
 
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查在线制作约克大学毕业证(yu毕业证)在读证明认证可查
在线制作约克大学毕业证(yu毕业证)在读证明认证可查
 

ChinaNetCloud Training - HAProxy Intro

  • 1. ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 HAProxy By ChinaNetCloud Pioneers in OaaS – Operations-as-a-Service January, 2015 www.ChinaNetCloud.com Copyright 2015 ChinaNetcloud Training Program ChinaNetCloud Training
  • 2. 2 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Introduction ● HAProxy key part of most large systems ● World's most powerful software load balancer ● A little complex ● Interesting and fun
  • 3. 3 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Load Balancer Overview ● Listen on front-end ports, usually 80/443 ● Forwards to a back-end pool of servers ● Has health checks of back-end ● Only send to Healthy & UP servers ● Has sticky sessions, usually using cookies ● Web servers see LB as client, with LB's IP ● Use X-Forwarded-for Header to send real IP ● Important for web server logs
  • 4. 4 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Load Balancer Overview ● Single LB, many web ● Two LB, many web
  • 5. 5 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 High-Avail HAProxy ● Two HAProxy ● Run KeepAlived to manage failover ● Have front-end VIP ● We have standard config, Wiki ● Usually Physical / Private ● On Public Cloud use ELB or Heartbeat
  • 6. 6 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 HA Load Balancer – Public Cloud ● Amazon, Aliyun – Have their ELB/SLB in front ● Use their to help bandwidth and failover ● AWS – Need ELB for HA between zones ● Aliyun – Need SLB for single bandwidth point ● Still use two HAProxy ● HAProxy more powerful, configurable ● HAProxy can be monitored (Nginx can't)
  • 7. 7 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Parts of HAProxy ● Front-End Listeners ● Back-End Pools ● ACLs ● Rewrites ● Logs ● Monitoring
  • 8. 8 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Front-End ● Listening part of HAProxy ● Pretty simple ● Has IP, port to listen on ● Has networking options, like timeouts ● Includes vhost, name to listen on ● Can have several front-ends ● Usually for different domains, www., images., etc. ● Can go to same or different back-ends
  • 9. 9 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Back End Pools ● Part that does the work ● Lots of options ● Also does logging, error handling ● And health checks of backend servers ● Has a backend server list ● Each server has options, weights, health checks
  • 10. 10 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 ACLs – Control & Multi-Pool ● Can split traffic by URL, host ● For vhost split, use second Front-end ● For URL split, use ACLs ● Based on Headers, URL, or Path ● If-then structure ● Also can avoid scans, DDoS ● Example: ● acl is_www_domain_com hdr_end(host) -i domain.com ● use_backend www_ex_com if is_www_example_com
  • 11. 11 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Rewrites ● Has basic rewrites ● Can be useful, especially cross-domain ● Usually better to rewrite on web server
  • 12. 12 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Configuration ● Single file ● Has Global default second, for all Front/Back ● Has section for each Front & Back ● Not much to change, other than pools & URLs ● Sometimes change timeouts ● Sometimes advanced features like keepalive ● Sometimes Tomcat needs more changes ● server srv-example-web1_80 10.9.1.205:80 cookie srv-example-web1_80 check maxconn 2000
  • 13. 13 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Session Stickiness ● Makes sure same user goes to same server ● Especially in one session ● Very important for Java ● Not very important for PHP if uses shared cache ● Can cause instability on big systems ● Done with separate (not session) cookie ● Remove cookie name in server list to disable
  • 14. 14 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Logs ● Very powerful and useful ● Uses syslog, so /var/log/haproxy … ● Shows disconnect reason/state ● 4 letter code like CRNI, RHEP ● See manual for meaning ● Show is Client or Backend server disconnected – Also often shows why or how ● Also shows if session/cookie was used
  • 15. 15 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Monitoring ● Very good ● Keeps stats by pool and by servers ● Records status, errors, but not timing ● Unusual words: ● Sessions – Concurrent connections ● Session Rate – Request rate ● Two ways to use (Can also manage servers) ● API called via Socket ● GUI web interface
  • 16. 16 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 GUI Web Monitor ● Lots of good detail
  • 17. 17 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 SSL in HAProxy ● Just got support in June, 2014 – Version 1.5 ● Starting to see in production use ● Until now, we had to: ● Have to use Nginx in front ● Set Nginx on port 443 as proxy ● Sends traffic to Haproxy on port 80 or 81 – Use 81 if need to keep SSL traffic separate ● Now we can use directly in version 1.5 ● See docs on how to configure
  • 18. 18 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Multi-Process ● HAProxy is single process – use single CPU ● Usually okay, but can limit scaling ● 250,000 connections, but only 2,500 requests/sec ● 50,000+ requests/sec, but only 2,500 concurrent con ● Need special config and discussion to use ● It CAN run multi-process, but monitoring is wrong ● All monitoring by process, so gets confused ● Messy
  • 19. 19 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Summary ● HAProxy important and powerful ● Very configurable ● Has pools ● Great logs ● Good luck !
  • 20. 20 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Lab ● Create VM on AWS ● Install Nginx & Apache ● Configure Nginx on port 81 and Apache on 82 ● Install HAProxy from RPM & Wiki ● Create frontend & backend for nginx, test ● Add ACL and Apache backend pool ● Split URLs between Nginx & Apache, test ● Look at monitor page, use CLI tools ● Look at logs, look up status codes
  • 21. 21 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 About ChinaNetCloud Www.ChinaNetCloud.com – +86-21-6422-1946 – Sales@ChinaNetCloud.com ChinaNetCloud is a Shanghai-based, full-service Internet managed services provider (MSP). We architect, build, optimize, and manage large-scale systems for e-commerce, games, apps, mobile, media, and more. We deliver Reliability, Performance, Scale, Security, and cost savings via our Operations- as-a-Service (OaaS) platform, which includes 7x24 operations, deep predcitive monitoring, networking, security scanning, backups, databases, upgrades,rapid troubleshooting, configuration changes, and much more. Our OaaS platform is state-of-the-art with a wide variety of sophisticated tools ranging from deep design to audit, migration, management, monitoring, backups, CMDB, load testing, capacity planning, performance analysis, portals, and much more. Over six years, we've helped hundreds of internet companies improve their systems, focusing on Reliability, Performance, Scalability, Security, and Cost-Savings. Let us help you today!
  • 22. 22 ChinaNetCloudRunning the World's Internet Servers 管理全球服务器 Contact ChinaNetCloud Silicon Valley Office: 440 North Wolfe Road Sunnyvale, 94085 USA ChinaNetCloud www.ChinaNetCloud.com Sales@ChinaNetCloud.com Shanghai Headquarters: X2 Space 10601 1238 Xietu Lu Shanghai, 200032 China Beijing Office: Lee World Business Building #305 57 Middl Xingfu Village Rd., Chaoyang Beijing, 100027 China T: +86-21-6422-1946