首页

August 9, 2006

Flash Media Server 2: 基本概念[翻译]

做为一个接触fms服务器的新手,其实好多地方都不是很清楚,今天看到一篇文章,我觉得很简单,不过也很重要,故把他翻译出来,希望能给大家有个基本概念的了解.

本人英语很差,3级都没有,翻译不好的地方请指出更正

原文地址:http://www.flashcomguru.com/articles/fms2_basics.cfm

Flash Media Server 2: Some basic concepts
by Stefan Richter, November 2005

The new Flash Media Server 2 (FMS) does no longer include or install any sample files. I think this is a good decision as it caused a lot of confusion with people being under the impression that the swf files needed to be on the same server as FMS itself. This is not the case, let me try and explain.

Flash Media Server 2 doesn't really have much in common with a web server, instead it enables your swf to make use of live or streaming media and data access functionalities. Your swf is still being served as usual via a web server and sometimes,

especially in a development environment, the webserver may reside on the same machine as FMS. In most cases however the FMS machine is a separate, physical machine to your webserver.

I like to compare it to a database server: MySQL or MSSQL can run but does not have to run on the same machine as your webserver. The database server can be located half way around the world yet your database connection will still be

established reliably.This is very similar to how FMS operates - your swf will make a connection to FMS 'behind the scenes' after it has been

served to the user's browser via your web server. The swf doesn't care where it was being served from - as long as the rtmp connection string points to the right place it will attempt a connection to FMS and if the connection succeeds then your application can use FMS functionalities. Macromedia has a graphic that shows this setup (see right) , I hope they don't mind me using it.

Let's look at how an rtmp address is contructed. Usually the rtmp address takes this format:
rtmp://fcserver.domain.com/app[/appinstance]
but sometimes it can also look like this
rtmp:/app[/appinstance]

app in this case specifies your application (a folder underneath FMS's applications directory) and appinstance is an optional application instance name. If you omit the application instance then FMS will automatically create and connect you to the default instance called _definst_. In the end you are therefore always connecting to an instance of your application even if you do not explicitly do so. This concept is important to understand as it directly affects the storage locations of flv files and it's something that many new users find problematic. Once you know how applications and instances are set up though it will make perfect sense.

The second rtmp string rtmp:/app[/appinstance]only shows one forward slash and no server or vhost address, this means the rtmp address is local - it will only connect successfully if the swf file has been served from the same machine as the one where FMS resides. I try and avoid this syntax whenever possible and usually only use it for local testing as it can lead to problems in a production environment when you move your FMS installation to another machine: You would either have to update the rtmp string, recompile and redeploy your video or you needed to make sure that your web server moves along with FMS. This seems cumberstone to me.

Instead I prefer the first syntax rtmp://fcserver.domain.com/app[/appinstance]
This fully qualified rtmp string is more readable and gives a lot more information about where the FMS machine is located, in this case at fcserver.domain.com
A swf using this syntax will attempt a connection to fcserver.domain.com/app no matter what happens, it could be run locally as well as served from a web server.


Flash Media Server 2: 一些基本概念
作者:Stefan Richter

新的Flash Media Server 2安装已经不在包含sample,我觉得这是一个很好的决定,因为它引起了不少人的概念混乱,会造成在大家心目中以为SWF文件必须放在安装了fms的服务器上. 事实并非如此,让我自愧不如.

Flash Media Server 2跟普通的web服务器相比并不具有很多相似地方,跟web服务器不同的是,它能让你的swf程序使用在线,流媒体或者数据存储功能.swf文件通常被放在一个专门的web服务器,并也能正常使用,当然在一个开发的环境,web服务器往往跟fms服务器在一台机器.不过在大多数情况下,fms服务器是从物理上跟web服务器分开的.

我比较喜欢跟数据库服务器比较:Mysql也可以独立运行,而不一定要跟web服务器在一起.数据库服务器可以放置在世界任何地方也可以跟web服务器连接.这个有点类似fms服务器,当用户通过web服务器访问swf,swf会与fms服务器后台建立一个连接.swf也不是都能正常运行,不过只要通过rtmp正确连接到fms服务器,并且你的应用程序使用fms的功能,那就都没问题.在Macromedia网站有一个显示这个体系结构的图,我希望他们不要介意我使用这张图.
rtmp.jpg


让我们看看怎么样的rtmp地址会应用,通常rtmp地址我们会这么写:
rtmp://fcserver.domain.com/app[/appinstance]
但有时候,我们也喜欢这么写
rtmp:/app[/appinstance]

地址里的app是指你的应用目录(这个目录在fms服务器的applications目录下),appinstance是指在你的应用目录你建立的实例名称.当你在fms服务器上申请实例连接时,会自动连接上fms的默认叫_definst_的实例,最后你会一直连接上实例,即使你不明确为什么这么做.这个概念很重要,因为它直接影响到flv文档的存放地点.这也是很多新手碰到的问题.只要你知道如何申请应用和实例的设置,哪将会很快入门了.

第2个rtmp地址 rtmp:/app[/appinstance]不显示服务器地址或者虚拟主机地址,这意味这rtmp服务器时本地的,这只可能发生在swf文件被存放在fms服务器同一个服务器上,我尽可能的避免这种语句,通常只是在本地机器测试的时候才会用到它,在实际生产或者服务器环境,如果你把fms迁移安装到另外一台服务器,那你就得重新更新rtmp地址,或者重新调整你的视频确保没问题,当fms服务迁移后.

首先我宁愿这样的语句: rtmp://fcserver.domain.com/app[/appinstance]
这个完整的rtmp地址,可以告诉我们很多关于fms的信息,采用这种语句的swf尝试连接fms服务器,不管是什么情况,是本地还是远程,都不会有问题.

由 frank 发表于 4:32 PM | 回复 (0) | 引用

FMS2(Flash Media Server )服务器的设置-日志篇

FMS2(Flash Media Server )服务器的设置-日志篇

最近配置fms2,闲来顺便翻译了一下配置文件,翻译不好,就当参考吧:)

FMS的log日志设置

由 frank 发表于 11:50 AM | 回复 (2)