您的位置:首页 > 其它

《Red5 用户参考手册》之三:入门第二章 配置文件

2012-07-15 09:36 417 查看
官方最新《Red5 用户参考手册》全套下载地址

Red5 安装目录下的 conf 目录

jetty.xml

HTTP 服务器和 servlet 容器的设置都是用此文件进行配置。它默认使用端口 5080 运行所有可用的接口。

请参考 Jetty 网页 http://jetty.mortbay.org/jetty6/ 来获得有关本文件更多语法。

keystore

包含一个样本的私钥和证书,以用于安全连接。

log4j.properties

控制记录子系统的日志级别和输出处理。

更多有关 log4j 信息可以在其官方网站找到:http://logging.apache.org/log4j/docs/

realm.properties(Jetty)

这个文件定义了可以用于安全保护区的用户密码和角色。

格式是:

<username>: <password>[,<rolename> ...]


密码可以是明文,混淆​​或校验。应该使用 org.mortbay.util.Password 生成混淆的密码或密码校验。

tomcat-users.xml (Tomcat)

这个文件定义了可以用于安全保护区的用户密码和角色。

格式是:

<user name="<username>" password="<password>" roles="[,<rolename> ...]" />


密码可以是明文,混淆​​或校验。更多不同的摘要支持或可用 realm 的实现请参考:http://tomcat.apache.org/tomcat-5.5-doc/realm-howto.html

更多有关 Tomcat realms 信息请参考官网:http://tomcat.apache.org/tomcat-5.5-doc/catalina/docs/api/org/apache/catalina/realm/package-summary.html

red5.globals

定义了 Red5 使用的默认的 global context 的配置文件的路径。

这一文件默认定位于 /webapps/red5-default.xml。

red5.properties

本文件包含的名/值对用于配置像 RTMP 或远程的主机和基本服务的端口。

red5.xml

将 context 树连接起来的主配置文件。它负责加载 red5-common.xml 和 red5-core.xml 并设置服务器其他一些配置。它是 Red5 需要加载的第一个文件。通过配置以下其中之一的标签来选择 J2EE 容器。

*Jetty

<bean id="jetty6.server" class="org.red5.server.JettyLoader" init-method="init" autowire="byType" />


*Tomcat

<bean id="tomcat.server" class="org.red5.server.TomcatLoader" init-method="init" destroy-method="shutdown">
   ... cut for brevity ... 
</bean>


red5-common.xml

所有子 context 间共享的类在本文件中进行声明。它包含的信息涉及到对象的序列化/反序列化、要使用的网络协议的编解码器以及可用的视频编解码器。对象缓存可以在本文件中进行配置或 spring-wired。目前有四种实现:第一个是我们自行创建的(简单的字节缓冲)其他的使用 WhirlyCache 或 Ehcache。如果不需要缓存的话可以定义 NoCache 的实现:

<bean id="object.cache" class="org.red5.server.cache.NoCacheImpl"/>


其他 bean 配置可以参考如下(每次只能单独使用一个):

*Red5 自己用的简单例子

<bean id="object.cache" class="org.red5.server.cache.CacheImpl" init-method="init" autowire="byType">
   <property name="maxEntries"><value>5</value></property> 
</bean>


*EhCache http://ehcache.sourceforge.net/
<bean id="object.cache" class="org.red5.server.cache.EhCacheImpl" init-method="init"> 
            <property name="diskStore" value="java.io.tmpdir" /> 
            <property name="memoryStoreEvictionPolicy" value="LFU" /> 
            <property name="cacheManagerEventListener"><null/></property>  
            <property name="cacheConfigs"> 
               <list> 
                  <bean class="net.sf.ehcache.config.CacheConfiguration"> 
                     <property name="name" value="flv.cache" /> 
                     <property name="maxElementsInMemory" value="5" /> 
                     <property name="eternal" value="false" /> 
                     <property name="timeToIdleSeconds" value="0" /> 
                     <property name="timeToLiveSeconds" value="0" /> 
                     <property name="overflowToDisk" value="false" /> 
                     <property name="diskPersistent" value="false" /> 
                  </bean>   
               </list> 
            </property> 
         </bean>


*Whirlycache https://whirlycache.dev.java.net/
<bean id="object.cache" class="org.red5.server.cache.WhirlyCacheImpl" init-method="init" autowire="b 
<property name="maxEntries" value="5" /> 
<property name="cacheConfig"> 
<bean class="com.whirlycott.cache.CacheConfiguration"> 
<property name="name" value="flv.cache" /> 
<property name="maxSize" value="5" /> 
<!-- This policy removes cached items, biased towards least frequently used (LFU) Items --> 
<property name="policy"><value>com.whirlycott.cache.policy.LFUMaintenancePolicy</value></property> 
<!-- This policy removes cached items, biased towards least recently used (LRU) Items --> 
<!-- property name="policy"><value>com.whirlycott.cache.policy.LRUMaintenancePolicy</value></propert 
<!-- This policy removes cache items in the order in which they were added -->
Configuration files used by Red5 
<!-- property name="policy"><value>com.whirlycott.cache.policy.FIFOMaintenancePolicy</value></proper 
<!-- A predicate for filtering Collections of Items based on their expiration time --> 
<!-- property name="policy"><value>com.whirlycott.cache.policy.ExpirationTimePredicate</value></prop 
<!-- property name="backend"><value>com.whirlycott.cache.impl.ConcurrentHashMapImpl</value></propert 
<property name="backend"><value>com.whirlycott.cache.impl.FastHashMapImpl</value></property> 
</bean>


red5-core.xml

所有可用的网络服务都在这里进行指定。默认是 RTMP 和 RTMPT。当使用 Jetty 作为 J2EE 容器时 RTMPT 服务器的设置可以在 red5-rtmpt.xml 中找到。RTMPT 的处理程序可以选择以下的其中之一进行配置。

*Jetty

<bean id="rtmpt.server" class="org.red5.server.net.rtmpt.RTMPTLoader" init-method="init" autowire="bType"/>


*Tomcat

<bean id="rtmpt.server" class="org.red5.server.net.rtmpt.TomcatRTMPTLoader" init-method="init" autowire="bType"> 
   ... cut for brevity ... 
</bean>


red5-rtmpt.xml

设置 RTMPT URL 和 servlet 之间的映射,并指定主机和端口号。默认情况下 RTMPT 主机提供的接口使用端口号 8088。

请参考 Jetty 网站 http://jetty.mortbay.org/jetty6/ 来获得关于本文件的更多语法信息。

web.xml (Tomcat)

默认用于 Tomcat 的 web.xml。在本文件可以指定一个 web 应用程序在自己的 WEB_INF/ web.xml 之前的一些设置应用。更多有关此文件的配置信息可以参考:http://tomcat.apache.org/tomcat-5.5-doc/jasper-howto.html#Configuration

web-default.xml (Jetty)

默认用于 Jetty 的 web.xml 文件。在本文件可以指定一个 web 应用程序在自己的 WEB_INF/ web.xml 之前的一些设置应用。

Red5 应用程序配置目录

red5-web.xml

Red5 应用程序可以在此文件中进行配置。脚本实现或者 Java 应用程序可以通过 Spring bean 元素进行配置。

*Java 应用程序

<bean id="web.handler" class="org.red5.server.webapp.oflaDemo.Application" singleton="true" />


*Javascript / Rhino 程序

<bean id="web.handler" class="org.red5.server.script.rhino.RhinoScriptFactory"> 
   <constructor-arg index="0" value="classpath:applications/main.js"/> 
   <!-- Implemented interfaces --> 
   <constructor-arg index="1"> 
      <list> 
         <value>org.red5.server.api.IScopeHandler</value> 
         <value>org.red5.server.adapter.IApplication</value> 
      </list> 
   </constructor-arg> 
   <!-- Extended class --> 
   <constructor-arg index="2"> 
      <value>org.red5.server.adapter.ApplicationAdapter</value> 
   </constructor-arg> 
</bean>


*Ruby 程序

<bean id="web.handler" class="org.red5.server.script.jruby.JRubyScriptFactory"> 
   <constructor-arg index="0" value="classpath:applications/main.rb"/> 
   <constructor-arg index="1"> 
      <list> 
         <value>org.red5.server.api.IScopeHandler</value> 
         <value>org.red5.server.adapter.IApplication</value> 
      </list> 
   </constructor-arg> 
</bean>


原文链接:http://trac.red5.org/wiki/Documentation/UsersReferenceManual/GettingStarted/02-Configuration-Files
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐