一:配置windows2003 NLB功能.
-
前提条件:准备两台windows2003服务器,3个IP地址,其中两个IP绑定到两台服务器(处于NBL中的服务器必须手工指定IP),最好配置两台服务器 网关、DNS服务器相同。另外一个IP作为NBL上的虚拟IP.
关闭两台window2003服务器上的防火墙。
-
请按照NLB_Config.wnk中的截图配置NLB(不知道怎么传)。
二:配置Apache服务器和mobilink redirector.(先看asa帮助文档中的 redirector)
-
前提条件:准备ASA10.0.1.3689或者更高版本,apache_2.0.63-win32-x86-openssl-0.9.7m.msi.在加入nlb的两台windows2003服务器上面安装apache,在数据库服务器上安装asa10.0.1.3689,在此假设一下:
NLB虚拟ip: 192.168.86.1
NLB服务器子机一:192.168.86.101
NLB服务器子机二:192.168.86.102
数据库服务器: 192.168.86.2
-
由于数据在网络上传输需要加密,mobilink和apache采取https协议,我们先为它们创建安全证书(安全证书的加密方式为ECC或RSA,RSA加密不需要额外购买,在此以RSA加密为例),asa10为 我们提供了工具createcert.exe,位于/SQL Anywhere 10/win32目录下。创建方法为,在数据库服务器上(或者安装了asa10的机器上),在命令行中输入
createcert,会出现以下提示
SQL Anywhere X.509 Certificate Generator Version 10.0.1.3689, 依据提示输入以下内容(黑体部分为需要输入的,'//'后的为注释)
Choose encryption type ((R)SA or (E)CC): R //没有购买不会出现此行
Enter RSA key length (512-16384): 2048
Generating key pair...
Country Code: CA //根据需要修改
State/Province: ON //根据需要修改
Locality: Waterloo //根据需要修改
Organization: Sybase iAnywhere //根据需要修改
Organizational Unit: Technical Support //根据需要修改
Common Name: Apache Certificate //根据需要修改,mobilink会用到
Enter file path of signer's certificate:
Certificate will be a self-signed root
Serial number [generate GUID]:
Generated serial number: 8cf1176d05e443e198c360093e176365
Certificate valid for how many years (1-100): 30 //过期期限
Certificate Authority (Y/N) [N]: N //选择NO
1. Digital Signature
2. Nonrepudiation
3. Key Encipherment
4. Data Encipherment
5. Key Agreement
6. Certificate Signing
7. CRL Signing
8. Encipher Only
9. Decipher Only
Key Usage [3,4,5]:
Enter file path to save certificate:c:/dbmlsync.crt//mobilink客户端cert
Enter file path to save private key: c:/apache-pw.key//apache服务器key
Enter password to protect private key: password//根据需要更改
Enter file path to save identity: c:/apache.crt//apache服务器cert
以上创建的cert为mobilink客户端到apache服务器通讯时用到,接下来还需要创建apache到
mobilink服务器通讯的cert:
Choose encryption type ((R)SA or (E)CC): R //没有购买不会出现此行
Enter RSA key length (512-16384): 2048
Generating key pair...
Country Code: CA //根据需要修改
State/Province: ON //根据需要修改
Locality: Waterloo //根据需要修改
Organization: Sybase iAnywhere //根据需要修改
Organizational Unit: Technical Support //根据需要修改
Common Name: MobiLink Certificate //根据需要修改
Enter file path of signer's certificate:
Certificate will be a self-signed root
Serial number [generate GUID]:
Generated serial number: 8cf1176d05e443e198c360093e176365
Certificate valid for how many years (1-100): 30 //过期期限
Certificate Authority (Y/N) [N]: N //选择NO
1. Digital Signature
2. Nonrepudiation
3. Key Encipherment
4. Data Encipherment
5. Key Agreement
6. Certificate Signing
7. CRL Signing
8. Encipher Only
9. Decipher Only
Key Usage [3,4,5]:
Enter file path to save certificate:c:/apache-cli.crt//apache cert
Enter file path to save private key: c:/mobilink-pw.key//mobilink服务器key
Enter password to protect private key: password //根据需要更改
Enter file path to save identity: c:/mobilink.crt//mobilink服务
完成以上步骤后,还需要对apache-pw.key进行一次加密才能被apache识别,方法为apache
提供的openssl:
C:/Program Files/Apache Group/Apache2/bin/openssl rsa -in apache-pw.key –passin pass:password -out apache.key
-
配置mobilink服务器端和客户端
①服务器端配置(假设mobilink服务器放在放在nlb服务器的两台子机上)
将步骤2中创建的mobilink.crt,mobilink-pw.key,apache.crt,apache-
cli.crt,apache.key复制到nlb服务器的两台子机上,例如c:/cert目录中配置
mobilink服务器的-x属性为
子机一:192.168.86.101
–x https(host=192.168.86.101;port=7101;tls_type=rsa;certificate=mobilink.crt;certificate_password=password)
子机二:192.168.86.102
–x https(host=192.168.86.102;port=7102;tls_type=rsa;certificate=mobilink.crt;certificate_password=password)
②客户端配置,复制dbmlsync.crt到pda程序目录下面
修改mlsync.ini中
Extended_Args=CTP=https;adr='host=192.168.86.1;port=443;
trusted_certificates=c:/cert/dbmlsync.crt;certificate_name=
Apache Certificate;url_suffix=/iaredirect/ml/'
对以上配置进行解释
host=192.168.86.1//nlb虚拟IP,从而达到到nlb中一台子机关机,那么mobilink则
访问另外一台子机.
port=443//apache服务器的https默认端口,可根据需要修改apache https端口,但是
确保两台子机的https端口相同。
certificate_name=Apache Certificate//建cert时候的Common Name
url_suffix=/iaredirect/ml/ //查看mobilink redirector帮助
-
配置apache ssl.
进入nlb中的一台子机,打开apache的安装目录,找到/conf/httpd.conf ,用文本编辑器
打开,其中会有一行
#LoadModule ssl_module modules/mod_ssl.so ,去掉前面的‘#’;找到
Include conf/ssl.conf
如果前面有‘#’则去掉‘#',如果没有找到上面代码则添加
找到/conf/ssl.conf ,用文本编辑器打开它,找到
SSLCertificateFile conf/ssl.crt/server.crt
修改为
SSLCertificateFile c:/cert/apache.crt
找到
SSLCertificateKeyFile conf/ssl.key/server.key
修改为
SSLCertificateKeyFile c:/cert/apache.key
用下面命令行重新配置apache
o cd /Program Files/Apache Group/Apache2/bin
o apache -k stop
o apache -k uninstall
o apache -k install -D SSL
o apache -k start
用以下查看是否成功配置apache ssl
https://server:port/
-
配置apache mobilink redirector
-
复制
/SQL Anywhere 10/MobiLink/redirector/apache/v20/mod_iaredirect.dll
到目录 C:/Program Files/Apache Group/Apache2/modules
-
打开/Apache2/conf/httpd.conf 添加以下代码
LoadModule iaredirect_module modules/mod_iaredirect.dll
SetHandler iaredirect-handler
iaredirectorConfigFile conf/redirector.conf
-
在/Apache2/conf目录下新建 redirector.conf,加入一下代码
ML_CLIENT_TIMEOUT=200
SLEEP=5
LOG_LEVEL=2
ML="https=true;host=192.168.86.101;port=7011;trusted_certificates=c://cert//apache-cli.crt"
ML="https=true;host=192.168.86.102;port=7012;trusted_certificates=c://cert//apache-cli.crt"
此处的host,port分别为mobilink服务器的host和port.
-
重新启动apache服务器,验证apache mobilink redirector是否成功
在IE中输入
https://host:port/iaredirect/ml/
提示安全证书问题对话框,点击‘是’或者‘YES’
出现HTTP 400错误
到此说明apache mobilink redirector在此台机器上配置成功。
-
在另外一台NLB子机上面重复步骤4、5
-
配置完以上后验证nlb即apache mobilink redirector时候可以正常运作
case1:nbl服务器两台子机正常开启,当然上面的apache也要正常开启,在PDA上
跑Mobilink
case2:关闭其中一台nlb子机,在PDA上跑MOBILINK
case3:开启另外一台nlb子机,在PDA上跑MOBILINK
case4:关闭一个mobilink server,在PDA上跑mobilink
如果以上可以正常运行mobilink,那么配置成功!