Cluster com Terracotta
Posted on | 1 de July, 2010 | No Comments
Pesquisando sobre clusterização, acabei encontrando o TerraCotta (http://www.terracotta.org/)
Para executá-lo no modo mais simples, sem fazer uma configuração mais fina, bastou instalá-lo no servidor (terracotta-3.2.1_2-installer.jar) e colocá-lo para funcionar.
Configurei um arquivo (tc-config.xml) e coloquei junto com o start-tc-server.bat – na pasta bin.
C:\Arquivos de programas\terracotta\terracotta-3.2.1_2\bin>start-tc-server.bat -n Server1
O meu arquivo de configuração:
<?xml version="1.0" encoding="UTF-8"?>
<!-- All content copyright Terracotta, Inc., unless otherwise indicated. All rights reserved. -->
<tc:tc-config xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-5.xsd"
xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<servers>
<!– Sets where the Terracotta server can be found. Replace the value of host with the server’s IP address. –>
<server host=”10.2.0.101″ name=”Server1″>
<data>%(user.home)/terracotta/server-data</data>
<logs>%(user.home)/terracotta/server-logs</logs>
</server>
<!– If using more than one server, add an <ha> section. –>
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>
</servers>
<!– Sets where the generated client logs are saved on clients. –>
<clients>
<logs>%(user.home)/terracotta/client-logs</logs>
</clients>
</tc:tc-config>
E nas aplicações, eu coloquei no context.xml (no META-INF) ou diretamente na pasta conf do Tomcat:
<Context>
<Valve className="org.terracotta.session.TerracottaTomcat60xSessionValve" tcConfigUrl="10.2.0.101:9510"/>
<param-value>10.2.0.101:9510</param-value>
</Context>
Pronto, acione o Developer Console e veja os clientes de seu cluster.
Comments
Leave a Reply