rise

使用keepalived+haproxy搭建高可用服务器

送分小仙女□ 提交于 2020-02-04 00:15:50
环境 HAProxy: 1.4.18 KeepAlived: 1.2.2 VIP: 192.168.1.99 M: 192.168.1.222 S: 192.168.1.189 架构图 192.168.1.99 ±----------VIP----------+ | | | | Master Backup 192.168.1.189 192.168.1.222 ±---------+ ±---------+ | HAProxy | | HAProxy | |keepalived| |keepalived| ±---------+ ±---------+ | v ±-------±--------+ | | | | | | v v v ±-----+ ±-----+ ±-----+ | WEB1 | | WEB2 | | WEB3 | ±-----+ ±-----+ ±-----+ 安装HAProxy 安装pcre yum install pcre wget http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.18.tar.gz global maxconn 20480 #默认最大连接数 log 127.0.0.1 local3 #[err warning info debug] chroot /var/haproxy

A - Let the Balloon Rise

吃可爱长大的小学妹 提交于 2020-02-03 22:08:13
Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result. This year, they decide to leave this lovely job to you. Input Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters. A test case with N = 0 terminates the input

[530] C3 Rise Of Darkness Opcodez

生来就可爱ヽ(ⅴ<●) 提交于 2020-02-01 20:27:20
[530] C3 Rise Of Darkness Client 00 SendProtocolVersion 01 MoveBackwardToLocation 02 Say 03 RequestEnterWorld 04 Action 08 RequestLogin 09 SendLogOut 0A RequestAttack 0B RequestCharacterCreate 0C RequestCharacterDelete 0D RequestGameStart 0E RequestNewCharacter 0F RequestItemList 10 RequestEquipItem 11 RequestUnEquipItem 12 RequestDropItem 14 RequestUseItem 15 RequestTrade 16 RequestAddTradeItem 17 TradeDone 1A RequestTeleport 1B SocialAction 1C ChangeMoveType 1D ChangeWaitType 1E RequestSellItem 1F RequestBuyItem 20 RequestLinkHtml 21 RequestBypassToServer 22 RequestBBSWrite 23

HDoj 1004 Let the Balloon Rise

可紊 提交于 2020-02-01 16:23:00
Problem Description Contest time again! How excited it is to see balloons floating around. But to tell you a secret, the judges' favorite time is guessing the most popular problem. When the contest is over, they will count the balloons of each color and find the result. This year, they decide to leave this lovely job to you. Input Input contains multiple test cases. Each test case starts with a number N (0 < N <= 1000) -- the total number of balloons distributed. The next N lines contain one color each. The color of a balloon is a string of up to 15 lower-case letters. A test case with N = 0

HAparoxy《三》——HAProxy高级配置及实用案例

半世苍凉 提交于 2020-01-18 09:32:06
HAparoxy《一》——基础介绍以及安装 HAparoxy《二》——调度算法以及IP透传 基于cookie的会话保持 cookie value:为当前server指定cookie值,实现基于cookie的会话黏性 配置选项 cookie name [ rewrite | insert | prefix ] [ indirect ] [ nocache ] [ postonly ] [ preserve ] [ httponly ] [ secure ] [ domain ] * [ maxidle < idle > ] [ maxlife ] name:cookie 的key名称,用于实现持久连接 insert:如果没有就插入新的cookie indirect:不会向客户端发送服务器已经处理过请求的cookie信息 nocache:当client和hapoxy之间有缓存时,haproxy不缓存客户端cookie,因为客户端浏览器会缓存 cookie并携带cookie访问haproxy 配置示例 listen web_host bind 192.168.7.101:80 mode http log global balance roundrobin cookie SERVER-COOKIE insert indirect nocache server web1 192.168.7

Haproxy压测及参数调优

可紊 提交于 2020-01-14 00:32:56
Haproxy压测及参数调优 [root@3b9d411b-0a16-4bc4-acd8-10f71b997c29 etc]# ss -s&&free -g Total: 102008 (kernel 102040) TCP: 102003 (estab 101812, closed 56, orphaned 77, synrecv 0, timewait 0/0), ports 30060 Transport Total IP IPv6 * 102040 - - RAW 0 0 0 UDP 4 3 1 TCP 101947 101946 1 INET 101951 101949 2 FRAG 0 0 0 total used free shared buffers cached Mem: 7 2 5 0 0 0 -/+ buffers/cache: 2 5 Swap: 0 0 0 先看上面的信息: 这台机器已将建立10w个链接,最高压测到17w左右 但是内存和cpu都没有到达瓶颈 cpu和内存的原因可能是没有用ssl链接都是基于http链接计算量小的缘故,也有可能是vegeta 没有输出足够的压力源导致,后期会完善压测方法,由此说明我们haproxy还有更大潜力挖掘。 下面会介绍单个Haproxy机器上实现这种规模访问所需的配置,和详细的内核调优方法。 测试目标

haproxy调度算法详解二

巧了我就是萌 提交于 2020-01-11 16:31:10
uri 基于对用户请求的uri做hash并将请求转发到后端指定服务器,也可以通过map-based和consistent定义使用取模法还是一致性hash。 http://example.org/absolute/URI/with/absolute/path/to/resource.txt #URI/URL;对于网络来讲既是URL也是URI ftp://example.org/resource.txt #URI/URL /relative/URI/with/absolute/path/to/resource.txt #URI;对于服务器来讲,只是URI uri 一致性hash配置 根据uri做hash运算,用于缓存服务器 listen yewu-service-80 bind 192.168.38.37:80 mode http balance uri #根据用户请求的uri进行调度;uri是属于应用层,所以mode后面的协议类型必须为http协议 hash-type consistent option forwardfor server web1 192.168.38.27:80 weight 1 check inter 3000 fall 3 rise 5 server web2 192.168.38.47:80 weight 1 check inter 3000 fall 3

HDU 1004 Let the Balloon Rise

风格不统一 提交于 2019-12-27 17:44:42
Problem Description Contest timeagain! How excited it is to see balloons floating around. But to tell you asecret, the judges' favorite time is guessing the most popular problem. Whenthe contest is over, they will count the balloons of each color and find theresult. This year, they decide to leave this lovely job to you. Input Inputcontains multiple test cases. Each test case starts with a number N (0 < N<= 1000) -- the total number of balloons distributed. The next N linescontain one color each. The color of a balloon is a string of up to 15lower-case letters. A test case with N = 0

Haproxy1.7部署 vs 端口转发

心已入冬 提交于 2019-12-26 22:39:56
在180安装haproxy 1.监控两个端口10.10.0.180:55500 10.10.0.180:57000 分别映射到177和178对应的reader和writer 2.更改181source的配置,把reader改成180后重新启动 3.测试:在测试端更改地址,登录181的proxy,能否正常登录 注: 监控本机180:55500 并映射到177:55500 实际就是把访问到本机180:55500端口的请求 转发代理到177:55500 访问180的55500端口实际访问的是177:55500 ------------------------------------------------------------------------ 下载地址: http://www.haproxy.org/ 解压后进入其路径下 编译安装:make TARGET=linux2628 prefix=/usr/local/haproxy 注: # uname -a Linux linux-5hpb 3.0.76 -0.11-default #1 SMP Fri Jun 14 08:21:43 UTC 2013 (ccab990) x86_64 x86_64 x86_64 GNU/Linux 查看haproxy的README发现 # make install PREFIX=/usr

hdu 1004 let the ballon rise

断了今生、忘了曾经 提交于 2019-12-03 12:20:08
这一题相对前面两题要简单了许多,很容易想到用map,但是我还是不太适应oj思维,这是我一开始的代码,还没能做出来 #include<iostream> #include<cstring> #include<nap> using namespace std; int main() { int count = 0; int i = 0; string s; cin >> count; while(1) { if(count != 0) { map<int , string> m; for(i = 0 ; i < count ; i++) { cin >> s; int k = 10000; for(auto a = m.begin() ; a != m.end() ; a++) { if(a -> second.compare(s) == 0) { k = a -> first; break; } } if(k != 10000) { m.insert(std::make_pair(1 , s); } else { m.insert(std::make_pair((a -> first)++ , s)); } cout << m.end() -> second << endl; } else return 0; } } return 0; } 问题在于,做oj题没必要存储数据