1.1 deploy cluster servers
Server Load balancer is not a basic network device, but a performance optimization device. First, a single heavy load operation is distributed to multiple node devices for parallel processing. After each node device finishes processing, the results are summarized and returned to the user. The system processing capability is greatly improved, this is what we often call the cluster technology. The second layer means that a large amount of concurrent access or data traffic is distributed to multiple node devices for separate processing, reducing the user's waiting time for response, this mainly targets Web servers, FTP servers, key enterprise application servers, and other network applications.
What Is Nas, simply put, NAS is a file server that is based on dedicated hardware devices, installed with special operating systems, with powerful user access permission management, data security protection, and recovery functions.
The topology of the Streaming Media Server in VOD mode is as follows:
The first simple way, where Load balancer load balancing can be a variety of techniques, the use of DNS to configure multiple IP addresses to point to a domain name or the use of nginx reverse proxy (http://blog.s135.com/post/306 ):
The second Extensible Method:
1.2 deploy edge servers
The role and process of the Edge Server are as follows:
You only need to modify the configuration file vhost. XML. The specific path of this configuration file is: fms3 installation directory \ conf \ _ defaultroot _ \ _ defaultvhost _ \ vhost. XML, open the file in notepad and make the following changes:
1. Locate the <proxy> node and modify the mode attribute to remote, that is:
<Mode> remote </mode>
2. Modify routeentry attributes, such:
<Routeentry> 172.28.10.123: *; 172.28.14.242: 1935 </routeentry>
3. Restart the FMS service.
4. How to access:
NC. Connect ("rtmp: // 172.28.10.123"); It directs to the source server 172.28.14.242. The actual access address is rtmp: // 172.28.14.242/VOD/MP4: Test/3d5.mp4.
NC = new netconnection ();
NC. onstatus = function (Info)
{
Trace (info. Code );
If (info. Code = "netconnection. Connect. Success ")
{
Trace ("Connect ");
}
};
NC. Connect ("rtmp: // 172.28.10.123/VOD /");
Res = new netstream (NC );
View. attachvideo (RES );
View. attachaudio (RES );
Res. Play ("MP4: Test/3d5.mp4 ");
1.3 configure the Edge server cluster and Server Load balancer in nginx
1. Assign the domain name www.bbkwzk.com in the host file. The configuration is as follows:
127.0.0.1 www.bbkwzk.com
2. configure Server Load balancer and edge servers assigned by domain names as follows:
The four common settings supported by upstream are described as follows:
A) Round Robin (default): each request is distributed to different backend servers one by one in chronological order. If the backend servers are down, they can be automatically removed.
B) Weight: Specifies the polling probability. weight is proportional to the access ratio, which is used when the backend server performance is uneven.
C) ip_hash: each request is allocated according to the hash result of the access IP address, so that each visitor accesses a backend server at a fixed time, which can solve the session problem.
D) Fair (third-party): requests are distributed based on the response time of the backend server, and requests are prioritized for short response time.
E) url_hash (third-party)
Upstream www.bbkwzk.com {
Ip_hash;
Server 172.28.10.83: 80 Weight = 3;
Server 172.28.10.123: 80;
}
Server
{
Listen 80;
SERVER_NAME www.bbkwzk.com;
Location /{
Proxy_pass http://www.bbkwzk.com;
Proxy_set_header host www.bbkwzk.com;
Proxy_next_upstream error timeout invalid_header http_500 http_502 http_504;
Proxy_set_header X-real-IP $ remote_addr;
Proxy_set_header X-forwarded-for $ proxy_add_x_forwarded_for;
}
Log_format www_bbkwzk_com '$ remote_addr-$ remote_user [$ time_local] $ request'
'"$ Status" $ body_bytes_sent "$ http_referer "'
'"$ Http_user_agent" "$ http_x_forwarded_for "';
}
1.4 frontend Web Server Configuration
Front-end web server host file Configuration:
172.28.10.123 www. ***. com
127.0.0.1 video. ***. com
The front-end web server must point to the Streaming Media Server domain name www.bbkwzk.com
Server {
Listen 80;
SERVER_NAME video.bbkwzk.com;
Location /{
Proxy_set_header X-real-IP $ remote_addr;
Proxy_set_header host $ host;
Proxy_set_header X-forwarded-for $ proxy_add_x_forwarded_for;
Root C:/fms4/samples/bbkwzk;
Index videoplayer.html;
}
}
1.5 user client Configuration
User client host file Configuration:
172.28.10.53 video. ***. com (website)
172.28.10.123 www. ***. com (Streaming Media)