Author Topic: install ipvs loadbalance in debian และประเภทของ load balance persistence cookie  (Read 27785 times)

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
#ipvs + Heartbeat + Debian4.0 R1 (NAT Mode) ต้องทำ static nat ที่ loadbalance ด้วย

LB1 = install Debian 4.0 R1
LB2 = install Debian 4.0 R1

##Add this in /etc/apt/sources.list
deb http://www.ultramonkey.org/download/3/sargemain
deb-src http://www.ultramonkey.org/download/3sarge main
deb http://ftp.coe.psu.ac.th/debianstablemain
deb-src http://ftp.coe.psu.ac.th/debianstable main

#apt-get update
#apt-get install ultramonkey

ปกติถ้า ทำ HA จะมี config หลักๆ 3 ตัวคือ
#/etc/ha.d/ha.cf , haresources , authkeys
ส่วนของ ipvs จะให้อ่านจากไฟล์ config /etc/ha.cf/ldirectord.cf

#Diagram ก็ประมาณนี้ครับ




####LB1

#vi /etc/ha.d/ldirectord.conf
# Global Directives
checktimeout=10
checkinterval=2
#fallback=127.0.0.1:80
autoreload=no
logfile=\"/var/log/ldirectord.log\" #เก็บไฟล์log ของ ldirector
logfile=\"local0\"
quiescent=yes

# Virtual Server for HTTP
virtual=10.0.1.152:80
real=192.168.0.4:80 masq 2
real=192.168.0.5:80 masq 1
service=http
request=\"test.html\"
receive=\"Test Page\"
scheduler=wrr
#persistent=600
protocol=tcp
checktype=negotiate


#vi haresources

lb1 ldirectord::ldirectord.cf
lb1 LVSSyncDaemonSwap::master
lb1 IPaddr2::10.x.x.152/23/eth0
lb1 IPaddr2::192.z.x.254/24/eth1
-----------------------------------------------------

---------------------------------------
lb1:/etc/ha.d# more authkeys
auth3
#1 crc
3 sha1 ultramonkey


lb1:/etc/ha.d# more ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
bcast eth1 # Linux
mcast eth1 225.0.0.1 694 1 0
auto_failback on
node lb1
node lb2
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster


--------------------------------------------------


####LB2
#vi /etc/ha.d/ldirectord.conf
# Global Directives
checktimeout=10
checkinterval=2
#fallback=127.0.0.1:80
autoreload=no
logfile=\"/var/log/ldirectord.log\"
logfile=\"local0\"
quiescent=yes

# Virtual Server for HTTP
virtual=10.0.1.152:80
real=192.168.0.4:80 masq 2
real=192.168.0.5:80 masq 1
service=http
request=\"test.html\"
receive=\"Test Page\"
scheduler=rr
#persistent=600
protocol=tcp
checktype=negotiate


haresource จะเอาไว้สร้างตัว vip ให้เราน่ะครับ ก็ไม่มีไรมาก 2 ตัวต้องเหมือนกันน่ะครับทั้ง ตัว
master(lb1) กับ slave(lb2)
เพราะว่า
#vi haresources

lb1 ldirectord::ldirectord.cf
lb1 LVSSyncDaemonSwap::master
lb1 IPaddr2::10.x.x.152/23/eth0
lb1 IPaddr2::192.z.x.254/24/eth1

-----------------------------------------------------

Lb2:/etc/ha.d# more authkeys
auth3
#1 crc
3 sha1 ultramonkey


Lb2:/etc/ha.d# more ha.cf
debugfile /var/log/ha-debug
logfile /var/log/ha-log
logfacility local0
bcast eth1 # Linux
mcast eth1 225.0.0.1 694 1 0
auto_failback on
node lb1
node lb2
respawn hacluster /usr/lib/heartbeat/ipfail
apiauth ipfail gid=haclient uid=hacluster





##Set static nat in loadbalance1 and loadbalance2

#vi /etc/rc.local
iptables -t nat -F
iptables -t nat -A POSTROUTING -j SNAT -o eth1 -s 192.168.0.4 --to 10.x.x.x
iptables -t nat -A POSTROUTING -j SNAT -o eth1 -s 192.168.0.5 --to 10.x.x.x

สั่งให้ อ่าน rc.local ก็
#/etc/rc.local

#เสร็จแล้ว ก็มาทำ ตัวroute สำหรับผมมาติดปัญหาตรงจุดนี้ครับ ซึ่งลองใช้ tcpdump ช่วยก็เห็นว่า packet
มันไม่ส่งจากเครื่อง Rip(192.168.0.4) กับ จุด 5 ไปยังเครื่อง loadbalance
ตรงจุดนี้สำคัญมากน่ะครับคือต้องเรียนรู้เรื่อง network routing table ให้พอเข้าใจก่อน
#netstat -nr
lb1:/home/golf# netstat -nr
Kernel IP routing table
Destination Gateway Genmask Flags MSS Window irtt Iface
192.168.0.0 0.0.0.0 255.255.255.0 U 0 0 0 eth2
10.0.0.0 0.0.0.0 255.255.254.0 U 0 0 0 eth1
0.0.0.0 10.x.x.x 0.0.0.0 UG 0 0 0 eth1
0.0.0.0 192.168.0.254 0.0.0.0 UG 0 0 0 eth2

***#route add -net 0.0.0.0/0 gw 10.0.0.254 dev eth1
***#route add -net 0.0.0.0/0 gw 192.168.0.254 dev eth2
***#route add -net 192.168.0.0 netmask 255.255.255.0 dev eth2


แล้วก็มา set ให้ เครื่อง loadbalance forward packet มาให้เครื่อง Rip น่ะครับ
#sysctl -a | grep forward
#vi /etc/sysctl.conf
Add
net.ipv4.ip_forward = 1
แล้วสั่งให้ show ค่าออกมาดูน่ะครับ
#sysctl -p

ส่วนเครื่อง web1 / web2
ก็ลงเป็น
#web1 os linux(debian4)
#ip 192.168.0.4
เครื่องฝั่ง internal ก็ไม่มีไรมากครับ ลง app ที่เราจะต้องใช้ แล้วก็จูน ให้เสร็จ ก็เปิดรับ service
ให้ใช้งานได้ก็จบครับ

#set ip
#vi /etc/network/interface
allow-hotplug eth0
iface eth0 inet static
address 192.168.0.4
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.254


#web2 os Freebsd(6.2)
#ip 192.168.0.5

#vi /etc/rc.conf
ifconfig_dc0=\"inet 192.168.0.5 netmask 255.255.255.0\"

ให้มัน restart network 1 ดอก
#/etc/rc.d/netif restart

คราวนี้ลองใช้ telnet เข้า vip ที่เรา set ไว้ดูน่ะครับ
ดังนี้
#telnet x.x.x.x 80
ลอง GET ดูน่ะครับ ถ้าได้ค่าว่า Test Page ก็แสดงว่า work แระ


คำสั่งที่จะใช้งานตรวจสอบว่า มี packet เข้ามาในเครื่องผ่าน nat เปล่าก็
#watch -n 1 "iptables -L -n -t nat -xv"

คำสั่งนี้เอาไว้ track ปัญหาน่ะครับ แล้วให้เขียน output ไปไว้ที่ xx.txt แล้วก็ค่อยไปไล่ๆ ดู
#tcpdump -n -i any port 80 > xx.txt

ดูว่า load balance ทำงานแบบ real time ก็
#watch -n 1 "ipvsadm -L -n --stats"
ได้ครับ

----------------------------------------------------------------------------------------------------


---
ในงานที่ต้องรับ connection ที่เยอะๆ นั้นการทำ load balance ก็สามารถช่วยแก้ปัญหาได้ครับ
ทำให้ประสิทธิภาพของงานทำได้ดีมากขึ้น แต่บางครั้งในส่วนของ software ก็อาจจะยังมีบางจุดที่ยังไม่ค่อย
stable พอหรือตาม config ที่อาจจะมีบางจุดที่นักพัฒนายัง implement อยู่
ซึ่งถ้ามองแล้วจะทำงานได้ไม่เท่ากับพวก hardware จริงๆ ซึ่งตัว hareware loadbalance
ค่อยข้างจะมีมาตรฐานพอสมควร ซึ่งพวกองค์กรที่ต้องการ performance แล้วก็แนะนำเป็น hareware (F5)
ดีกว่าครับ แพงดีแต่ก็คุ้มครับ

Lab By
http://www.packetlove.com
golfreeze@packetlove.com
ขอบคุณพี่อัท http://www.siambox.com ที่แนะนำเรื่อง route ครับ และคำแนะนำ อิอิ
« Last Edit: มิถุนายน 11, 2013, 09:09:49 AM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #1 on: มกราคม 23, 2011, 12:44:57 AM »
สำหรับ ipvsadm version 1.2.1 ถ้าท่านไหนใช้ ให้ load balance ตัว
pop3 กับ imap protocol ล่ะก็ต้องลง patch module เพิ่มด้วยน่ะครับ

ของผมใช้งานเป็น debian 4.0 R1 ก็ search packet โดย

#apt-cache search ldirectord
ถ้ามี ก็สั่ง install โดย
#apt-get install ldirectord2
ซึ่งจะทำการ โหลด module ของ libmail-pop3client-perl
ซึ่งจะทำให้สามารถ load balance application ที่เป็น pop กับ imap ได้ครับ

เสร็จก็ทำการ restart service ipvs 1 รอบโดย

#/etc/init.d/heartbeat restart

แล้วลอง ipvsadm -l ดูครับ load ก็จะทำการ balance ไปที่ pop client

golfreeze[at]packetlove.com

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #2 on: มกราคม 23, 2011, 12:45:10 AM »
อีกคำสั่งที่เอาไว้ check ip addr ของ virtual ip คือ
#ip addr sh

ก็จะมีดังนี้ ครับ

2: eth0: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:11:25:f1:ef:7d brd ff:ff:ff:ff:ff:ff
inet 10.0.1.149/23 brd 10.0.1.255 scope global eth0
inet 10.0.1.152/23 brd 10.0.1.255 scope global secondary eth0
inet6 2001:d90:10:101:211:25ff:fef1:ef7d/64 scope global dynamic
valid_lft 2591980sec preferred_lft 604780sec
inet6 fe80::211:25ff:fef1:ef7d/64 scope link
valid_lft forever preferred_lft forever
3: eth2: <BROADCAST,MULTICAST,UP,10000> mtu 1500 qdisc pfifo_fast qlen 1000
link/ether 00:80:48:13:56:1c brd ff:ff:ff:ff:ff:ff
inet 172.16.0.2/29 brd 172.16.0.7 scope global eth2
inet6 fe80::280:48ff:fe13:561c/64 scope link
valid_lft forever preferred_lft forever

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #3 on: มกราคม 23, 2011, 12:45:28 AM »
ถ้าทำแล้ว มี error สั่งให้ start service ไม่ได้ ตอน ดู
สั่ง /etc/init.d/heartbeat stop
/etc/init.d/heartbeat start
Ldirectord is stopped for /etc/ha.d/ldirectord.cf
แล้วจะเกิดเป็น heartbeat failure [rc=xxx] failed

ให้เข้าไป check ที่ไฟล์ config เพราะอาจจะ กำหนด ตัว ชื่อ ethX ผิดในไฟล์
Ldirectord.cf , ha.cf
แล้วสั่ง start อีกรอบ ดู จะได้ครับ

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #4 on: มกราคม 23, 2011, 12:46:02 AM »


สำหรับ network ที่ทำก็ตามรูป นี้น่ะครับ

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #5 on: มกราคม 23, 2011, 12:46:13 AM »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #6 on: มกราคม 23, 2011, 12:46:36 AM »
ถ้าใครใช้เป็น debian 4.0 R1 เป็นแบบ 64 bit ก็ตั้ง

deb http://ftp.thaios.net/debian/etch main
deb-src http://ftp.thaios.net/debian/etch main

สำหรับ kernel ที่เป็น verion "lenny"
ตั้งไปที่
deb http://ftp.de.debian.org/debianlenny main
deb-src http://ftp.de.debian.org/debianlenny main

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #7 on: มกราคม 23, 2011, 12:46:47 AM »
check package วิ่งผ่าน firewall โดย command line
#watch -n 1 "iptables -t nat -L -xv"
check load วิ่งเข้า load balance ดู connection ต่างๆ
#watch -n 1"ipvsadm -L -n --stats"

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #8 on: มกราคม 23, 2011, 12:47:17 AM »
set SNAT ด้วยครับ

#iptables -t nat -A POSTROUTING -j SNAT -o ethขาที่ออกไป -s จากipไหน --to ออกไปipไหน


### เกี่ยวกับ ipvsadm

http://docs.huihoo.com/hpc-cluster/linux-virtual-server/HOWTO/index.html

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #9 on: พฤศจิกายน 14, 2011, 05:11:47 PM »
ทำเสร็จแล้วก็ทำการ forward traffic ด้วยนะครับที่เครื่อง Load balance

#vi /etc/sysctl.conf

# Controls IP packet forwarding
net.ipv4.ip_forward = 1

#sysctl -p

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
Re: install ipvs loadbalance in debian
« Reply #10 on: มกราคม 23, 2012, 09:00:10 AM »
ในกรณีใช้ Ldirectord บน centos

ถ้า load balance pop protocol ไม่ได้
ผมได้ลอง debug ดูพบว่าขาด package perl ตัว POP3Client ครับ ทำการลงได้คือ

#perl -MCPAN -e shell

> install Mail::POP3Client

exit

แล้วทำการ reload service ldirectord 1 รอบก็ใช้งาน load balance ให้เข้า pop protocol ได้ครับผม

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
สำหรับหลักและวิธีของ Load-Balancing แบ่งเป็น 4 แบบหลักๆคือ

1.Round Robin  เป็นหลักการที่คุ้นตาสำหรับ admin ทั่วๆไป คือจะแบ่งงาน โดย ส่ง connection ไปยัง node ลูกอย่างละเท่ากัน โดยวนครบในแต่ละรอบ จะมีเครื่องได้รับ connection นั้นเท่ากัน ซึ่งการทำงานจะคล้ายๆ DNS round robin แต่ถือได้ว่าเหนือกว่า DNSround robin เพราะไม่มีการล่าช้า หรือ delay และไม่มีปัญหาเรื่อง cache เหมือน DNSroundrobin

2.Least Connections
คือเป็นการทำงานแบบ dynamic load balance ซึ่งจะมีการเชคก่อนว่า
เครื่องใดที่มี connection น้อยสุด ก็จะส่ง connection ใหม่ไปยังเครื่อง node ตัวนั้นทันที
วิธีนี้ เป็นวิธีที่มีประสิทธิภาพการทำงานได้เจ๋งที่สุด ผมคิดว่า เพราะใช้งานแบบนี้อยู่ การทำงานทำได้ไวมาก ไม่ต้องเสียเวลาคำนวณจำนวน weight เหมือน WRR

3.Weight Round robin (WRR) หลักการทำงานคล้ายๆ Round robin ครับแต่จะสามารถแบ่งน้ำหนักให้กับแต่ละ node ได้ในกรณีที่เรามีเครื่อง node 3 เครื่อง
แบบเครื่องสเปกใหม่ แรงมาก 1 เครื่อง กับสเปกเก่ากาก 2 เครื่อง แต่อยากนำมาช่วยงานเครื่องใหม่
ก็สามารถ แบ่งน้ำหนักให้เครื่องสเปกแรงๆ 50% เครื่องสเปกเก่า 2 เครื่องๆละ 25%

4.IP Hashing เป็นการ map ip ไปยัง node เพื่อให้แยก connection ไปยัง node ต่างๆได้เลย
โดยตัว Load balance จะเชคให้ว่า ip ที่เข้ามา map ก็ node ใด และ range ip ไหนก็จะจับโยนงานให้ node นั้นๆเลย

หรือลองอ่านเพิ่มเติมได้นะครับผม

Round Robin

The default algorithm, round-robin , keyword directs the network connection to the next server, and treats all servers as equals, regardless of the number of connections or response time. Although the CSM round-robin predictor appears similar to a Domain Name System (DNS) round-robin, it is superior because no propagation delay or caching hinders the algorithm.

Least Connections

The leastconns keyword directs network connections to the server with the fewest connections. Although it may not be intuitively obvious that the leastconns predictor would provide effective load balancing, in fact, it is quite successful. On Web sites where there is a collection of servers with similar performance, the leastconns predictor is effective in smoothing distribution when a server becomes bogged down. On Web sites where there are large differences in the capacity of various servers, the leastconns predictor is also very effective. In maintaining the same number of connections to all servers, those servers that are capable of processing (and thus terminating) connections the fastest receive more connections over time. A server deemed to be twice as powerful as another server receives about twice as many connections per second.

Weighted Round Robin and Weighted Least Connections

The weighted keyword allows you to assign a performance weight to each server. Weighted load balancing is similar to the function of the leastconns and round-robin keywords, however, servers with a higher weight value receive a larger percentage of connections at any one time. CSM administrators can assign a weight to each real server, and the CSM uses this weight to determine the percentage of the current number of connections to give each server.

Issue the weight command in the SLB real server configuration submode to configure the capacity of the real servers in relation to the other real servers in the server farm. Issue the no form of this command to change the server's weight to its default capacity.

weighting-value is the value to use for the server farm predictor algorithm. The range is from 1 to 100. The default weight is 8. For example, in a configuration with five servers, the percentage of connections is calculated as follows:

    Server Number               Number of Connections

    Weight of server 1                         7
    Weight of server 2                         8
    Weight of server 3                         2
    Weight of server 4                         2
    Weight of server 5                         5

    Total weight of all servers               24

This distribution results in server 1 getting 7/24 of the current number of connections, server 2 getting 8/24, server 3 getting 2/24, and so on. If a new server, server 6, is added with a weight of 10, it receives 10/34, and so on.
Source and/or Destination IP Hash (Subnet Mask Configurable)

Source or destination IP hash
method maps the IP address in the request to a real in a server farm. The configuration options are shown below.

    predictor ip-hash netmask [source | destination] [netmask]          

    !--- Source IP hash or predictor hash address.
      

The default (netmask) is 255.255.255.255. The hash value is produced with the following algorithm:

ip_addr = (Src_or_Dest_Ip_addr & Cfg_Netmask) hash_index = (ip_addr) + (ip_addr >> 8) + ip_addr >> 16) + (ip_addr >> 24);


URL Hashing

URL hashing maps the URL (or portion) for the request to a real in a server farm. To specify only a portion of the URL, you need to configure the starting and/or ending keyword strings. This configuration is per vserver <vs-nam> object.

    url-hash begin-pattern str [end-pattern str]

All characters in the keywords are included in the hash-value. In order to map it to a real, the CSM looks at the first few bits in the hash-value. If this real is disabled, the CSM finds the next available real in the list. In release 2.2(3) and later, the CSM looks at the higher bits in the hash-value if the first hash bits mapped to a disabled real. If the CSM cannot find an enabled real, it looks sequentially for the next available real.

Forward

Use the forward keyword to tell the CSM to forward traffic in accordance with its internal routing tables.

Note: The nat server command has no effect when the predictor forward command is configured; this is because the servers cannot be configured.
« Last Edit: มิถุนายน 11, 2013, 09:28:37 AM by golfreeze »

golfreeze

  • Administrator
  • Hero Member
  • *****
  • Posts: 2140
    • View Profile
    • นั่งสมาธิ สติปัฏฐานสี่ พาเที่ยววัด แนะนำวัด แจกcd ธรรมะฟรี
    • Email
สำหรับ Persistence หลายท่านอาจจะสงสัย ว่ามันคือค่าไร

ปกติแล้วการใช้งาน Persistence สามารถใช้งานได้กับสองแบบคือ

1. Cookie
2. Source IP Address

ลองนึกภาพการทำงาน ถ้า ใน Load balance pool คุณมี HTTP node อยู่สัก 4 เครื่อง
และแต่ละเครื่องทำการเก็บ session ของ client ที่ทำการเข้าไปเรียกเว็บ เอาไว้

แต่จังหวะ ที่คุณลุกไปทำธุระ แล้วจะกลับเข้ามาใน session ที่คุณเข้านั้นตัว Persistence จะเป็นตัวช่วยควบคุมให้กลับเข้ามาที่ HTTP node เดิม
โดยการกำหนดค่า COOKIE เป็นหมายเลขอ้างอิง เก็บข้อมูลไว้ที่ Load balance และแสดงข้อมูล
เลข COOKIE ใน Header ของ Browser เพื่อทำการเก็บค่าอ้างอิงไว้ที่ Browser ของ Client อีกทีหนึ่ง

ลองมาดูกันครับ สำหรับการเข้าใช้งาน Persistence=Yes , COOKIE name= SCHTTP

HTTP/1.1 200 OK
Date: Tue, 11 Jun 2013 01:33:34 GMT
Server: Apache
Last-Modified: Tue, 11 Jun 2013 01:25:05 GMT
Accept-Ranges: bytes
Content-Type: text/html
Content-Length: 40
Connection: close
Set-Cookie: SCHTTP=R3471322658; path=/
Age: 0

เมื่อทำการเชค Header จะเห็นว่ามีการแปะ เลข Cookie = SCHTTP=R3471322658
ไว้เพื่อเป็นการอ้างอิง ในการ เข้าใช้งานของ client ณ Browser เดิม และ เครื่องคอมเครื่องเดิม

ส่วนการ X-Forwarded-for เป็นการเก็บว่า client ได้ผ่านเข้ามาผ่าน proxy ip เครื่องไหนบ้าง ในกรณีที่มี proxy server หลายตัว
เพื่อใช้ในการ track ปัญหาได้ว่าเกิดปัญหาขึ้นที่ node ใด และเป็นการอ้างอิง flow ของการเข้าถึง server ใน load balance pool นั้นๆ ด้วย

ตัวอย่างของ X-Forwarded-For

HTTP/1.1 200 OK
X-Forwarded-For: 172.16.0.1
Date: Tue, 11 Jun 2013 01:35:39 GMT
Server: Apache
Last-Modified: Tue, 11 Jun 2013 01:25:05 GMT

แสดงว่าผ่านการทำงานที่ มา node เดียว ก็สามารถเข้าถึง content ที่ต้องการครับผม  ;)
« Last Edit: มิถุนายน 11, 2013, 09:28:48 AM by golfreeze »