第 2 章 网络接口和端点
通过将 Data Grid Server 绑定到 IP 地址,通过网络接口公开数据网格服务器。然后,您可以将端点配置为使用接口,以便 Data Grid 服务器可以处理来自远程客户端应用程序的请求。
注意
默认情况下,Data Grid 服务器公开了一个自动检测到入站请求的协议的端口。
2.1. 网络接口 复制链接链接已复制到粘贴板!
复制链接链接已复制到粘贴板!
Data Grid Server 多路端点到单个 TCP/IP 端口,并自动检测入站客户端请求的协议。您可以配置 Data Grid 服务器如何绑定到网络接口来侦听客户端请求。
互联网协议(IP)地址
<!-- Selects a specific IPv4 address, which can be public, private, or loopback.
This is the default network interface for Data Grid Server. -->
<interfaces>
<interface name="public">
<inet-address value="${infinispan.bind.address:127.0.0.1}"/>
</interface>
</interfaces>
回送地址
<!-- Selects an IP address in an IPv4 or IPv6 loopback address block. -->
<interfaces>
<interface name="public">
<loopback/>
</interface>
</interfaces>
非循环地址
<!-- Selects an IP address in an IPv4 or IPv6 non-loopback address block. -->
<interfaces>
<interface name="public">
<non-loopback/>
</interface>
</interfaces>
任何地址
<!-- Uses the `INADDR_ANY` wildcard address which means Data Grid Server
listens for inbound client requests on all interfaces. -->
<interfaces>
<interface name="public">
<any-address/>
</interface>
</interfaces>
Link local
<!-- Selects a link-local IP address in an IPv4 or IPv6 address block. -->
<interfaces>
<interface name="public">
<link-local/>
</interface>
</interfaces>
站点本地
<!-- Selects a site-local (private) IP address in an IPv4 or IPv6 address block. -->
<interfaces>
<interface name="public">
<site-local/>
</interface>
</interfaces>
匹配和回退策略
Data Grid Server 可以枚举主机系统上的所有网络接口,并绑定到与值匹配的接口、主机或 IP 地址,该地址可以包括正则表达式来获得额外的灵活性。
匹配主机
<!-- Selects an IP address that is assigned to a matching host name. -->
<interfaces>
<interface name="public">
<match-host value="my_host_name"/>
</interface>
</interfaces>
匹配接口
<!--Selects an IP address assigned to a matching network interface. -->
<interfaces>
<interface name="public">
<match-interface value="eth0"/>
</interface>
</interfaces>
匹配地址
<!-- Selects an IP address that matches a regular expression. -->
<interfaces>
<interface name="public">
<match-address value="132\..*"/>
</interface>
</interfaces>
Fallback
<!-- Includes multiple strategies that Data Grid Server tries in the
declared order until it finds a match. -->
<interfaces>
<interface name="public">
<match-host value="my_host_name"/>
<match-address value="132\..*"/>
<any-address/>
</interface>
</interfaces>