2020-03-02 Ubuntu 16.04 安裝SRS3

1.準(zhǔn)備軟件

? ?1.RSR3

? ?git clone?https://gitee.com/fesker85/srs.git

? ?2.haproxy

apt install haproxy?

2.安裝

? 2.1 安裝 SRS 3

./configure && make

?2.2 安裝 Haproxy

apt install haproxy

3.配制(集群式)


1. master.conf

listen 1945;
max_connections? ? 1000;
pid? ? ? ? ? ? ? ? ./objs/tms.master.pid;
srs_log_tank? ? ? ? file;
srs_log_file? ? ? ? ./objs/tms.master.log;
daemon? ? ? ? ? ? ? off;
http_api {? ?
????enabled? ? ? ? on;
? ? listen? ? ? ? ? 1955;?
? ?crossdomain? ? on;
? ? raw_api {? ? ? ?
?????????enabled? ? ? ? ? ? off;
? ? ? ? allow_reload? ? ? ? off;
? ? ? ? allow_query? ? ? ? off;
? ? ? ? allow_update? ? ? ? off;
? ? }
}
http_server {? ?
????enabled? ? ? ? on;?
? ? listen? ? ? ? ? 1965;
? ? dir? ? ? ? ? ? ./objs/nginx/html;?
? ? crossdomain? ? on;
}
stats {? ?
????network? ? ? ? 0;
? ? disk? ? ? ? ? ? sda sdb xvda xvdb;
}
vhost __defaultVhost__ {
? ? tcp_nodelay? ? on:
? ? min_latency? ? on;
? ? play {
? ? ? ? gop_cache? ? ? off;
? ? ? ? queue_length? ? 10;
? ? ? ? mw_latency? ? ? 100;? ?
????}
? ? forward {
? ? ? ? enabled on;?
? ? ? ?destination 60.xx.xx.xx:1946 118.xx.xx.xx:1946;
? ? }
}

2. slave.conf

listen 1946;
max_connections 1000;
pid ./objs/tms.slave.pid;
srs_log_tank file;
srs_log_file ./objs/tms.slave.log;
daemon off;
http_api {
????enabled on;
? ? listen 1956;
?????crossdomain on;
?????raw_api {
?????????enabled off;
?????????allow_reload off;
?????????allow_query off;
?????????allow_update off;
? ? ? }
?}
?http_server {
?????enabled on;
?????listen 1966;
?????dir ./objs/nginx/html;
?????crossdomain on;
?}
?stats {
?????network 0;
?????disk sda sdb xvda xvdb;
?}
?vhost __defaultVhost__ {
?????tcp_nodelay on;
????min_latency on;
?????play {
?????????gop_cache off;
?????????queue_length 10;
?????????mw_latency 100;
?????}
?}

3.edge.conf (可用nginx rtmp代替 因?yàn)闇y(cè)試中發(fā)現(xiàn)如果沒有訪問rtmp接口不會(huì)生成hls切片)

?listen 1947;
?max_connections 1000;
?pid ./objs/tms.edge.pid;
?srs_log_tank file;
?srs_log_file ./objs/tms.edge.log;
?daemon off;
?http_api {
?????enabled on;
?????listen 1957;
?????crossdomain on;
?????raw_api {
?????????enabled off;
?????????allow_reload off;
?????????allow_query off;
?????????allow_update off;
?????}
?}
?http_server {
?????enabled on;
?????listen 1967;
?????dir ./objs/nginx/html;
?????crossdomain on;
?}
?stats {
?????network 0;
?????disk sda sdb xvda xvdb;
?}
?vhost __defaultVhost__ {
?????cluster {
?????????mode remote;
?????????origin 60.xx.xx.xx:1945 60.xx.xx.xx:1946 118.xx.xx.xx:1945 118.xx.xx.xx:1946;
?}
?????tcp_nodelay on;
????min_latency on;
?????play {
?????????gop_cache off;
?????????queue_length 10;
?????????mw_latency 100;
?????}
?????hls {
?????????enabled on;
?????????hls_fragment 2;
?????????hls_window 10;
?????????hls_path ./objs/nginx/html;
?????????hls_m3u8_file [app]/[stream].m3u8;
?????????hls_ts_file [app]/[stream]-[seq].ts;
?????}
?????http_remux {
?????enabled on;
?????mount [vhost]/[app]/[stream].flv;
?????hstrs on;
?????}

4.開啟服務(wù)

依次開啟
./srs -c master.conf
./srs -c slave.conf
./srs -c edge.conf

熱重啟:killall -1 srs

5.配制Haproxy

global
????log /dev/log local0
?????log /dev/log local1
?????notice chroot /var/lib/haproxy
?????stats socket /run/haproxy/admin.sock mode 660 level admin
?????stats timeout 30s
?????user haproxy
?????group haproxy
?????daemon
?????# Default SSL material locations
?????# ca-base /etc/ssl/certs
?????# crt-base /etc/ssl/private
?????# Default ciphers to use on SSL-enabled listening sockets.
?????# For more information, see ciphers(1SSL). This list is from:
?????# https://hynek.me/articles/hardening-your-web-servers-ssl-ciphers/
?????# ssl-default-bind-ciphers xxx
?????# ssl-default-bind-options no-sslv3
?defaults
?????log global
?????mode http
?????option httplog
?????option dontlognull
?????timeout connect 5000
?????timeout client 50000
?????timeout server 50000
?????errorfile 400 /etc/haproxy/errors/400.http
?????errorfile 403 /etc/haproxy/errors/403.http
?????errorfile 408 /etc/haproxy/errors/408.http
?????errorfile 500 /etc/haproxy/errors/500.http
?????errorfile 502 /etc/haproxy/errors/502.http
?????errorfile 503 /etc/haproxy/errors/503.http
?????errorfile 504 /etc/haproxy/errors/504.http
listen tms-cluster
?????bind *:1935
?????mode tcp
?????balance roundrobin
?????server master1 60.xx.xx.xx:1945
?????server master2 118.xx.xx.xx:1945

sudo systemctl restart haproxy
OK 搞定

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末乎串,一起剝皮案震驚了整個(gè)濱河市兼丰,隨后出現(xiàn)的幾起案子,更是在濱河造成了極大的恐慌悦荒,老刑警劉巖驰徊,帶你破解...
    沈念sama閱讀 218,640評(píng)論 6 507
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件,死亡現(xiàn)場(chǎng)離奇詭異哼转,居然都是意外死亡凉驻,警方通過查閱死者的電腦和手機(jī)愿棋,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,254評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事“颍” “怎么了?”我有些...
    開封第一講書人閱讀 165,011評(píng)論 0 355
  • 文/不壞的土叔 我叫張陵曼库,是天一觀的道長(zhǎng)区岗。 經(jīng)常有香客問我,道長(zhǎng)毁枯,這世上最難降的妖魔是什么慈缔? 我笑而不...
    開封第一講書人閱讀 58,755評(píng)論 1 294
  • 正文 為了忘掉前任,我火速辦了婚禮种玛,結(jié)果婚禮上藐鹤,老公的妹妹穿的比我還像新娘瓤檐。我一直安慰自己,他們只是感情好娱节,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,774評(píng)論 6 392
  • 文/花漫 我一把揭開白布挠蛉。 她就那樣靜靜地躺著,像睡著了一般肄满。 火紅的嫁衣襯著肌膚如雪谴古。 梳的紋絲不亂的頭發(fā)上,一...
    開封第一講書人閱讀 51,610評(píng)論 1 305
  • 那天稠歉,我揣著相機(jī)與錄音掰担,去河邊找鬼。 笑死轧抗,一個(gè)胖子當(dāng)著我的面吹牛恩敌,可吹牛的內(nèi)容都是我干的瞬测。 我是一名探鬼主播横媚,決...
    沈念sama閱讀 40,352評(píng)論 3 418
  • 文/蒼蘭香墨 我猛地睜開眼,長(zhǎng)吁一口氣:“原來是場(chǎng)噩夢(mèng)啊……” “哼月趟!你這毒婦竟也來了灯蝴?” 一聲冷哼從身側(cè)響起,我...
    開封第一講書人閱讀 39,257評(píng)論 0 276
  • 序言:老撾萬榮一對(duì)情侶失蹤孝宗,失蹤者是張志新(化名)和其女友劉穎穷躁,沒想到半個(gè)月后,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體因妇,經(jīng)...
    沈念sama閱讀 45,717評(píng)論 1 315
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡问潭,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,894評(píng)論 3 336
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了婚被。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片狡忙。...
    茶點(diǎn)故事閱讀 40,021評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖址芯,靈堂內(nèi)的尸體忽然破棺而出灾茁,到底是詐尸還是另有隱情,我是刑警寧澤谷炸,帶...
    沈念sama閱讀 35,735評(píng)論 5 346
  • 正文 年R本政府宣布北专,位于F島的核電站,受9級(jí)特大地震影響旬陡,放射性物質(zhì)發(fā)生泄漏拓颓。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,354評(píng)論 3 330
  • 文/蒙蒙 一描孟、第九天 我趴在偏房一處隱蔽的房頂上張望驶睦。 院中可真熱鬧腻格,春花似錦、人聲如沸啥繁。這莊子的主人今日做“春日...
    開封第一講書人閱讀 31,936評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽旗闽。三九已至酬核,卻和暖如春,著一層夾襖步出監(jiān)牢的瞬間适室,已是汗流浹背嫡意。 一陣腳步聲響...
    開封第一講書人閱讀 33,054評(píng)論 1 270
  • 我被黑心中介騙來泰國(guó)打工, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留捣辆,地道東北人蔬螟。 一個(gè)月前我還...
    沈念sama閱讀 48,224評(píng)論 3 371
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像汽畴,于是被迫代替她去往敵國(guó)和親旧巾。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 44,974評(píng)論 2 355