`
蓝之月
  • 浏览: 6038 次
  • 性别: Icon_minigender_1
  • 来自: 银川
最近访客 更多访客>>
社区版块
存档分类
最新评论

Terracotta and Tomcat Clustering - Page 2

    博客分类:
  • web
 
阅读更多

原网址:http://javadrama.blogspot.com/2012/10/terracotta-and-tomcat-clustering-page-2.html

Now, download apache-tomcat-6.0.35 and extract it twice to two directories of your choice, i will refer to them as ${CATALINA_HOME_NODE1} and ${CATALINA_HOME_NODE2}.

Copy Terracotta Libraries

we need two jar files to be copied to both Tomcats lib directory.
${TC_HOME}\common\terracotta-toolkit-1.6-runtime-5.0.0.jar
${TC_HOME}\sessions\terracotta-session-1.3.0.jar
 

Copy Terracotta Config File

we need to copy the same Terracotta configuration file to the conf directory of bothTomcats
${TC_HOME}\config\tc-config.xml

one small change to do, the client log location, both clients (Tomcat servers) can't be configured with the same client log location.

edit ${CATALINA_HOME_NODE2}\conf\tc-config.xml
change log location under the clients tag 
<logs>%(user.home)/terracotta/client-logs</logs>
to be 
<logs>%(user.home)/terracotta/client-logs2</logs>

Terracotta Valve

Tomcat connects to Terracotta by intercepting requests via a value, now let's hook that valve.
under the conf directory of both Tomcats, edit the file context.xml to look like this: 
<Context>

 <!-- Default set of monitored resources -->
 <WatchedResource>WEB-INF/web.xml</WatchedResource>

 <!-- Uncomment this to disable session persistence across Tomcat restarts -->
    <Manager pathname="" />
 
 <!-- Hook the Terracotta Valve and configure it using the tc-config.xml file -->
 <Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="../conf/tc-config.xml"/>

</Context>

note that we have disabled session persistence across Tomcat restarts because that is a task for Terracotta now.

Tomcat HA Configurations

 

 

jvmRoute

 
we need to define a unique jvmRoute for each Tomcat server.

edit ${CATALINA_HOME_NODE1}\conf\server.xml, change the Engine tag to look like this: 
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat1">
 
edit ${CATALINA_HOME_NODE2}\conf\server.xml, change the Engine tag to look like this: 
<Engine name="Catalina" defaultHost="localhost" jvmRoute="tomcat2">

Make sure you don't have port conflicts

as i am running both Tomcats on the same box, i had to change the ports for the second Tomcat.
in ${CATALINA_HOME_NODE2}\conf\server.xml, i have changed
shutdown port: 8005 to 8006
http port: 8080 to 8081
ajp port: 8009 to 8010

Run both Tomcats

open two more terminals and navigate to ${CATALINA_HOME_NODE1}\bin on one and ${CATALINA_HOME_NODE2}\bin on the other, on both terminals execute: 
startup.bat

if everything went as it should, you should see something like that on both Tomcat terminals 
Terracotta 3.7.0, as of 20120717-133013 (Revision unknown-20453 by cruise@rh5vmo113.terracotta.lan from 3.7.0)
Successfully loaded base configuration from file at 'H:\terracotta\apache-tomcat-6.0.35\bin\.\..\conf\tc-config.xml'.
Successfully loaded base configuration from file at 'H:\terracotta\apache-tomcat-6.0.35\temp\tc-config8509448930662041153.xml'.
Log file: 'C:\terracotta\client-logs\terracotta-client.log'.
Connection successfully established to server at 127.0.0.1:9510

Test it

Tomcat comes by default with a web application called examples, we will use it till the end of this tutorial to test our setup

point your browser to http://localhost:8080/examples/ and http://localhost:8081/examples/ and make sure both servers are responding.

open your Terracotta Development Console and make sure that both clients (the tomcat server) are present as below.

 
also note that the sessions button is now active.

 

分享到:
评论

相关推荐

    terracotta-toolkit-1.3-runtime-3.2.0.jar

    terracotta-toolkit-1.3-runtime-3.2.0.jar 集群实现JAR

    terracotta集群tomcat步骤

    Terracotta集群Tomcat的配置是一项复杂而关键的任务,它涉及到分布式系统中的高可用性和负载均衡。以下将详细解释这个过程中的各个步骤和相关知识点。 首先,安装Terracotta 3.2.1版本是非常基础的一步。需要注意的...

    terracotta-ee-4.1.2.jar,terracotta-license.key

    2. **无锁数据一致性**:通过其独特的无锁数据一致性模型,Terracotta确保了在高并发环境下的数据完整性,避免了死锁和其他并发问题。 3. **热备与故障切换**:在集群中,如果一台服务器出现故障,Terracotta能自动...

    Terracotta+tomcat集群配置详细说明(写了一晚上。。)

    【 Terracotta + Tomcat 集群配置详解】 在分布式计算环境中,集群技术是提升系统可用性和性能的重要手段。本文将深入探讨 Terracotta 与 Tomcat 集群的配置,以及如何利用 Terracotta 实现高效、可靠的 session ...

    terracotta-3.7.7-installer.jar

    terracotta-3.7.7-installer.jar

    通过_Terracotta实现基于Tomcat的Web应用集群

    ### 通过Terracotta实现基于Tomcat的Web应用集群 #### 概述 本文主要介绍了如何利用Terracotta与Tomcat构建高效的Web应用集群。在实际应用中,通过集群技术可以显著提升系统的可用性和伸缩性,特别是对于高流量、...

    terracotta-eclipse-plugin-3.7.7(terracotta的Eclipse插件)

    terracotta-eclipse-plugin-3.7.7-2013-08-19_16-03-48.tar(terracotta的Eclipse插件) 发现官网挺卡的,有时候下不了,先传上来吧,供国内用户下载,这个算最新的吧。2014-02-17下载的。

    terracotta-3.7.7-2013-08-19_16-03-48-installer(jar安装包)

    terracotta-3.7.7-2013-08-19_16-03-48-installer(jar安装包) 官方网站卡得要死,有时候不一定能下载,把最近自己用的,算最新版吧,提供在国内网站下载吧。 2014-02-17下载的。

    terracotta-ee-3.5.2

    terracotta-ee-3.5.2破解版

    ehcache-terracotta代码配置

    2. Terracotta集成 Terracotta是Ehcache的一个扩展,它将Ehcache实例转变为分布式缓存,允许在多台服务器之间共享缓存数据。Terracotta通过一个中心节点管理所有缓存实例,确保数据的一致性和同步。 3. 配置Ehcache...

    terracotta 集群设置说明(中文)

    记载了terracotta如何与tomcat、jetty等服务器的集群,解释了tc-config.xml中各个配置的作用

    apache2.2+mod_JK+Tomcat7+Terracotta3.7 集群(重要)

    Apache 2.2、mod_JK、Tomcat 7 和 Terracotta 3.7 是构建高可用性和可伸缩性Web应用集群的关键组件。这个集群解决方案旨在通过将负载分散到多个服务器上,提高应用程序的性能和稳定性。下面将详细阐述这些组件以及...

    Terracotta

    ### Terracotta:分布式内存管理解决方案 #### 一、Terracotta概述 Terracotta是一种分布式内存管理和数据共享平台,其核心产品BigMemory Max旨在帮助应用程序实现数据在内存中的高效管理,尤其适用于分布式服务器...

    ehcache-terracotta-ee-2.6.0.jar

    jar包,官方版本,自测可用

    Terracotta - Web CMS-开源

    2. **模板系统**:通过XSL和CSS, Terracotta 可能支持自定义模板,允许管理员选择或设计符合品牌风格的网站外观。 3. **权限管理**:作为CMS,它可能提供角色和权限管理功能,让管理员可以控制不同用户对内容的访问...

    Python库 | terracotta-toolbelt-0.0.5.tar.gz

    资源分类:Python库 所属语言:Python 资源全名:terracotta-toolbelt-0.0.5.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059

    ehcache2.6.6缓存相关jar

    做ehcache分布式缓存用的! ehcache-2.6.6.jar和terracotta-toolkit-1.6-runtime-5.5.0.jar 主要是给自己写的博客中做一个下载资源链接!

    Terracotta学习文档

    - **Session 同步优化**:Terracotta 的 session 同步机制是对传统 Tomcat 集群机制的一种优化。传统的 session 复制机制会在 session 发生任何变化时将整个 session 数据进行序列化并广播到所有节点,这可能导致...

Global site tag (gtag.js) - Google Analytics