22.9. Microsoft ISAPI Connector
Internet Server API (ISAPI)是一组 API,用于为 Microsoft 的 Internet Information Services (IIS)等 Web 服务器编写 OLE 服务器扩展和过滤器。isapi_redirect.dll
的扩展是 mod_jk 的扩展,经过调整到Sign。isapi_redirect.dll
可让您将 JBoss EAP 实例配置为 worker 节点,将 OC 配置为负载均衡器。
有关 Windows Server 和 QPC 支持的配置的信息,请参阅 JBoss EAP 支持的配置。
22.9.1. 将 Microsoft IIS 配置为使用 ISAPI Connector
从红帽客户门户网站下载 ISAPI 连接器:
- 打开浏览器并登录到红帽客户门户网站 JBoss Software Downloads 页面。
- 在产品 下拉菜单中选择 Web Connectors。
- 从 Version 下拉菜单中选择最新的 JBoss Core Services 版本。
- 在列表中找到 Red Hat JBoss Core Services ISAPI Connector,然后点 Download 链接。
-
提取存档并将
sbin
目录的内容复制到服务器上的位置。以下说明假定内容已复制到C:\connectors\
。
使用 personnel Manager (IIS 7)配置 RuntimeClass Redirector:
-
点 Start
Run,并输入 inetmgr
,打开framework manager。 - 在左侧的树视图窗格中,展开 IIS 7。
- 双击 ISAPI 和 CGI 注册 以在新窗口中打开它。
- 在 Actions 窗格中,单击 Add。此时会打开 Add ISAPI 或 CGI Restriction 窗口。
指定以下值:
-
ISAPI 或 CGI 路径:
C:\connectors\isapi_redirect.dll
-
描述 :
jboss
- 允许执行扩展路径 :选中复选框。
-
ISAPI 或 CGI 路径:
- 点 OK 关闭 Add ISAPI 或 CGI Restriction 窗口。
定义 JBoss 原生虚拟目录
- 右键单击 Default Web Site,然后单击 Add Virtual Directory。此时会打开 Add Virtual Directory 窗口。
指定以下值来添加虚拟目录:
-
别名 :
jboss
-
物理路径 :
C:\connectors\
-
别名 :
- 点 OK 保存值并关闭 Add Virtual Directory 窗口。
定义 JBoss Native ISAPI Redirect Filter
-
在树视图窗格中,展开 Sites
Default Web Site。 - 双击 ISAPI Filters。此时会出现 ISAPI Filters Features 视图。
- 在 Actions 窗格中,点 Add。此时会出现 Add ISAPI Filter 窗口。
在 Add ISAPI Filter 窗口中指定以下值:
-
过滤器名称 :
jboss
-
可执行:
C:\connectors\isapi_redirect.dll
-
过滤器名称 :
- 点 OK 保存值并关闭 Add ISAPI Filters 窗口。
-
在树视图窗格中,展开 Sites
启用 ISAPI-dll 处理程序
- 双击树视图窗格中的framework 7 项。CNO 7 Home Features View 将打开。
- 双击处理程序 映射。此时会出现 处理程序映射功能 视图。
- 在 Group by bo 框中,选择 State。处理程序 映射 显示在 Enabled 和 Disabled Groups 中。
-
查找
ISAPI-dll
。如果它位于 Disabled 组中,请右键单击它,然后选择 Edit Feature Permissions。 启用以下权限:
- 读
- 脚本
- 执行
- 点 OK 保存这些值,并关闭 Edit Feature Permissions 窗口。
Microsoft IIS 现在配置为使用 ISAPI 连接器。
22.9.2. 配置 ISAPI Connector 以向 JBoss EAP 发送客户端请求
此任务配置一组 JBoss EAP 服务器,以接受来自 ISAPI 连接器的请求。它不包括负载平衡或高可用性故障转移的配置。
此配置在 QPC 服务器上完成,假设您已将 JBoss EAP 配置为接受来自外部 Web 服务器 的请求。您还需要完全的管理员访问权限,并且需要将 RuntimeClass 配置为使用 ISAPI 连接器。
创建属性文件并设置重定向
创建用于存储日志、属性文件和锁定文件的目录。
此流程的其余部分假定您正在将目录
C:\connectors\
用于此目的。如果您使用其他目录,请相应地修改指令。创建
isapi_redirect.properties
文件。创建名为
C:\connectors\isapi_redirect.properties
的新文件。将以下内容复制到 文件中。# Configuration file for the ISAPI Connector # Extension uri definition extension_uri=/jboss/isapi_redirect.dll # Full path to the log file for the ISAPI Connector log_file=c:\connectors\isapi_redirect.log # Log level (debug, info, warn, error or trace) log_level=info # Full path to the workers.properties file worker_file=c:\connectors\workers.properties # Full path to the uriworkermap.properties file worker_mount_file=c:\connectors\uriworkermap.properties #Full path to the rewrite.properties file rewrite_rule_file=c:\connectors\rewrite.properties
如果您不想使用
rewrite.properties
文件,请通过在行首放置一个;
字符来注释掉最后一行。创建
uriworkermap.properties
文件uriworkermap.properties
文件包含部署的应用程序 URL 和 worker 处理请求之间的映射。以下示例文件显示了 文件的语法。将uriworkermap.properties
文件放在C:\connectors\
中。# images and css files for path /status are provided by worker01 /status=worker01 /images/*=worker01 /css/*=worker01 # Path /web-console is provided by worker02 # IIS (customized) error page is used for http errors with number greater or equal to 400 # css files are provided by worker01 /web-console/*=worker02;use_server_errors=400 /web-console/css/*=worker01 # Example of exclusion from mapping, logo.gif won't be displayed # /web-console/images/logo.gif=* # Requests to /app-01 or /app-01/something will be routed to worker01 /app-01|/*=worker01 # Requests to /app-02 or /app-02/something will be routed to worker02 /app-02|/*=worker02
创建
worker.properties
文件。worker.properties
文件包含 worker 标签和服务器实例之间的映射定义。此文件遵循用于 Apache mod_jk worker 属性 配置的相同文件的语法。以下是
workers.properties
文件示例。worker 名称worker01
和worker02
必须与 JBoss EAPundertow
子系统中配置的instance-id
匹配。将此文件放在
C:\connectors\
目录中。# An entry that lists all the workers defined worker.list=worker01, worker02 # Entries that define the host and port associated with these workers # First JBoss EAP server definition, port 8009 is standard port for AJP in EAP worker.worker01.host=127.0.0.1 worker.worker01.port=8009 worker.worker01.type=ajp13 # Second JBoss EAP server definition worker.worker02.host=127.0.0.100 worker.worker02.port=8009 worker.worker02.type=ajp13
创建
rewrite.properties
文件。rewrite.properties
文件包含特定应用程序的简单 URL 重写规则。重写的路径使用 name-value 对来指定,如下例所示。将此文件放在C:\connectors\
目录中。#Simple example # Images are accessible under abc path /app-01/abc/=/app-01/images/
使用
net stop
和net start
命令重启您的 QPC 服务器。C:\> net stop was /Y C:\> net start w3svc
QPC 服务器被配置为根据特定应用将客户端请求发送到您配置的特定 JBoss EAP 服务器。
22.9.3. 将 ISAPI Connector 配置为跨多个 JBoss EAP 服务器的 Balance 客户端请求
此配置会在您指定的 JBoss EAP 服务器之间平衡客户端请求。此配置在 QPC 服务器上完成,假设您已将 JBoss EAP 配置为接受来自外部 Web 服务器 的请求。您还需要完全的管理员访问权限,并且需要将 RuntimeClass 配置为使用 ISAPI 连接器。
跨多个服务器平衡客户端请求
创建用于存储日志、属性文件和锁定文件的目录。
此流程的其余部分假定您正在将目录
C:\connectors\
用于此目的。如果您使用其他目录,请相应地修改指令。创建
isapi_redirect.properties
文件。创建名为
C:\connectors\isapi_redirect.properties
的新文件。将以下内容复制到 文件中。# Configuration file for the ISAPI Connector # Extension uri definition extension_uri=/jboss/isapi_redirect.dll # Full path to the log file for the ISAPI Connector log_file=c:\connectors\isapi_redirect.log # Log level (debug, info, warn, error or trace) log_level=info # Full path to the workers.properties file worker_file=c:\connectors\workers.properties # Full path to the uriworkermap.properties file worker_mount_file=c:\connectors\uriworkermap.properties #OPTIONAL: Full path to the rewrite.properties file rewrite_rule_file=c:\connectors\rewrite.properties
如果您不想使用
rewrite.properties
文件,请通过在行首放置一个;
字符来注释掉最后一行。创建
uriworkermap.properties
文件。uriworkermap.properties
文件包含部署的应用程序 URL 和 worker 处理请求之间的映射。以下示例文件显示了文件的语法,其具有负载均衡的配置。通配符(*
)字符将各种 URL 子目录的所有请求发送到名为 router 的负载均衡器。下一步中涵盖了负载均衡器的配置。将
uriworkermap.properties
文件放在C:\connectors\
中。# images, css files, path /status and /web-console will be # provided by nodes defined in the load-balancer called "router" /css/*=router /images/*=router /status=router /web-console|/*=router # Example of exclusion from mapping, logo.gif won't be displayed # /web-console/images/logo.gif=* # Requests to /app-01 and /app-02 will be routed to nodes defined # in the load-balancer called "router" /app-01|/*=router /app-02|/*=router # mapping for management console, nodes in cluster can be enabled or disabled here /jkmanager|/*=status
创建
worker.properties
文件。worker.properties
文件包含 worker 标签和服务器实例之间的映射定义。此文件遵循用于 Apache mod_jk worker 属性 配置的相同文件的语法。以下是
workers.properties
文件示例。负载均衡器在文件的末尾配置,使其包含 workerworker01
和worker02
。这些 worker 名称必须与 JBoss EAPundertow
子系统中配置的instance-id
匹配。将此文件放在
C:\connectors\
目录中。# The advanced router LB worker worker.list=router,status # First EAP server definition, port 8009 is standard port for AJP in EAP # # lbfactor defines how much the worker will be used. # The higher the number, the more requests are served # lbfactor is useful when one machine is more powerful # ping_mode=A – all possible probes will be used to determine that # connections are still working worker.worker01.port=8009 worker.worker01.host=127.0.0.1 worker.worker01.type=ajp13 worker.worker01.ping_mode=A worker.worker01.socket_timeout=10 worker.worker01.lbfactor=3 # Second EAP server definition worker.worker02.port=8009 worker.worker02.host=127.0.0.100 worker.worker02.type=ajp13 worker.worker02.ping_mode=A worker.worker02.socket_timeout=10 worker.worker02.lbfactor=1 # Define the LB worker worker.router.type=lb worker.router.balance_workers=worker01,worker02 # Define the status worker for jkmanager worker.status.type=status
创建
rewrite.properties
文件。rewrite.properties
文件包含特定应用程序的简单 URL 重写规则。重写的路径使用 name-value 对来指定,如下例所示。将此文件放在C:\connectors\
目录中。#Simple example # Images are accessible under abc path /app-01/abc/=/app-01/images/ Restart the IIS server. Restart your IIS server by using the net stop and net start commands. C:\> net stop was /Y C:\> net start w3svc
QPC 服务器被配置为将客户端请求发送到 workers.properties
文件中引用的 JBoss EAP 服务器,以 1:3
比例在服务器间分散负载。此比率源自分配给每台服务器的负载平衡因素(lbfactor)。