在维基中,同事的意思是“集群中其他原始服务器的HTTP”。在我们的原始集群中,我像这样配置它:
vhost __defaultVhost__ {
# The config for cluster.
cluster {
# The cluster mode, local or remote.
# local: It's an origin server, serve streams itself.
# remote: It's an edge server, fetch or push stream to origin server.
# default: local
mode local;
# For origin(mode local) cluster, turn on the cluster.
# @remark Origin cluster only supports RTMP, use Edge to transmux RTMP to FLV.
# default: off
# TODO: FIXME: Support reload.
origin_cluster on;
# For origin (mode local) cluster, the co-worker's HTTP APIs.
# This origin will connect to co-workers and communicate with them.
# please read: https://github.com/ossrs/srs/wiki/v3_EN_OriginCluster
# TODO: FIXME: Support reload.
coworkers 192.168.1.101:1985 192.168.1.102:1985 192.168.1.103:1985 192.168.1.XXX:1985;
}
}如果集群中有数千台SRS服务器,那么每个SRS服务器都应该配置许多其他来源的SRS服务器,对吗?
这是否会影响查询http以找到SRS服务器所在的正确流的性能?如果这条溪流是同事中最后一条,我认为会有很大的延误。
所以我想知道,还有其他最好的工程实践来优化这个问题吗?
发布于 2021-12-20 00:06:01
对于OriginCluster,一组源作为集群向边缘服务器提供服务,如下所示:
OriginA+OriginB+OriginN ----RTMP(302)---> Edge server ---RTMP/FLV--> Client那么这是如何运作的呢?
源服务器在配置中使用coworkers,以查找具有RTMP流的权限服务器。coworkers实际上是一个服务发现,它是一个HTTP服务器地址。
coworkers是一个HTTP服务器端点(ip+port),它可以是SRS,也可以是任何HTTP,它提供相同的HTTP:
/api/v1/clusters
Response:
{
code: 0
data: {
origin: {
ip: 'xxx.xxx.xxx.xxx',
port: xxx
}
}
}请搜索
/api/v1/clusters关于最新的集群协议,它可能是不同的。
如果您有大量的流和源服务器,则不应该使用SRS服务器作为coworkers,而应该通过Go或Nodejs创建一个API服务器,只需要用这个API实现这个API并配置每个源服务器:
vhost __defaultVhost__ {
cluster {
mode local;
origin_cluster on;
# Config for your API server.
coworkers 192.168.1.101:80;
}
}也许您的API服务器有一个或两个容错地址。
您的API服务器是如何知道流的?请使用HTTP回调,它也非常简单。
https://stackoverflow.com/questions/70403981
复制相似问题