Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Origin server cluster, pulling the stream directly from the origin server will fail. #2045

Closed
mawenwu1983 opened this issue Nov 19, 2020 · 6 comments
Assignees
Labels
TransByAI Translated by AI/GPT. Won't fix We won't fix it.
Milestone

Comments

@mawenwu1983
Copy link

mawenwu1983 commented Nov 19, 2020

Description'

Please ensure that the markdown structure is maintained.

Please describe the issue you encountered here.
'
Make sure to maintain the markdown structure.

Reference document: #464
Encountered issues while setting up the origin server cluster according to the document. Please provide a detailed description:

| Server IP | Purpose |
Please make sure to maintain the markdown structure.
| ------------- | -------------------------------------------
| 192.168.1.121 | Origin Cluster Server A
| 192.168.1.122 | Origin Cluster Server B
| 192.168.1.131 | Edge Server A

  1. SRS version: 3.0.153 official binary version
  1. SRS logs are as follows:
> #### 192.168.1.121 logs

[2020-11-20 00:16:18.138][Trace][20117][751] RTMP client ip=192.168.1.76, fd=10
[2020-11-20 00:16:18.139][Trace][20117][751] simple handshake success.
[2020-11-20 00:16:18.139][Trace][20117][751] connect app, tcUrl=rtmp://192.168.1.121:1935/live/livestream, pageUrl=, swfUrl=rtmp://192.168.1.121:1935/live/livestream, schema=rtmp, vhost=192.168.1.121, port=1935, app=live/livestream, args=null
[2020-11-20 00:16:18.139][Trace][20117][751] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=4096, out.chunk=128
[2020-11-20 00:16:18.180][Trace][20117][751] client identified, type=fmle-publish, vhost=192.168.1.121, app=live/livestream, stream=1, param=, duration=0ms
[2020-11-20 00:16:18.180][Trace][20117][751] connected stream, tcUrl=rtmp://192.168.1.121:1935/live/livestream, pageUrl=, swfUrl=rtmp://192.168.1.121:1935/live/livestream, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live/livestream, stream=1, param=, args=null
[2020-11-20 00:16:18.180][Trace][20117][751] source url=/live/livestream/1, ip=192.168.1.76, cache=1, is_edge=0, source_id=-1[-1]
[2020-11-20 00:16:18.223][Trace][20117][751] ignore disabled exec for vhost=__defaultVhost__
[2020-11-20 00:16:18.223][Trace][20117][751] start publish mr=0/350, p1stpt=20000, pnt=5000, tcp_nodelay=0
[2020-11-20 00:16:18.265][Trace][20117][751] got metadata, width=1280, height=720, vcodec=7, acodec=10
[2020-11-20 00:16:19.362][Trace][20117][751] 7B audio sh, codec(10, profile=LC, 2channels, 0kbps, 48000HZ), flv(16bits, 2channels, 44100HZ)
[2020-11-20 00:16:19.362][Trace][20117][751] 47B video sh,  codec(7, profile=High, level=3.1, 1280x720, 0kbps, 0.0fps, 0.0s)
[2020-11-20 00:16:42.451][Trace][20117][752] API server client, ip=192.168.1.122
[2020-11-20 00:16:42.451][Trace][20117][752] HTTP API POST http://192.168.1.121:1985/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.1.122&app=live/livestream&stream=1&coworker=192.168.1.121:1985, content-length=0, chunked=0/0
[2020-11-20 00:16:42.451][Trace][20117][752] Redirect vhost=__defaultVhost__, path=live/livestream/1 to ip=192.168.1.121, port=1935, api=192.168.1.121:1985
[2020-11-20 00:16:42.453][Warn][20117][752][104] client disconnect peer. ret=1007
[2020-11-20 00:16:43.225][Trace][20117][751] <- CPB time=20017631, okbps=1,0,0, ikbps=2381,0,0, mr=0/350, p1stpt=20000, pnt=5000
[2020-11-20 00:16:53.227][Trace][20117][751] <- CPB time=30027281, okbps=0,1,0, ikbps=2419,2383,0, mr=0/350, p1stpt=20000, pnt=5000
[2020-11-20 00:17:03.227][Trace][20117][751] <- CPB time=40029118, okbps=0,1,0, ikbps=2439,2383,0, mr=0/350, p1stpt=20000, pnt=5000
[2020-11-20 00:17:18.227][Trace][20117][751] <- CPB time=55029055, okbps=0,1,0, ikbps=2466,2383,0, mr=0/350, p1stpt=20000, pnt=5000
> #### 192.168.1.122 logs

[2020-11-20 00:16:42.309][Trace][15623][723] RTMP client ip=192.168.1.76, fd=10
[2020-11-20 00:16:42.313][Trace][15623][723] complex handshake success
[2020-11-20 00:16:42.313][Trace][15623][723] connect app, tcUrl=rtmp://192.168.1.122:1935/live/livestream, pageUrl=, swfUrl=, schema=rtmp, vhost=192.168.1.122, port=1935, app=live/livestream, args=null
[2020-11-20 00:16:42.313][Trace][15623][723] protocol in.buffer=0, in.ack=0, out.ack=0, in.chunk=128, out.chunk=128
[2020-11-20 00:16:42.397][Trace][15623][723] ignore AMF0/AMF3 command message.
[2020-11-20 00:16:42.437][Trace][15623][723] ignore AMF0/AMF3 command message.
[2020-11-20 00:16:42.437][Trace][15623][723] client identified, type=Play, vhost=192.168.1.122, app=live/livestream, stream=1, param=, duration=-1ms
[2020-11-20 00:16:42.437][Trace][15623][723] connected stream, tcUrl=rtmp://192.168.1.122:1935/live/livestream, pageUrl=, swfUrl=, schema=rtmp, vhost=__defaultVhost__, port=1935, app=live/livestream, stream=1, param=, args=null
[2020-11-20 00:16:42.437][Trace][15623][723] source url=/live/livestream/1, ip=192.168.1.76, cache=1, is_edge=0, source_id=-1[-1]
[2020-11-20 00:16:42.440][Trace][15623][723] http: cluster redirect 192.168.1.121:1935 ok, url=http://192.168.1.121:1985/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.1.122&app=live/livestream&stream=1&coworker=192.168.1.121:1985, response={"code":0,"data":{"query":{"ip":"192.168.1.122","vhost":"__defaultVhost__","app":"live/livestream","stream":"1"},"origin":{"ip":"192.168.1.121","port":1935,"vhost":"__defaultVhost__","api":"192.168.1.121:1985","routers":["192.168.1.121:1985"]}}}
[2020-11-20 00:16:42.440][Trace][15623][723] rtmp: redirect in cluster, from=192.168.1.122:1935, target=192.168.1.121:1935, url=http://192.168.1.121:1985/api/v1/clusters?vhost=__defaultVhost__&ip=192.168.1.122&app=live/livestream&stream=1&coworker=192.168.1.121:1985, rurl=rtmp://192.168.1.121:1935/live/livestream/1
[2020-11-20 00:16:42.480][Trace][15623][723] client finished.

  1. The configuration of SRS is as follows (Config):
> #### Configuration file for 192.168.1.121

listen              1935;
max_connections     1000;
pid                 ./objs/origin.cluster.serverA.pid;

http_api {
    enabled         on;
    listen          1985;
}

vhost __defaultVhost__ {
    cluster {
        mode            local;
        origin_cluster  on;
        coworkers       192.168.1.122:1985;
    }
}

> #### Configuration file for 192.168.1.122

listen              1935;
max_connections     1000;
pid                 ./objs/origin.cluster.serverB.pid;

http_api {
    enabled         on;
    listen          1985;
}

vhost __defaultVhost__ {
    cluster {
        mode            local;
        origin_cluster  on;
        coworkers       192.168.1.121:1985;
    }
}

> #### Configuration file for 192.168.1.131

listen              1935;
max_connections     1000;
pid                 ./objs/edge.cluster.pid;

vhost __defaultVhost__ {
    cluster {
        mode            remote;
        origin          192.168.1.121:1935 192.168.1.122:1935;
    }
}

Replay

How to replay bug?

  1. OSB pushes stream to 192.168.1.121, push stream address rtmp://192.168.1.121:1935/live/livestream/1
  2. VLC pulls stream from 192.168.1.121, pull stream address rtmp://192.168.1.121:1935/live/livestream/1, can play normally
  3. VLC pulls stream from 192.168.1.131, pull stream address rtmp://192.168.1.121:1935/live/livestream/1, can play normally
  4. VLC pulls stream from 192.168.1.122, pull stream address rtmp://192.168.1.122:1935/live/livestream/1, cannot play

Expected behavior (Expect)

> Describe your expectation (Please describe your expectation)

> Hope the cluster can work properly

TRANS_BY_GPT3

@mawenwu1983
Copy link
Author

mawenwu1983 commented Nov 19, 2020

Just tested again, the player provided by ossrs.net can stream normally, but VLC cannot.

TRANS_BY_GPT3

@mawenwu1983
Copy link
Author

mawenwu1983 commented Nov 19, 2020

Continue testing, even using the SRS live official Android app, it is still unable to properly stream the 122 flow.

TRANS_BY_GPT3

@mawenwu1983
Copy link
Author

mawenwu1983 commented Nov 19, 2020

Use the Android version of EasyRTMP, which has the same effect as VLC.

TRANS_BY_GPT3

@mawenwu1983
Copy link
Author

mawenwu1983 commented Nov 19, 2020

To summarize, no matter what streaming tool is used, as long as the stream is pulled directly from two source servers, there will always be one source server's stream that cannot be pulled.
However, the official website's player does not have this issue, as it can successfully pull the stream from either source server.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Dec 1, 2020

Do not play the stream directly from the source server cluster. Won't fix.

TRANS_BY_GPT3

@winlinvip
Copy link
Member

winlinvip commented Aug 28, 2021

The origin server cluster must not be accessed from a specific origin server, but rather from the edge to pull the stream. Please refer to the document for details, buddy.

TRANS_BY_GPT3

@winlinvip winlinvip changed the title SRS源站集群问题 源站集群,直接从源站拉流会失败 Aug 28, 2021
@winlinvip winlinvip self-assigned this Aug 28, 2021
@winlinvip winlinvip added the Won't fix We won't fix it. label Aug 28, 2021
@winlinvip winlinvip added this to the 3.0 milestone Sep 4, 2021
@winlinvip winlinvip changed the title 源站集群,直接从源站拉流会失败 Origin server cluster, pulling the stream directly from the origin server will fail. Jul 28, 2023
@winlinvip winlinvip added the TransByAI Translated by AI/GPT. label Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
TransByAI Translated by AI/GPT. Won't fix We won't fix it.
Projects
None yet
Development

No branches or pull requests

2 participants