Web Sessions Installation

本文详细介绍了如何在不使用TerracottaDSO的情况下,进行WebSessions的集群配置,包括JDK和Terracotta版本要求、安装步骤、web.xml和context.xml的配置示例,以及如何在多服务器环境中设置高可用性和扩展集群。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

展示不使用Terracotta DSO如何集群Web Sessions。

  1、要求

    1)jdk1.6或者更高版本

    2)Terracotta 3.7或者更高版本

    3)所有被集群的对象需要实现序列化,如果不想实现序列化,必须使用Terracotta DSO定制Web Sessions的安装

  2、安装Terracotta Sessions jar

    1)为保证兼容性,请使用已安装的Terracotta的jar文件

    2)为了使应用的web Sessions在集群中共享,添加下列jar文件到应用服务器的的lib目录中

${TERRACOTTA_HOME}/sessions/terracotta-session-<version>.jar

    ${TERRACOTTA_HOME} 是指Terracotta的安装目录,<version>是指当前使用的terracotta session的版本,我这里就是D:/terracotta/terracotta-3.7.2/sessions/terracotta- session-1.3.1.jar。

${TERRACOTTA_HOME}/common/terracotta-toolkit-<API-version>-runtime-ee-<version>.jar

     The Terracotta Toolkit JAR包含了Terracotta客户端类库,<API-version> 就是指Terracotta Toolkit API version. <version>就是当前使用的Terracotta Toolkit JAR版本,我这里就是:D:/terracotta/terracotta-3.7.2/common/terracotta-toolkit- 1.6-runtime-5.2.0.jar

     3)上述session和toolkit的jar文件在各种应用服务器中的存放路径

Application ServerSuggested Location for Terracotta Sessions JAR File
JBoss AS (earlier than 6.0)< jboss install dir>/lib
JBoss AS 6.0< jboss install dir>/common/lib (REQUIRED)
JBoss AS 7.0 or 7.1< jboss install dir>/WEB-INF/lib
JettyWEB-INF/lib
Tomcat 5.0 and 5.5$CATALINA_HOME/server/lib
Tomcat 6.0 and 7.0$CATALINA_HOME/lib
WebLogicWEB-INF/lib

  3、配置web-session集群

     1)Terracotta servers和Terracotta clients通过 Terracotta配置文件运行在集群中的应用服务器上,默认的配置文件是tc-config.xml,服务器启动的时候不指定配置文件就默认使用 tc-config.xml。

    2)为了把Terracotta集群添加到我们的应用中,需要通过web.xml或者context.xml文件指定Terracotta clients如何获取配置。

    3)Jetty, WebLogic, and WebSphere需要添加以下配置到web.xml文件中

 

       <filter-class>中的{container-specific-class}根据实际的应用服务器类型选择:

ContainerValue of <filter-class>
Jetty 6.1org.terracotta.session.TerracottaJetty61xSessionFilter
Jetty 7.4.1org.terracotta.session.TerracottaJetty74xSessionFilter
WebLogic 9org.terracotta.session.TerracottaWeblogic9xSessionFilter
WebLogic 10org.terracotta.session.TerracottaWeblogic10xSessionFilter
WebSphere 6.1org.terracotta.session.TerracottaWebsphere61xSessionFilter
WebSphere 7.0org.terracotta.session.TerracottaWebsphere70xSessionFilter

      4)Tomcat and JBoss AS 6.0 or Earlier

        使用war包发布的应用,如果是tomcat,确保context.xml文件在/META-INF目录下,如果是JBoss,确保context.xml文件在/WEB-INF目录下。

        context.xml文件内容如下:

<Valve className="org.terracotta.session.{container-specific-class}" tcConfigUrl="localhost:9510"/>

       {container-specific-class}根据实际的应用服务器类型选择:

ContainerValue of className
JBoss Application Server 4.0org.terracotta.session.TerracottaJboss40xSessionValve
JBoss Application Server 4.2org.terracotta.session.TerracottaJboss42xSessionValve
JBoss Application Server 5.1org.terracotta.session.TerracottaJboss51xSessionValve
JBoss Application Server 6.0org.terracotta.session.TerracottaJboss60xSessionValve
Tomcat 5.0org.terracotta.session.TerracottaTomcat50xSessionValve
Tomcat 5.5org.terracotta.session.TerracottaTomcat55xSessionValve
Tomcat 6.0org.terracotta.session.TerracottaTomcat60xSessionValve
Tomcat 7.0org.terracotta.session.TerracottaTomcat70xSessionValve

        例如在tomcat6.0中,context.xml内容如下:

<Context>  <Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="localhost:9510"/>
</Context>

        确保Terracotta Value是context.xml文件中的第一个<Value>元素。

        如果在tomcat中使用了authenticator,在Terracotta集群运行的时候有可能会遇到UnsupportedOperationException,在tomcat5.5以上可以禁用changeSessionIdOnAuthentication来防止这种错误:

<Valve changeSessionIdOnAuthentication="false" className="org.apache.catalina.authenticator.BasicAuthenticator"/>

       5)JBoss7.0 or 7.1  

      添加以下内容到WEB-INF/jboss-web.xml中

<?xml version="1.0" encoding="UTF-8"?><jboss-web>...  <valve>    <class-name>org.terracotta.session.TerracottaJboss7xSessionValve</class-name>              <param>        <param-name>tcConfigUrl</param-name>
        <param-value>localhost:9510</param-value>      </param>  </valve>...</jboss-web>

  4、启动集群

    1)启动 Terracotta server:

      UNIX/Linux

${TERRACOTTA_HOME}/bin/start-tc-server.sh &

      Microsoft Windows

${TERRACOTTA_HOME}/bin/start-tc-server.bat

    2)启动应用服务器

    3)启动Terracotta 控制台

     UNIX/Linux

${TERRACOTTA_HOME}/bin/dev-console.sh &

    Microsoft Windows

${TERRACOTTA_HOME}/bin/dev-console.bat

    4)启动控制台后,可以看到集群中Terracotta Server和客户端

  5、Terracotta配置

    这里配置展示如何在分开的机器上运行服务器和客户端,增加容灾(高可用性),扩展集群和添加高可用性可以按照下面的步骤: 

  • Moving the Terracotta server to its own machine
  • Creating a cluster with multiple Terracotta servers
  • Creating multiple application nodes

    1)关闭Terracotta Cluster

    2)创建Terracotta配置文件tc-config.xml:

    3)在tc-config.xml中配置的每一台服务器机器上安装terracotta3.7.2

    4)把tc-config.xml文件复制到每一台服务器中的terracotta Server可以访问的位置

    5)在每一台服务器中按照上面步骤(2、安装Terracotta Sessions jar)安装Terracotta Sessions jar

    6)在每一台应用服务器中配置web.xml或者context.xml

      如果使用的是web.xml,按如下配置:

<param-value>server.1.ip.address:9510,server.2.ip.address:9510</param-value>

      如果使用的是context.xml,按如下配置:

tcConfigUrl="server.1.ip.address:9510,server.2.ip.address:9510"

      tc-config.xml中配置了多少台服务器,web.xml或者context.xml就要配置多少。

    7)启动Terracotta Server

    UNIX/Linux

${TERRACOTTA_HOME}/bin/start-tc-server.sh -f <path/to/tc-config.xml> -n Server1 &

    Microsoft Windows

${TERRACOTTA_HOME}/bin/start-tc-server.bat -f <path/to/tc-config.xml> -n Server1 

    ${TERRACOTTA_HOME}是指terracotta的安装目录

    <path/to/tc-config.xml>是指tc-config.xml文件的完整存放路径

    Server1是指在tc-config.xml文件中配置的ServerName

    在每一台服务器上启动各自的Terracotta Server,注意启动的时候 -n 指定各自的ServerName,第二台和往后启动的Terracotta Server处于备用状态。

    8)在每一台服务器上启动各自的应用服务器

    9)启动Terracotta控制台查看集群

### VNC Session Configuration and Troubleshooting #### Understanding VNC Sessions on Different Linux Distributions For configuring VNC remote access specifically for the GNOME desktop environment on CentOS 7, one can follow detailed instructions provided by guides such as those found at TecMint which offer comprehensive steps from installation through configuration[^1]. On Debian or Ubuntu systems, there exists a global configuration file located at `/etc/vnc.conf` that allows administrators to set up universal settings applicable across all instances of `vncserver`, streamlining management tasks significantly[^2]. #### Listing Active VNC Sessions with TurboVNC When using TurboVNC within an environment like a web browser, users have tools available to manage their active sessions effectively. For instance, executing the command `/opt/TurboVNC/bin/vncserver-list` lists all current TurboVNC sessions along with associated X display numbers and process IDs running under a specific user account on any given host machine[^3]. #### Common Issues and Solutions During Setup One common issue encountered during setup involves ensuring compatibility between different versions of software components involved in establishing a successful connection. Ensuring both server-side (Linux distribution-specific packages) and client-side applications (such as VNC Viewer) match expected requirements is crucial. Another frequent challenge lies in firewall configurations blocking necessary ports used by VNC services; adjusting these rules appropriately ensures smooth communication channels without compromising security standards. Lastly, verifying correct authentication mechanisms—whether password-based or key pair authentications—are properly configured prevents unauthorized access while maintaining operational efficiency. ```bash # Example Command to Check Firewall Status sudo systemctl status firewalld.service ``` --related questions-- 1. What are some best practices when setting up VNC servers? 2. How does one secure VNC connections against potential threats? 3. Can you explain how to troubleshoot connectivity issues related to VNC? 4. Are there alternative methods besides traditional port forwarding for accessing VNC remotely?
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

老帽爬新坡

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值