OCM(OriginClusterMaster): Use external application for Origin Cluster to discovery services #1607
Description
In #1501, it is described that when deploying a source station cluster using Docker, SRS actually does not know its accessible IP. After starting SRS in Docker, it is assigned a NAT address, and only Docker knows the external address.
The solution is to add a parameter coworker
when making internal requests within the source station cluster, as described in #1501. For example:
+----------------------------------+ +-----------------------------------+
| +------------------------+ | | +------------------------+ |
| | Origin A(172.16.0.10) | | /api/v1/clusters? | | Origin B(172.16.0.11) | |
| +------------------------+ | coworker=192.168.0.21 | +------------------------+ |
| +-->--------------------+ +
| docker A(192.168.0.20) +----------<------------+ docker B(192.168.0.21) |
| coworkers [ B<192.168.0.21> ] | origin=192.168.0.21 | coworkers [ A<192.168.0.20> ] |
+----------------------------------+ +-----------------------------------+
This solution has a prerequisite, which is that we need to know the addresses of Docker A and B in advance. Additionally, it can be quite troublesome to update other source stations when the addresses change. This is known as manual service discovery and updating.
In frameworks like K8s with automatic service discovery, it is necessary to do this even when deploying multiple source station clusters. Manual discovery is not suitable in this case, and the problem should be solved using a separate service discovery service for the source station cluster called OCM (OriginClusterMaster). For example:
- Start a series of source stations like OriginA, OriginB, OriginC, etc., and configure coworkers with the address or domain name of OCM, for example:
coworkers: ocm-service
. Multiple configurations can be set. - Start the OCM (OriginClusterMaster) service, exposing it as a k8s service named ocm-service. This DNS name can be used to connect to the cluster within the cluster.
- It is also necessary to configure the source stations like OriginA, OriginB, OriginC, etc., to update the information of the stream as ocm-service. For example,
on_publish
andon_unpublish
, and possibly other events that will be updated later.
Note: In this OCM solution, each Origin provides its own service and requires its own K8s service and DNS name (which is automatically the K8s service name). The Origin needs to configure its own service and notify OCM.
TRANS_BY_GPT3