ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.56k stars 5.37k forks source link

OriginCluster: Failed to play HTTP-FLV when origin server killed. When the origin cluster is down, the edge cannot switch automatically. #3401

Open todayisianday opened 1 year ago

todayisianday commented 1 year ago

Architecture: obs/ffmpeg push stream to edge > origin > edge output flv Attached is my obs/ffmpeg push stream to edge configuration.

# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.

listen              1935;
max_connections     80000;
pid                 objs/edge.pid;
daemon              off;
#srs_log_tank        console;
srs_log_file        ./objs/edge.log;
srs_log_level       warn;
http_server {
    enabled         on;
    listen          80;
    dir             ./objs/nginx/html;
}
http_api {
    enabled         on;
    listen          9091;
    raw_api {
        enabled             on;
        allow_reload        on;
    }
}
stats {
    # the index of device ip.
    # we may retrieve more than one network device.
    # default: 0
    network         0;
    # the device name to stat the disk iops.
    # ignore the device of /proc/diskstats if not configed.
    disk            sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
    cluster {
        mode            remote;
        origin          10.50.5.9:1935 10.50.5.10:1935;
    }
}

Attached is my origin cluster configuration.


# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.

listen              1935;
#max_connections     100000;
pid                 ./objs/origin.pid;
daemon              on;
#srs_log_tank        console;
srs_log_file        ./objs/origin.log;
srs_log_level       warn;
http_server {
    enabled         on;
    listen          80;
    dir             ./objs/nginx/html;
}
http_api {
    enabled         on;
    listen          9091;
    raw_api {
        enabled             on;
        allow_reload        on;
    }
}
stats {
    # the index of device ip.
    # we may retrieve more than one network device.
    # default: 0
    network         0;
    # the device name to stat the disk iops.
    # ignore the device of /proc/diskstats if not configed.
    disk            sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
    cluster {
        mode            local;
        origin_cluster  on;
        coworkers       127.0.0.1:9091 10.50.5.10:9091; # Here it points to my other origin API.
    }   
}

Attached is my edge configuration.


# the config for srs origin-edge cluster
# @see https://ossrs.net/lts/zh-cn/docs/v4/doc/edge
# @see full.conf for detail config.

listen              1935;
max_connections     80000;
pid                 objs/edge.pid;
daemon              on;
#srs_log_tank        console;
srs_log_file        ./objs/edge.log;
srs_log_level       warn;
http_server {
    enabled         on;
    listen          80;
    dir             ./objs/nginx/html;
}
http_api {
    enabled         on;
    listen          9091;
    raw_api {
        enabled             on;
        allow_reload        on;
    }
}
stats {
    # the index of device ip.
    # we may retrieve more than one network device.
    # default: 0
    network         0;
    # the device name to stat the disk iops.
    # ignore the device of /proc/diskstats if not configed.
    disk            sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
    cluster {
        mode            remote;
origin 10.50.5.9:1935 10.50.5.10:1935; # This points to my 2 origin servers.
    }
    http_remux {
        enabled     on;
       mount       [vhost]/[app]/[stream].flv;       
    }
}

The reproduction method is as follows:
When I start streaming and play the FLV file, then close one of the origin processes, the FLV file can no longer be played.

`TRANS_BY_GPT3`
winlinvip commented 1 year ago

After you close the process, did the stream stop? Can you continue playing by refreshing the page after restarting the stream?

TRANS_BY_GPT3

todayisianday commented 1 year ago

Thank you for your reply! After I closed the process, the stream still continued to push because I have two origins. The other one should still have the stream as it is set in the edge to have the stream from those two origins. When one process is closed, it should go to the other one that is still running. Also, even after refreshing the page, I still cannot play it.

TRANS_BY_GPT3