Monthly Archives: November 2011

火龙“花”?

火龙果(也称龙珠果)的外形独特、果肉清甜,可它的花究竟长什么样?前两天,笨珍家里的火龙果树开花了,拍了几张相片让大家见识见识。

含苞待放的模样。单是花苞就和一般的花朵不同,气势十足。

午夜十二点左右,花瓣完全张开!好大一朵、纯白的花瓣、淡黄的花蕾。

来个侧拍。

火龙果树只在半夜才开花。峰、蝶应该都睡了,不晓得怎么传播花粉。花开多长的时间?不晓得。可是天亮后,它就成了下面的模样。

照片中的这一朵并不是上面三张照片中的同一朵。当晚有两朵一块儿绽开,但距离有些远,没法一块儿入镜。气势十足、外形独特的花苞,绽开后却是意外的纯白和淡黄。成熟后深红的果实、殷红的果肉,大自然用色真大胆。

Extra: 一旁的树上,看见吗?大概有30cm长哦…

Advertisements

Load-balancing Tomcats using Apache Web Server.

My paid job required me to setup a load balanced system consisted of 2 tomcat servers and 1 Apache Web Server.  The requirement was simple:

  1. There were 3 machines (1 for Apache and 2 for tomcat).
  2. Incoming traffic went to Apache and then forwarded to the tomcats.
  3. There were no need to maintain the sessions.  Round robin could be used for load balancing.
  4. The setup should work as a HA: If one tomcat went down, all traffic should go to the working instance.

Make sure both Tomcats and Apache web servers are working fine and they can `talk’ to each other.  Then, just add the following into the Apache web server’s configuration file:

# Load all required modules.
LoadModule proxy_module          /usr/lib/apache2/modules/mod_proxy.so
LoadModule proxy_http_module     /usr/lib/apache2/modules/mod_proxy_http.so
LoadModule proxy_ajp_module      /usr/lib/apache2/modules/mod_proxy_ajp.so
LoadModule proxy_balancer_module /usr/lib/apache2/modules/mod_proxy_balancer.so
LoadModule status_module         /usr/lib/apache2/modules/mod_status.so

# Tomcat must reply within 60 seconds or the connection will timeout.
# All incoming traffic with the URL ending with `/myservice' will be
# sent to one of the two tomcats.
ProxyTimeout        60
ProxyPass           /myservice   balancer://tomcatcluster
ProxyPassReverse    /myservice   balancer://tomcatcluster

# Apache talks to Tomcat using AJP (or commented HTTP) protocol.
# `loadfactor' determines the load distribution for the members.
# Use `ping' to test whether the member is up before sending the request.
<Proxy balancer://tomcatcluster>
    BalancerMember  ajp://tomcat1_ip:8009/myservice loadfactor=1 ping=100
    BalancerMember  ajp://tomcat2_ip:8009/myservice loadfactor=1 ping=100
    # BalancerMember  http://tomcat1_ip:8080/myservice loadfactor=1 ping=100
    # BalancerMember  http://tomcat2_ip:8080/myservice loadfactor=1 ping=100
</Proxy>

# Point your browser at http://localhost/balancer-manager from the machine
# running the Apache Web Server to access the load balancer manager.
<Location /balancer-manager>
    SetHandler balancer-manager
    Order      Deny,Allow
    Allow from localhost ip6-localhost
</Location>

Restart the Apache Web Server and start sending traffic to it.