[Logo] Terracotta Discussion Forums (LEGACY READ-ONLY ARCHIVE)
  [Search] Search   [Recent Topics] Recent Topics   [Members]  Member Listing   [Groups] Back to home page 
[Register] Register / 
[Login] Login 
[Expert]
Messages posted by: zhangb  XML
Profile for zhangb -> Messages posted by zhangb [19] Go to Page: 1, 2 Next 
Author Message
老马哥:
谢谢你的指导,有进展了,不过我还是有点看不懂,希望你来指点一下:
red5不用配module的,应该是terracotta的官方给了red5一个tc-config.xml文件吧,用这个来集群的,我刚刚找到了这个tc-config.xml文件,是这样写的:
<?xml version="1.0" encoding="UTF-8"?>
<con:tc-config xmlns:con="http://www.terracotta.org/config">
<servers>
<server host="%i" name="localhost">
<dso-port>9510</dso-port>
<jmx-port>9520</jmx-port>
<data>terracotta/server-data</data>
<logs>terracotta/server-logs</logs>
</server>
</servers>
<clients>
<logs>terracotta/client-logs</logs>
</clients>
<application>
<dso>
<instrumented-classes>
<include>
<class-expression>org.red5.server.so.TerracottaSharedObject</class-expression>
<honor-transient>true</honor-transient>
</include>

<include>
<class-expression>org.red5.io.utils.ObjectMap</class-expression>
</include>

<include>
<class-expression>org.red5.server.so.SharedObjectEvent</class-expression>
</include>
</instrumented-classes>
<roots>
<root>
<field-name>org.red5.server.so.TerracottaService.objects</field-name>
</root>
</roots>
<locks>
<autolock>
<method-expression>* org.red5.server.so.TerracottaService.*(..)</method-expression>
</autolock>
</locks>

<distributed-methods>
<method-expression run-on-all-nodes="false">void org.red5.server.so.TerracottaSharedObject.distributeUpdates(..)</method-expression>
</distributed-methods>

</dso>
</application>
</con:tc-config>
与这个文件在一起的还有一个src文件夹,里面有些类供这个xml加载。
这个是官方提供的文档:http://www.terracotta.org/confluence/display/wiki/Red5+and+Terracotta+POC
而官方文档提供的是linux的操作系统,而且又是2-3年前的,版本又低,真看不懂里面terracotta是怎么集群的··
在terracotta官网上看到:terracotta能集群很多服务器,tomcat、weblogic、jboss等等,这些在tc-config.xml的client节点下的module下配置就可以了,可官网提供的module的name有限啊,在官网上看到terracotta能集群red5的,可red5的module怎么配啊?
经过大家的帮助,集群终于成功了,但是session貌似不能共享啊:
这个是我的tc-config.xml文件:
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd" xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<tc-properties>
<property name="session.cookie.domain" value=".aptx4869.com"/>
</tc-properties>
<servers>

<!-- For more information on working with the Terracotta configuration file, including how to add
more servers, see http://www.terracotta.org/web/display/docs/About+Terracotta+Configuration+Files.

Edit the following server element so that its host attribute contains the value matching the
hostname for the Terracotta server. -->

<server host="192.168.2.13" name="zhangbei">
<dso-port>9510</dso-port>
<jmx-port>9520</jmx-port>
<data>tc_data/server1/server-data</data>
<logs>tc_data/server1/server-logs</logs>
<statistics>tc_data/server1/server-statistics</statistics>
<dso>
<persistence>
<mode>permanent-store</mode>
</persistence>
</dso>
</server>
<server host="192.168.2.3" name="ceshi">
<dso-port>9510</dso-port>
<jmx-port>9520</jmx-port>
<data>tc_data/server2/server-data</data>
<logs>tc_data/server2/server-logs</logs>
<statistics>tc_data/server2/server-statistics</statistics>
<dso>
<persistence>
<mode>permanent-store</mode>
</persistence>
</dso>
</server>
<!--
<mirror-groups>
<mirror-group group-name="aptx4869">
<members>
<member>sales01</member>
<member>sales02</member>
</members>
</mirror-group>
</mirror-groups>-->
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>

</servers>

<!-- Check that the TIM shown in the <module> element's name attribute matches the Tomcat version you
are using. The TIM listed here, "tim-tomcat-5.5" is for Tomcat 5.5. For example, if you are using
Tomcat 6.0, edit the name to "tim-tomcat-6.0". -->

<clients>
<modules>
<module name="tim-tomcat-5.5" version="2.1.1"/>

</modules>
</clients>

<!-- Using <web-application> elements, enter the context root of the web application being clustered.
If you are clustering more than one web application, use one <web-application> element per application.
Two example <web-application> elements are shown below. Edit or remove these elements as needed.
To set the value of the <web-application> element to the default web-application context, use the
special value "ROOT" (without quotation marks). -->

<application>
<dso>


<instrumented-classes>
<include>
<class-expression>num.NumberGuessBean</class-expression>
</include>
<include>
<class-expression>cal.*</class-expression>
</include>
</instrumented-classes>

<web-applications>
<web-application>jsp-examples</web-application>
<web-application>jsp-examples3</web-application>
</web-applications>
</dso>
</application>
</tc:tc-config>


启动terracotta的时候也很清楚的看到了集群成功的字样,这个是日志:
F:\terracotta>bin\start-tc-server.bat -n zhangbei
2010-03-19 17:07:18,562 INFO - Terracotta 3.2.1, as of 20100302-130324 (Revision
14673 by cruise@su10mo5 from 3.2)
2010-03-19 17:07:19,125 INFO - Configuration loaded from the file at 'F:\terraco
tta\tc-config.xml'.
2010-03-19 17:07:19,390 INFO - Log file: 'F:\terracotta\tc_data\server1\server-l
ogs\terracotta-server.log'.
2010-03-19 17:07:19,765 INFO - Available Max Runtime Memory: 504MB
2010-03-19 17:07:20,171 INFO - JMX Server started. Available at URL[service:jmx:
jmxmp://0.0.0.0:9520]
2010-03-19 17:07:26,093 INFO - Becoming State[ ACTIVE-COORDINATOR ]
2010-03-19 17:07:26,140 INFO - Terracotta Server instance has started up as ACTI
VE node on 0.0.0.0:9510 successfully, and is now ready for work.
2010-03-19 17:07:37,421 INFO - NodeID[192.168.2.3:9510] joined the cluster

然后我就用tomcat里面的例子来测试(jsp-examples和jsp-examples3,其实都是一样的文件)。
打开http://192.168.2.13:8080/jsp-examples/cal/login.html,登陆后就开始修改日志,我在同一台机器上修改后,可以看到效果,但用另一台登陆后,就看不到修改后的效果了···
这个是怎么回事?
是我的tc-config.xml没配好?
有的时候登陆后,修改时,页面还有这个错误:You must enter your name and email address correctly.

这个是怎么回事?


还有就是TC的控制台,虽然觉得非常美观,但我不怎么会看,有这方面的资料提供吗?


老马哥:
我按你的tc-config.xml文件配下去结果没有集群起来,但也没有报错,2个terracotta服务器开启之后,在terracotta控制台上看着,server1和server2在那里乱晃,要么server1变成红色,要么server2变成红色,苦闷啊。
而我按这个这个tc-config.xml:
<servers>

<!-- For more information on working with the Terracotta configuration file, including how to add
more servers, see http://www.terracotta.org/web/display/docs/About+Terracotta+Configuration+Files.

Edit the following server element so that its host attribute contains the value matching the
hostname for the Terracotta server. -->

<server host="192.168.2.13" name="zhangbei">
</server>

<server host="192.168.2.19" name="ceshi">
</server>

<ha>
<mode>networked-active-passive</mode>
<mode>
</mode>
</ha>

<update-check>
<enabled>true</enabled>
</update-check>

</servers>
文件配了之后,能显示集群成功,在打开测试页面的时候报TCNonPortableObjectError,是关于boot jar的错误,我按要求修改了tc-config.xml文件后,重启tomcat时 却发现tomcat启动报错,连锁异常··
我也遇到这个问题了:
我用的版本是3.2.1,我的tc-config.xml文件是:
<servers>

<!-- For more information on working with the Terracotta configuration file, including how to add
more servers, see http://www.terracotta.org/web/display/docs/About+Terracotta+Configuration+Files.

Edit the following server element so that its host attribute contains the value matching the
hostname for the Terracotta server. -->

<server host="192.168.2.13" name="zhangbei">
</server>

<server host="192.168.2.19" name="ceshi">
</server>

<ha>
<mode>networked-active-passive</mode>
</ha>

<update-check>
<enabled>true</enabled>
</update-check>

</servers>

<!-- Check that the TIM shown in the <module> element's name attribute matches the Tomcat version you
are using. The TIM listed here, "tim-tomcat-5.5" is for Tomcat 5.5. For example, if you are using
Tomcat 6.0, edit the name to "tim-tomcat-6.0". -->

<clients>
<modules>
<module name="tim-tomcat-5.5" version="2.1.1"/>

</modules>
</clients>

<!-- Using <web-application> elements, enter the context root of the web application being clustered.
If you are clustering more than one web application, use one <web-application> element per application.
Two example <web-application> elements are shown below. Edit or remove these elements as needed.
To set the value of the <web-application> element to the default web-application context, use the
special value "ROOT" (without quotation marks). -->

<application>
<dso>
<instrumented-classes>
<include>
<class-expression>num.NumberGuessBean</class-expression>
</include>
<include>
<class-expression>cal.*</class-expression>
</include>
</instrumented-classes>

<web-applications>
<web-application>jsp-examples</web-application>
<web-application>jsp-examples1</web-application>
</web-applications>
</dso>
</application>
出现错误后,它提示要在tc-config.xml中的<dso>节点中加入,
<additional-boot-jar-classes>
<include>java.util.TimeZone</include>
</additional-boot-jar-classes>
这段,然后在生成boot.jar:
F:\terracotta>bin\make-boot-jar.bat -f F:\terracotta\tc-config.xml
然后再重启tomcat就可以了,
我按它的提示做了,可连tomcat启动都报错··好像是连锁异常吧
我还想知道的,刚刚老马说的修改web.xml或者conte.xml文件 修改的是terracotta\sessions\conf-samples的文件 还是tomcat中的呢?
我做的是terracotta集群tomcat,这个不是session集群吗?
他们有区别?
这个是我的tc-config.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd" xmlns:tc="http://www.terracotta.org/config" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

<servers>

<!-- For more information on working with the Terracotta configuration file, including how to add
more servers, see http://www.terracotta.org/web/display/docs/About+Terracotta+Configuration+Files.

Edit the following server element so that its host attribute contains the value matching the
hostname for the Terracotta server. -->

<server host="192.168.2.13" name="zhangbei">
<dso-port>9510</dso-port>
</server>

<server host="192.168.2.19" name="ceshi">
<dso-port>9510</dso-port>
</server>

<update-check>
<enabled>true</enabled>
</update-check>

</servers>

<!-- Check that the TIM shown in the <module> element's name attribute matches the Tomcat version you
are using. The TIM listed here, "tim-tomcat-5.5" is for Tomcat 5.5. For example, if you are using
Tomcat 6.0, edit the name to "tim-tomcat-6.0". -->

<clients>
<modules>
<module name="tim-tomcat-5.5" version="2.1.1"/>
<module name="tim-session-common" version="2.1.1"/>
<module name="tim-tomcat-common" version="2.1.1"/>
</modules>
</clients>

<!-- Using <web-application> elements, enter the context root of the web application being clustered.
If you are clustering more than one web application, use one <web-application> element per application.
Two example <web-application> elements are shown below. Edit or remove these elements as needed.
To set the value of the <web-application> element to the default web-application context, use the
special value "ROOT" (without quotation marks). -->

<application>
<dso>
<instrumented-classes>
<include>
<class-expression>num.NumberGuessBean</class-expression>
</include>
<include>
<class-expression>cal.*</class-expression>
</include>
</instrumented-classes>

<web-applications>
<web-application>jsp-examples</web-application>
</web-applications>
</dso>
</application>
</tc:tc-config>


跟这个错误一样:http://forums.terracotta.org/forums/posts/list/2112.page

我bin\start-tc-server.bat -n zhangbei后得到的错误信息就是:
*************************************************************************
At least one server defined in the Terracotta configuration file is in
'temporary-swap-only' persistence mode. (Servers in this mode:
[zhangbei, ceshi].)

If even one server has persistence mode set to temporary-swap-only,
then High Availability mode must be set to 'networked-active-passive'

For servers in a mirror group, High Availability mode can be set per
mirror group. A mirror-group High Availability setting overrides the main
High Availability for that mirror group.

See the Terracotta documentation for more details.
*************************************************************************
不加 -n 错误信息就是:
*******************************************************************************
You have not specified a name for your L2, and there are 2 L2s defined in the co
nfiguration file. You must indicate which L2 this is.
*******************************************************************************
你说的那个 -f后面接的是什么意思 我不是很明白,我加了之后就报找不到文件的错误。
还是有错:
2010-03-16 12:06:25,593 INFO - Configuration loaded from the file at 'F:\terr
tta\tc-config.xml'.
2010-03-16 12:06:25,781 INFO - Log file: 'C:\Documents and Settings\Administr
r\tools\terracotta\85\server-logs\terracotta-server.log'.


Fatal Terracotta startup exception:


*************************************************************************
At least one server defined in the Terracotta configuration file is in
'temporary-swap-only' persistence mode. (Servers in this mode:
[zhangbei, ceshi].)

If even one server has persistence mode set to temporary-swap-only,
then High Availability mode must be set to 'networked-active-passive'

For servers in a mirror group, High Availability mode can be set per
mirror group. A mirror-group High Availability setting overrides the main
High Availability for that mirror group.

See the Terracotta documentation for more details.
*************************************************************************
遇到问题了,我在tc-config.xml里面配了2个server,结果再启动服务时报错了:

F:\terracotta>bin\start-tc-server.bat
2010-03-16 10:52:07,250 INFO - Terracotta 3.2.1, as of 20100302-130324 (Revision
14673 by cruise@su10mo5 from 3.2)
2010-03-16 10:52:07,796 INFO - Configuration loaded from the file at 'F:\terraco
tta\tc-config.xml'.


Fatal Terracotta startup exception:


*******************************************************************************
You have not specified a name for your L2, and there are 2 L2s defined in the co
nfiguration file. You must indicate which L2 this is.
*******************************************************************************


Server startup failed.

顺便还想了解的是,配置webAppliction的时候,一台pc上有2个tomcat的话,直接写工程名,没关系吗?

你们的客户端中为什么填这么多啊,什么意思呢?
<modules>
<module name="tim-tomcat-6.0" version="2.1.0"/>
<module name="tim-session-common" version="2.1.0"/>
<module name="tim-tomcat-common" version="2.1.0"/>
<module name="tim-tomcat-5.5" version="2.1.0"/>
</modules>
而我的modules里面只有一个:<module name="tim-tomcat-5.5" version="2.1.0"/>
dongen:
非常谢谢你耐心的指导。
那tc-cofing.xml中,只要在server标签下多加一个server就可以了?
client不需要改变? 是这样的吗:
<servers>

<!-- For more information on working with the Terracotta configuration file, including how to add
more servers, see http://www.terracotta.org/web/display/docs/About+Terracotta+Configuration+Files.

Edit the following server element so that its host attribute contains the value matching the
hostname for the Terracotta server. -->

<server host="server1">
<dso-port>9510</dso-port>
</server>
<server host="server2">
<dso-port>9510</dso-port>
</server>

<update-check>
<enabled>true</enabled>
</update-check>

</servers>

<!-- Check that the TIM shown in the <module> element's name attribute matches the Tomcat version you
are using. The TIM listed here, "tim-tomcat-5.5" is for Tomcat 5.5. For example, if you are using
Tomcat 6.0, edit the name to "tim-tomcat-6.0". -->

<clients>
<modules>
<module name="tim-tomcat-5.5" version="2.1.1"/>
</modules>
</clients>

在集群的时候会开启很多个tomcat,那tomcat的端口是不是都要修改,避免冲突啊?
我是照着老马的文章做的,我想是我太菜了,人家都写的那么详细了 我还看不懂。
这个是老马写的安装过程:
安装过程
1、在所有机器上安装Java

2、在所有机器上安装Terracotta

3、选一台机器作为Terracotta服务器

4、在所有运行Tomcat的机器上也安装Terracotta,他们将称为Terracotta客户端

5、在应用服务器节点上安装Tomcat

6、把要部署的Web应用部署在所有Tomcat上

假如我现在有2台pc(ip1和ip2),4个tomcattomcat(t1,t2,t3,t4)。
我是不是该在2台pc上都安装terracotta;
然后就混乱了,选一台机器做terracotta的服务器是怎么回事?
这样的话,2个terracotta的tc-config.xml会有什么不同?
如果我想在每台pc上安装2个tomcat,我是不是只要把tomcat解压到terracotta的session文件夹下?项目是不是部署在tomcat的webapps里面?
谢谢dongen
我明白许多了, 等会去搞搞多个terracotta和tomcat集群··
谢谢了!
谢谢了,问题就出在这里,我的jdk放在有空格的目录下了,而且我自己的startupTC.bat中,也有一点错误,看了你的之后就明白了··
非常感谢坛子里的哥哥们,虽然terracotta的资料很少,但大家都这么热心,相信任何困难都会克服的!

顺便追问一下:tc-config.xml中的<web-application>examples</web-application>中的examples是我们部署的工程名吧,那是不是意味着我们的项目要部署在terracotta上?
觉得很不可思议,我们自己开发的项目该部署到哪里呢?
看着马哥的http://blog.csdn.net/lima01/archive/2009/07/25/4379572.aspx文章,再启动startupTC.bat时报错了,当set JAVA_OPTS=%JAVA_OPTS%(这里没有空格时)%TC_JAVA_OPTS%错误信息为:
F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>startupTC.bat

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>set TC_INSTALL_DI
R="C:\Program Files\terracotta\terracotta-3.2.1"

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>set TC_CONFIG_PAT
H="C:\Program Files\terracotta\terracotta-3.2.1\tc-config.xml"

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>call "C:\Program
Files\terracotta\terracotta-3.2.1"\bin\dso-env.bat -q
Starting BootJarTool...
2010-03-12 11:33:47,484 INFO - Terracotta 3.2.1, as of 20100302-130324 (Revision
14673 by cruise@su10mo5 from 3.2)
2010-03-12 11:33:47,937 INFO - Configuration loaded from the file at 'C:\Program
Files\terracotta\terracotta-3.2.1\tc-config.xml'.
2010-03-12 11:33:48,093 INFO - Log file: 'F:\Program Files\apache-tomcat-6.0.18\
apache-tomcat-6.0.18\bin\logs-192.168.2.13\terracotta-client.log'.
2010-03-12 11:33:50,218 INFO - Connection successfully established to server at
127.0.0.1:9510
2010-03-12 11:33:50,453 INFO - Terracotta 3.2.1, as of 20100302-130324 (Revision
14673 by cruise@su10mo5 from 3.2)
2010-03-12 11:33:51,031 INFO - Configuration loaded from the file at 'C:\Program
Files\terracotta\terracotta-3.2.1\tc-config.xml'.
Exception in thread "main" java.lang.LinkageError: loader constraint violation i
n interface itable initialization: when resolving method "com.tc.object.bytecode
.AQSSubclassStrongReferenceAdapter.create(Lcom/tc/asm/ClassVisitor;Ljava/lang/Cl
assLoader;)Lcom/tc/asm/ClassAdapter;" the class loader (instance of sun/misc/Lau
ncher$AppClassLoader) of the current class, com/tc/object/bytecode/AQSSubclassSt
rongReferenceAdapter, and the class loader (instance of <bootloader>) for interf
ace com/tc/object/bytecode/ClassAdapterFactory have different Class objects for
the type com/tc/asm/ClassVisitor used in the signature
at com.tc.object.config.StandardDSOClientConfigHelperImpl.addJDK15Instru
mentedSpec(StandardDSOClientConfigHelperImpl.java:698)
at com.tc.object.config.StandardDSOClientConfigHelperImpl.doAutoconfig(S
tandardDSOClientConfigHelperImpl.java:565)
at com.tc.object.config.StandardDSOClientConfigHelperImpl.<init>(Standar
dDSOClientConfigHelperImpl.java:253)
at com.tc.object.tools.BootJarTool.main(BootJarTool.java:2182)
请按任意键继续. . .

当那里有空格时,错误信息为:
F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>startupTC.bat

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>set TC_INSTALL_DI
R="C:\Program Files\terracotta\terracotta-3.2.1"

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>set TC_CONFIG_PAT
H="C:\Program Files\terracotta\terracotta-3.2.1\tc-config.xml"

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>call "C:\Program
Files\terracotta\terracotta-3.2.1"\bin\dso-env.bat -q
此时不应有 Files\Java\jdk1.6.0_11""。

F:\Program Files\apache-tomcat-6.0.18\apache-tomcat-6.0.18\bin>

知道的大虾们,帮忙看看错在哪里啊!
 
Profile for zhangb -> Messages posted by zhangb [19] Go to Page: 1, 2 Next 
Go to:   
Powered by JForum 2.1.7 © JForum Team