使用负载均衡器时如何添加白名单IP?

问题描述 投票:-1回答:1

对于使用Ant Media Server的扩展解决方案,如何在使用负载平衡器时将IP列入白名单?如您所知,负载均衡器的IP动态变化,Ant Media Server现在可以将域名列入白名单了吗?应该如何设置?

webrtc live-streaming low-latency aws-load-balancer ant-media-server
1个回答
0
投票

您对此请求有2个选择。

选项1-使用REST方法设置IP过滤器

步骤1-删除/AMS_DIR/webapps/root/WEB-INF/web.xml]中的以下代码段

<filter>
<filter-name>AuthenticationFilter</filter-name>
<filter-class>io.antmedia.console.rest.AuthenticationFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>AuthenticationFilter</filter-name>
<url-pattern>/rest/*</url-pattern>
</filter-mapping>

[步骤2

-使用支持GET方法的以下REST方法请求应用程序设置
http://domain-address.com:5080/rest/getSettings/WebRTCAppEE

返回该应用程序的设置对象。

[步骤3

-在设置对象中添加/编辑remoteAllowedCIDR字段,然后将设置发送到对象至下面的以下REST方法。
http://domain-address:5080/rest/changeSettings/WebRTCAppEE

请求类型:POST

Content-Type:application / json

您可以将逗号分隔的CIDR表示法或IP地址添加到remoteAllowedCIDR。例如:

remoteAllowedCIDR=127.0.0.1,12.44.55.3/24,192.123.33.66

注意:您可以更改请求https,端口地址,WebRTCAppEE之类的应用程序

选项2-使用MongoDB设置IP过滤器

步骤1

-更新settings.remoteAllowedCIDR-> updateTime-> MongoDB中设置对象中的clusterdbAppSettings collection字段。另外,您可以将MongoDB与服务连接。

a-您可以像上面一样更改settings.remoteAllowedCIDR

b-您还应该更新updateTime字段。您可以以毫秒为单位设置当前时间(System.currentTimeMillis())。让我提供更多有关为什么我们需要更新updateTime的信息。

每个AMS定期检查AppSettings中的updateTime字段以更新应用程序设置。因此,在更新了remoteAllowedCIDR字段之后,您需要更新updateTime字段以使每个节点自行更新。

注意:在clusterdb中,应用程序设置作为一个集合存储在MongoDB中。

您还可以查看以下有关MongoDB事务和AppSettings类的文档:

https://docs.mongodb.com/manual/core/transactions-in-applications/

https://docs.mongodb.com/manual/crud/#update-operations

https://github.com/ant-media/Ant-Media-Server-Common/blob/master/src/main/java/io/antmedia/AppSettings.java#L533

© www.soinside.com 2019 - 2024. All rights reserved.