<<上篇 | 首页 | 下篇>>

使用nginx sticky模块实现基于cookie的负载均衡

1、nginx sticky 模块工作流程图

ip_hash

nginx sticky

2、下载安装nginx sticky
下载地址:http://code.google.com/p/nginx-sticky-module/downloads/list
目前共有2个版本,一个是1.0,一个是1.1,1.0已经寿终正寝了.1.1增加了权重的参数.

安装nginx + sticky模块

# wget http://nginx-sticky-module.googlecode.com/files/nginx-sticky-module-1.1.tar.gz
# tar -xzvf nginx-sticky-module-1.1.tar.gz

# wget http://nginx.org/download/nginx-1.0.6.tar.gz
# tar -czvf nginx-1.0.6
# cd nginx-1.0.6
# ./configure --prefix=/usr/local/nginx-1.0.6 --with-http_stub_status_module --with-http_ssl_module --with-http_realip_module --add-module=../nginx-sticky-module-1.1
# make
# make install

3、配置nginx sticky

nginx 的upstream使用sticky,如下

upstream cluster_test {
     sticky;
     server 192.168.100.209:80;
     server 192.168.100.225:80;
}

配置虚拟主机(以下有配置的可以忽略掉)

server {
        listen        80;
        server_name     test.ttlsa.com;
        index index.jsp;

        access_log /data/logs/nginx/test.ttlsa.com_access.log main;

        set $proxy_pass cluster_test;

        location /
        {
                proxy_pass http://$proxy_pass;
                include proxy.conf;
                add_header Cache-Control no-store;
        }

}

备注:
nginx和apache不同,nginx每次安装一个新的模块都需要重新编译一次,编译完成之后将nginx这一个文件拷贝到sbin下面即可.我这边全新安装一次,因为公司在两年前就选择了这个nginx版本,也没打算去换,所以大家可以把nginx换成自己最合适的一个版本,不用完全跟着文章来安装.

阅读全文……

标签 : , ,

Centos6.3禁用IPv6 - poijm - 博客频道 - CSDN.NET

在操作系统中禁用 IPv6 是没用的,这个需要在 JVM 中禁用 IPv6 特性,加入以下参数即可:

 

-Djava.net.preferIPv4Stack=true

 

IPv6 还没有完全普及,但是安装完系统之后IPv6是有效的,在一定程度上影响网络性能,所以在我们在完全不使用IPv6的情况下,最好关闭IPv6。。

1.修改/etc/sysconfig/network,追加:

 

[plain] view plaincopy
 
  1. NETWORKING_IPV6=no  

2.修改/etc/hosts,把ipv6的那句本地主机名解析的也注释掉:

 

#::1   localhost localhost6 localhost6.localdomain6

3.让系统不加载ipv6相关模块,这需要修改modprobe相关设定文件/etc/modprobe.d/dist.conf。

 

[plain] view plaincopy
 
  1. alias net-pf-10 off  
  2. alias ipv6 off  


4.重启系统,然后确认:

 

[root@test ~]# lsmod | grep -i ipv6
[root@test ~]# ifconfig | grep -i inet6
如果上述2个命令执行的结果没有任何显示,那么说明ipv6已经被完全禁止了。

阅读全文……

标签 :

java.sql.SQLException: OALL8 is in an inconsist... | Oracle Community

org.eclipse.birt.report.engine.api.EngineException: Cannot get the result set metadata.

SQL statement does not return a ResultSet object.

SQL error #1: 关闭的连接

SQL error #1:OALL8 处于不一致状态。

以下是可能的问题以及解决办法:

1, This error occurred for me because I made a change to a db table (added a column) and did not restart the application server to refresh the connection pools. So the prepared statements were still cached by the connections and needed to be refreshed.

2, I use weblogic 10.3 , ojdbc6.jar and my RAC is ojdbc14.jar.I use Spring. I often get that error of OALL8 being inconsistent. Real Cause is Network. If you see above in somebody's error codes, it says Invalid Packet length, which cannot be changed by us except network layer.
In my case too, I think network layer writes headers rampantly making Oracle 10G Dysfunction. I also get Closed Connection afterwards. So, Please check your router firewalls that is eating our jdbc sockets, and oracle would never know if connecting entity has passed away, disconnected, or network Slow speed made it assume erroneous situation.

3, "OALL8 is in an inconsistent state" is a generic exception that occurs in JDBC 10.1, 10.2, and 11.1. It indicates that an internal inconsistency has been detected in the JDBC connection but it does not provide information on what caused the inconsistency. The exception no longer occurs in JDBC 11.2. The error is usually caused by a bug in the JDBC code. These are very hard to analyze. The simplest solution is to upgrade the JDBC driver.

阅读全文……