diff --git a/README.md b/README.md index 120af1dc7..09c82fa20 100755 --- a/README.md +++ b/README.md @@ -145,6 +145,7 @@ For previous versions, please read: ## V3 changes +* v3.0, 2019-12-18, Fix [#1520][bug #1520] and [#1223][bug #1223], bug for origin cluster 3+ servers. 3.0.74 * v3.0, 2019-12-18, For [#1042][bug #1042], add test for RAW AVC protocol. * v3.0, 2019-12-18, Detect whether flash enabled for srs-player. 3.0.73 * v3.0, 2019-12-17, Fix HTTP CORS bug when sending response for OPTIONS. 3.0.72 @@ -1532,6 +1533,8 @@ Winlin [bug #1042]: https://github.com/ossrs/srs/issues/1042 [bug #1445]: https://github.com/ossrs/srs/issues/1445 [bug #1506]: https://github.com/ossrs/srs/issues/1506 +[bug #1520]: https://github.com/ossrs/srs/issues/1520 +[bug #1223]: https://github.com/ossrs/srs/issues/1223 [bug #xxxxxxxxxxxxx]: https://github.com/ossrs/srs/issues/xxxxxxxxxxxxx [exo #828]: https://github.com/google/ExoPlayer/pull/828 diff --git a/trunk/conf/origin.cluster.serverA.conf b/trunk/conf/origin.cluster.serverA.conf index 0e0d5701e..c9b0efa06 100644 --- a/trunk/conf/origin.cluster.serverA.conf +++ b/trunk/conf/origin.cluster.serverA.conf @@ -15,6 +15,6 @@ vhost __defaultVhost__ { cluster { mode local; origin_cluster on; - coworkers 127.0.0.1:9091; + coworkers 127.0.0.1:9091 127.0.0.1:9092; } } diff --git a/trunk/conf/origin.cluster.serverB.conf b/trunk/conf/origin.cluster.serverB.conf index 333d1e566..fe65bb0a3 100644 --- a/trunk/conf/origin.cluster.serverB.conf +++ b/trunk/conf/origin.cluster.serverB.conf @@ -15,6 +15,6 @@ vhost __defaultVhost__ { cluster { mode local; origin_cluster on; - coworkers 127.0.0.1:9090; + coworkers 127.0.0.1:9090 127.0.0.1:9092; } } diff --git a/trunk/conf/origin.cluster.serverC.conf b/trunk/conf/origin.cluster.serverC.conf new file mode 100644 index 000000000..72bec36e5 --- /dev/null +++ b/trunk/conf/origin.cluster.serverC.conf @@ -0,0 +1,20 @@ +# the config for srs origin-origin cluster +# @see https://github.com/ossrs/srs/wiki/v3_EN_OriginCluster +# @see full.conf for detail config. + +listen 19352; +max_connections 1000; +daemon off; +srs_log_tank console; +pid ./objs/origin.cluster.serverC.pid; +http_api { + enabled on; + listen 9092; +} +vhost __defaultVhost__ { + cluster { + mode local; + origin_cluster on; + coworkers 127.0.0.1:9090 127.0.0.1:9091; + } +} diff --git a/trunk/src/app/srs_app_rtmp_conn.cpp b/trunk/src/app/srs_app_rtmp_conn.cpp index dc480dbeb..2eb26ff13 100644 --- a/trunk/src/app/srs_app_rtmp_conn.cpp +++ b/trunk/src/app/srs_app_rtmp_conn.cpp @@ -613,6 +613,11 @@ srs_error_t SrsRtmpConn::playing(SrsSource* source) + "vhost=" + req->vhost + "&ip=" + req->host + "&app=" + req->app + "&stream=" + req->stream + "&coworker=" + coworkers.at(i); if ((err = SrsHttpHooks::discover_co_workers(url, host, port)) != srs_success) { + // If failed to discovery stream in this coworker, we should request the next one util the last. + // @see https://github.com/ossrs/srs/issues/1223 + if (i < (int)coworkers.size() - 1) { + continue; + } return srs_error_wrap(err, "discover coworkers, url=%s", url.c_str()); } srs_trace("rtmp: redirect in cluster, from=%s:%d, target=%s:%d, url=%s", diff --git a/trunk/src/core/srs_core.hpp b/trunk/src/core/srs_core.hpp index a596bce9a..b1f3fd652 100644 --- a/trunk/src/core/srs_core.hpp +++ b/trunk/src/core/srs_core.hpp @@ -27,7 +27,7 @@ // The version config. #define VERSION_MAJOR 3 #define VERSION_MINOR 0 -#define VERSION_REVISION 73 +#define VERSION_REVISION 74 // The macros generated by configure script. #include