对于 Sun Java System Web Server,当您安装负载平衡器插件时,安装程序会自动进行所有必需的配置。不需要进行手动配置。
安装程序将以下条目添加到 Sun Java System Web Server 的配置文件中:
向 Web Server 实例的 magnus.conf 文件添加以下条目:
##EE lb-pluginInit fn="load-modules" shlib="web-server-install-dir/plugins/lbplugin/bin/libpassthrough.so" funcs="init-passthrough,service-passthrough,name-trans-passthrough" Thread="no" Init fn="init-passthrough" ##end addition for EE lb-plugin
向 Web Server 实例的 obj.conf 文件添加以下条目:
<Object name=default> NameTrans fn="name-trans-passthrough" name="lbplugin" config-file="web-server-install-dir/web-server-instance/config/loadbalancer.xml" <Object name="lbplugin"> ObjectType fn="force-type" type="magnus-internal/lbplugin" PathCheck fn="deny-existence" path="*/WEB-INF/*" Service type="magnus-internal/lbplugin" fn="service-passthrough" Error reason="Bad Gateway" fn="send-error" uri="$docroot/badgateway.html" </object>
在以上代码中,lbplugin 是唯一标识 Object 的名称,web-server-install-dir/web-server-instance/config/loadbalancer.xml 是负载平衡器被配置为在其上运行的虚拟服务器 XML 配置文件的所在位置。
NameTrans 条目在 obj.conf 中的显示顺序非常重要。安装程序会将 NameTrans 条目放在正确的位置,但是,如果要因其他目的而编辑 obj.conf,必须确保顺序仍然正确。尤其是,负载平衡器信息必须在 document-root 函数之前显示。有关 obj.conf 文件的更多信息,请参见《Sun Java System Web Server 7.0 Administrator’s Configuration File Reference》。
安装后,请按照设置 HTTP 负载平衡中所述配置负载平衡器。