Crtmpserver Streaming Media server cluster installation configuration detailed

Source: Internet
Author: User
Tags lua openssl

Red5 stand-alone machine is still relatively good, but the official website does not have documents, do not know how the cluster configuration, network search for a half-day, only Red5 0.8 version has a cluster configuration. Later version looked at, there are clusters of plug-ins, but do not know how to install Plug-ins, even if installed plug-ins, how to configure the cluster, or do not know AH. No documents, Pit dad.
Crtmpserver Streaming media server, research and learning, the feeling is still good, below say, cluster configuration.

One, Crtmpserver download

Https://github.com/j0sh/crtmpserver

Second, the server description

192.168.10.208 Primary Server
192.168.10.202 from server

Third, the master and slave server installation Crtmpserver

1, install the dependent package
# yum Install cmake OpenSSL openssl-devel gcc gcc-c++ make

2, install Crtmpserver


# Unzip Centosinit.zip
# CD Crtmpserver-centosinit
# chmod +x cleanup.sh
# sh cleanup.sh
# CD Builders/cmake
# CMake.
# make

3, master server 208 configuration


# vim./crtmpserver/crtmpserver.lua

{//85 line, acceptors join, rtmp can use port 80. If 80 has other uses, do not set the
Ip= "0.0.0.0",
PORT=80,
Protocol= "Inboundrtmp"
},

Name= "Proxypublish",//256 line, where the cluster is configured
description= "Application for forwarding streams to another RTMP server",
Protocol= "Dynamiclinklibrary",
acceptors =//equivalent to a connection pool
{
{
Ip= "0.0.0.0",
port=6665,//Port of connection pool
Protocol= "Inboundrtmp"//Add
--protocol= "inboundliveflv"//--annotation Original
},
},
Abortonconnecterror=true,
TargetServers =
{
{
Targeturi= "rtmp://192.168.10.208/live/",//actual rtmp server
Targetstreamtype= "Live",
Localstreamname= "Test",
Keepalive=true,
Emulateuseragent= "My Master"
},
{
Targeturi= "rtmp://192.168.10.202:1935/live/",//actual rtmp server
Targetstreamtype= "Live",
Emulateuseragent= "My user Agent",
Localstreamname= "Test",
Keepalive=true
}
}


Note that crtmpserver consumes 8080,8081 by default, and some HTTP consumes these two ports. Port conflicts, Crtmpserver is Qibulai.
4, the default configuration from the server on the line, of course, you want to do a special configuration is also possible.


Four, start the master server

#./crtmpserver/crtmpserver/crtmpserver/crtmpserver.lua.
The following contents indicate that the launch was successful
+-----------------------------------------------------------------------------+
| services|
+---+---------------+-----+-------------------------+-------------------------+
|      C | IP |   Port|     Protocol Stack name | Application Name |
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|           1112|                    inboundjsoncli| admin|
+---+---------------+-----+-------------------------+-------------------------+
|tcp|   0.0.0.0|              80|              inboundrtmp| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|              1935|              inboundrtmp| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|             8081|              inboundrtmps| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|             8080|              Inboundrtmpt| appselector|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|           6666|              inboundliveflv| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|             9999|              inboundtcpts| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp|  0.0.0.0|              554|              inboundrtsp| flvplayback|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|              6665|             inboundrtmp| proxypublish|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|         8989|            httpechoprotocol| samplefactory|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|             8988|            echoprotocol| samplefactory|
+---+---------------+-----+-------------------------+-------------------------+
|tcp| 0.0.0.0|    1111|                  Inboundhttpxmlvariant| vptests|
+---+---------------+-----+-------------------------+-------------------------+
/root/crtmpserver-centosinit/sources/crtmpserver/src/crtmpserver.cpp:272 go! Go! Go! (31278)
Note that it is important to start from the server first.

Five, test the Crtmpserver cluster configuration, the following is installed on the primary server 208

1, install Rpmforge


# RPM-IVH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Root your Linux version selection
2, install FFmpeg
# yum Install FFmpeg

3, using FFmpeg to release rtmp stream


# ffmpeg-re-i "/root/test.flv"-vcodec copy-acodec copy-f flv rtmp://192.168.10.208:6665/live/test//Connection pool port
FFmpeg version 2.2.1 Copyright (c) 2000-2014 the FFmpeg developers
Built on APR 2014 13:00:18 with gcc 4.4.6 (gcc) 20120305 (Red Hat 4.4.6-4)
Configuration:--prefix=/usr--libdir=/usr/lib64--shlibdir=/usr/lib64--mandir=/usr/share/man--enable-shared-- Enable-runtime-cpudetect--ENABLE-GPL--enable-version3--enable-postproc--enable-avfilter--enable-pthreads-- Enable-x11grab--enable-vdpau--disable-avisynth--enable-frei0r--ENABLE-LIBOPENCV--enable-libdc1394-- enable-libgsm--enable-libmp3lame--enable-libnut--enable-libopencore-amrnb--ENABLE-LIBOPENCORE-AMRWB-- Enable-libopenjpeg--enable-librtmp--enable-libspeex--enable-libtheora--enable-libvorbis--enable-libvpx-- enable-libx264--enable-libxavs--enable-libxvid--extra-cflags= '-o2-g-pipe-wall-wp,-d_fortify_source=2- Fexceptions-fstack-protector--param=ssp-buffer-size=4-m64-mtune=generic-fpic '--disable-stripping
Libavutil 52. 66.100/52. 66.100
Libavcodec 55. 52.102/55. 52.102
Libavformat 55. 33.100/55. 33.100
Libavdevice 55. 10.100/55. 10.100
Libavfilter 4.  2.100/4. 2.100
Libswscale 2.  5.102/2. 5.102
Libswresample 0. 18.100/0. 18.100
Libpostproc 52.  3.100/52. 3.100
Input #0, FLV, from '/root/test.flv ':
Metadata:
Major_brand:isom
minor_version:512
Compatible_brands:isomiso2mp41
encoder:lavf55.33.100
duration:00:22:15.69, start:0.000000, bitrate:391 kb/s
Stream #0:0: Video:flv1, yuv420p, 320x240, kb/s, TBR, 1k TBN, 1k TBC
Stream #0:1: Audio:mp3, 22050 Hz, stereo, s16p, 0 kb/s
RTMP Server sent Error
RTMP Server sent Error
Output #0, FLV, to ' rtmp://192.168.10.208:6665/live/test ':
Metadata:
Major_brand:isom
minor_version:512
Compatible_brands:isomiso2mp41
encoder:lavf55.33.100
Stream #0:0: Video:flv1 ([2][0][0][0]/0x0002), yuv420p, 320x240, q=2-31, kb/s, 1k TBN, 1k TBC
Stream #0:1: Audio:mp3 ([2][0][0][0]/0x0002), 22050 Hz, stereo, 0 kb/s
Stream Mapping:
Stream #0:0-> #0:0 (copy)
Stream #0:1-> #0:1 (copy)
Press [Q] to stop, [?]

Frame= fps= q=-1.0 size= 131kB time=00:00:01.54 bitrate=//Transmit data to the 694.1KBITS/S channel and will continue to change directly until the end of the video

4, receive rtmp stream, online tools A lot, don't say more


Rtmp://192.168.10.208:6665/live/test
Rtmp://192.168.10.208/live/test
Rtmp://192.168.10.202:1935/live/test
Above three rtmp channels, you can see FFmpeg released video stream

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.