Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
胡斌
/
srs
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
winlin
2015-08-30 08:30:04 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
2b4fa2d73ef6a88f4322d93005f55509fd78fb49
2b4fa2d7
1 parent
6bd05f9c
for #319, move the edge configs to cluster.
显示空白字符变更
内嵌
并排对比
正在显示
5 个修改的文件
包含
146 行增加
和
63 行删除
trunk/conf/edge.conf
trunk/conf/edge.token.traverse.conf
trunk/conf/full.conf
trunk/src/app/srs_app_config.cpp
trunk/src/app/srs_app_config.hpp
trunk/conf/edge.conf
查看文件 @
2b4fa2d
...
...
@@ -7,6 +7,8 @@ max_connections 1000;
pid
objs
/
edge
.
pid
;
srs_log_file
./
objs
/
edge
.
log
;
vhost
__
defaultVhost__
{
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
19350
;
}
}
...
...
trunk/conf/edge.token.traverse.conf
查看文件 @
2b4fa2d
...
...
@@ -5,7 +5,9 @@
listen
1935
max_connections
1000
;
vhost
__
defaultVhost__
{
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
19350
;
token_traverse
on
;
}
}
...
...
trunk/conf/full.conf
查看文件 @
2b4fa2d
...
...
@@ -520,6 +520,73 @@ vhost same.vhost.forward.srs.com {
}
}
# vhost for stream cluster for RTMP/FLV
vhost
cluster
.
srs
.
com
{
# stream RTMP/FLV cluster config.
cluster
{
# the mode of vhost, local or remote.
# local: vhost is origin vhost, which provides stream source.
# remote: vhost is edge vhost, which pull/push to origin.
# default: local
mode
remote
;
# for edge(remote mode), user must specifies the origin server
# format as: <server_name|ip>[:port]
# @remark user can specifies multiple origin for error backup, by space,
# for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
# for edge, whether open the token traverse mode,
# if token traverse on, all connections of edge will forward to origin to check(auth),
# it's very important for the edge to do the token auth.
# the better way is use http callback to do the token auth by the edge,
# but if user prefer origin check(auth), the token_traverse if better solution.
# default: off
token_traverse
off
;
# the vhost to transform for edge,
# to fetch from the specified vhost at origin,
# if not specified, use the current vhost of edge in origin, the variable [vhost].
# default: [vhost]
vhost
same
.
edge
.
srs
.
com
;
# when upnode(forward to, edge push to, edge pull from) is srs,
# it's strongly recommend to open the debug_srs_upnode,
# when connect to upnode, it will take the debug info,
# for example, the id, source id, pid.
# please see: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLog
# default: on
debug_srs_upnode
on
;
}
}
# vhost for edge, edge and origin is the same vhost
vhost
same
.
edge
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
token_traverse
off
;
}
}
# vhost for edge, edge transform vhost to fetch from another vhost.
vhost
transform
.
edge
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
;
vhost
same
.
edge
.
srs
.
com
;
}
}
# the vhost for srs debug info, whether send args in connect(tcUrl).
vhost
debug
.
srs
.
com
{
# @see cluster.srs.com
cluster
{
debug_srs_upnode
on
;
}
}
...
...
@@ -600,38 +667,6 @@ vhost security.srs.com {
}
}
# vhost for edge, edge and origin is the same vhost
vhost
same
.
edge
.
srs
.
com
{
# the mode of vhost, local or remote.
# local: vhost is origin vhost, which provides stream source.
# remote: vhost is edge vhost, which pull/push to origin.
# default: local
mode
remote
;
# for edge(remote mode), user must specifies the origin server
# format as: <server_name|ip>[:port]
# @remark user can specifies multiple origin for error backup, by space,
# for example, 192.168.1.100:1935 192.168.1.101:1935 192.168.1.102:1935
origin
127
.
0
.
0
.
1
:
1935
localhost
:
1935
;
# for edge, whether open the token traverse mode,
# if token traverse on, all connections of edge will forward to origin to check(auth),
# it's very important for the edge to do the token auth.
# the better way is use http callback to do the token auth by the edge,
# but if user prefer origin check(auth), the token_traverse if better solution.
# default: off
token_traverse
off
;
}
# vhost for edge, edge transform vhost to fetch from another vhost.
vhost
transform
.
edge
.
srs
.
com
{
mode
remote
;
origin
127
.
0
.
0
.
1
:
1935
;
# the vhost to transform for edge,
# to fetch from the specified vhost at origin,
# if not specified, use the current vhost of edge in origin, the variable [vhost].
# default: [vhost]
vhost
same
.
edge
.
srs
.
com
;
}
# vhost for dvr
vhost
dvr
.
srs
.
com
{
# dvr RTMP stream to file,
...
...
@@ -1187,17 +1222,6 @@ vhost hooks.callback.srs.com {
}
}
# the vhost for srs debug info, whether send args in connect(tcUrl).
vhost
debug
.
srs
.
com
{
# when upnode(forward to, edge push to, edge pull from) is srs,
# it's strongly recommend to open the debug_srs_upnode,
# when connect to upnode, it will take the debug info,
# for example, the id, source id, pid.
# please see: https://github.com/simple-rtmp-server/srs/wiki/v1_CN_SrsLog
# default: on
debug_srs_upnode
on
;
}
# the main comments for transcode
vhost
example
.
transcode
.
srs
.
com
{
# the streaming transcode configs.
...
...
trunk/src/app/srs_app_config.cpp
查看文件 @
2b4fa2d
...
...
@@ -615,6 +615,9 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
// merge config.
std
::
vector
<
ISrsReloadHandler
*>::
iterator
it
;
// following directly support reload.
// origin, token_traverse, vhost, debug_srs_upnode
// state graph
// old_vhost new_vhost
// DISABLED => ENABLED
...
...
@@ -679,7 +682,7 @@ int SrsConfig::reload_vhost(SrsConfDirective* old_root)
continue
;
}
// mode, never supports reload.
//
cluster.
mode, never supports reload.
// first, for the origin and edge role change is too complex.
// second, the vhosts in origin device group normally are all origin,
// they never change to edge sometimes.
...
...
@@ -878,7 +881,6 @@ int SrsConfig::reload_conf(SrsConfig* conf)
// always support reload without additional code:
// chunk_size, ff_log_dir,
// bandcheck, http_hooks, heartbeat,
// token_traverse, debug_srs_upnode,
// security
// merge config: max_connections
...
...
@@ -1663,18 +1665,26 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
obj
->
set
(
"tcp_nodelay"
,
dir
->
dumps_arg0_to_boolean
());
}
// edge.
if
((
dir
=
vhost
->
get
(
"mode"
))
!=
NULL
)
{
obj
->
set
(
"mode"
,
dir
->
dumps_arg0_to_str
());
}
if
((
dir
=
vhost
->
get
(
"origin"
))
!=
NULL
)
{
obj
->
set
(
"origin"
,
dir
->
dumps_args
());
// cluster.
if
((
dir
=
vhost
->
get
(
"cluster"
))
!=
NULL
)
{
SrsAmf0Object
*
cluster
=
SrsAmf0Any
::
object
();
obj
->
set
(
"cluster"
,
cluster
);
for
(
int
i
=
0
;
i
<
(
int
)
dir
->
directives
.
size
();
i
++
)
{
SrsConfDirective
*
sdir
=
dir
->
directives
.
at
(
i
);
if
(
sdir
->
name
==
"mode"
)
{
cluster
->
set
(
"mode"
,
sdir
->
dumps_arg0_to_str
());
}
else
if
(
sdir
->
name
==
"origin"
)
{
cluster
->
set
(
"origin"
,
sdir
->
dumps_arg0_to_str
());
}
else
if
(
sdir
->
name
==
"token_traverse"
)
{
cluster
->
set
(
"token_traverse"
,
sdir
->
dumps_arg0_to_boolean
());
}
else
if
(
sdir
->
name
==
"vhost"
)
{
cluster
->
set
(
"vhost"
,
sdir
->
dumps_arg0_to_str
());
}
else
if
(
sdir
->
name
==
"debug_srs_upnode"
)
{
cluster
->
set
(
"debug_srs_upnode"
,
sdir
->
dumps_arg0_to_boolean
());
}
if
((
dir
=
vhost
->
get
(
"token_traverse"
))
!=
NULL
)
{
obj
->
set
(
"token_traverse"
,
dir
->
dumps_arg0_to_boolean
());
}
if
((
dir
=
vhost
->
get
(
"vhost"
))
!=
NULL
)
{
obj
->
set
(
"vhost"
,
dir
->
dumps_arg0_to_str
());
}
// forward
...
...
@@ -1693,11 +1703,6 @@ int SrsConfig::vhost_to_json(SrsConfDirective* vhost, SrsAmf0Object* obj)
}
}
// debug_srs_upnode
if
((
dir
=
vhost
->
get
(
"debug_srs_upnode"
))
!=
NULL
)
{
obj
->
set
(
"debug_srs_upnode"
,
dir
->
dumps_arg0_to_boolean
());
}
// play
if
((
dir
=
vhost
->
get
(
"play"
))
!=
NULL
)
{
SrsAmf0Object
*
play
=
SrsAmf0Any
::
object
();
...
...
@@ -2602,10 +2607,9 @@ int SrsConfig::check_config()
SrsConfDirective
*
conf
=
vhost
->
at
(
i
);
string
n
=
conf
->
name
;
if
(
n
!=
"enabled"
&&
n
!=
"chunk_size"
&&
n
!=
"min_latency"
&&
n
!=
"tcp_nodelay"
&&
n
!=
"mode"
&&
n
!=
"origin"
&&
n
!=
"token_traverse"
&&
n
!=
"vhost"
&&
n
!=
"dvr"
&&
n
!=
"ingest"
&&
n
!=
"hls"
&&
n
!=
"http_hooks"
&&
n
!=
"refer"
&&
n
!=
"forward"
&&
n
!=
"transcode"
&&
n
!=
"bandcheck"
&&
n
!=
"
debug_srs_upnode"
&&
n
!=
"play"
&&
n
!=
"publish
"
&&
n
!=
"
play"
&&
n
!=
"publish"
&&
n
!=
"cluster
"
&&
n
!=
"security"
&&
n
!=
"http_remux"
&&
n
!=
"http_static"
&&
n
!=
"hds"
&&
n
!=
"exec"
)
{
...
...
@@ -2654,6 +2658,15 @@ int SrsConfig::check_config()
return
ret
;
}
}
}
else
if
(
n
==
"cluster"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
if
(
m
!=
"mode"
&&
m
!=
"origin"
&&
m
!=
"token_traverse"
&&
m
!=
"vhost"
&&
m
!=
"debug_srs_upnode"
)
{
ret
=
ERROR_SYSTEM_CONFIG_INVALID
;
srs_error
(
"unsupported vhost cluster directive %s, ret=%d"
,
m
.
c_str
(),
ret
);
return
ret
;
}
}
}
else
if
(
n
==
"publish"
)
{
for
(
int
j
=
0
;
j
<
(
int
)
conf
->
directives
.
size
();
j
++
)
{
string
m
=
conf
->
at
(
j
)
->
name
.
c_str
();
...
...
@@ -3185,6 +3198,11 @@ bool SrsConfig::get_debug_srs_upnode(string vhost)
return
DEFAULT
;
}
conf
=
conf
->
get
(
"cluster"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"debug_srs_upnode"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
...
...
@@ -3848,6 +3866,11 @@ bool SrsConfig::get_vhost_is_edge(SrsConfDirective* vhost)
return
DEFAULT
;
}
conf
=
conf
->
get
(
"cluster"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"mode"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
...
...
@@ -3863,6 +3886,11 @@ SrsConfDirective* SrsConfig::get_vhost_edge_origin(string vhost)
return
NULL
;
}
conf
=
conf
->
get
(
"cluster"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
NULL
;
}
return
conf
->
get
(
"origin"
);
}
...
...
@@ -3875,6 +3903,11 @@ bool SrsConfig::get_vhost_edge_token_traverse(string vhost)
return
DEFAULT
;
}
conf
=
conf
->
get
(
"cluster"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"token_traverse"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
...
...
@@ -3892,6 +3925,11 @@ string SrsConfig::get_vhost_edge_transform_vhost(string vhost)
return
DEFAULT
;
}
conf
=
conf
->
get
(
"cluster"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
}
conf
=
conf
->
get
(
"vhost"
);
if
(
!
conf
||
conf
->
arg0
().
empty
())
{
return
DEFAULT
;
...
...
@@ -5827,6 +5865,23 @@ int srs_config_transform_vhost(SrsConfDirective* root)
continue
;
}
// SRS3.0, change the folowing like a shadow:
// mode, origin, token_traverse, vhost, debug_srs_upnode
// SRS1/2:
// vhost { shadow; }
// SRS3+:
// vhost { cluster { shadow; } }
if
(
n
==
"mode"
||
n
==
"origin"
||
n
==
"token_traverse"
||
n
==
"vhost"
||
n
==
"debug_srs_upnode"
)
{
it
=
dir
->
directives
.
erase
(
it
);
SrsConfDirective
*
cluster
=
dir
->
get_or_create
(
"cluster"
);
SrsConfDirective
*
shadow
=
cluster
->
get_or_create
(
conf
->
name
);
shadow
->
args
=
conf
->
args
;
srs_freep
(
conf
);
continue
;
}
++
it
;
}
}
...
...
trunk/src/app/srs_app_config.hpp
查看文件 @
2b4fa2d
...
...
@@ -688,7 +688,7 @@ public:
* @remark this is used to protect the service bandwidth.
*/
virtual
int
get_bw_check_limit_kbps
(
std
::
string
vhost
);
// vhost
edge
section
// vhost
cluster
section
public:
/**
* whether vhost is edge mode.
...
...
请
注册
或
登录
后发表评论