Author |
Message |
07/03/2008 06:37:47
|
rehsiftt
journeyman
Joined: 06/26/2008 06:42:32
Messages: 13
Offline
|
I am now at the point where I am trying to get my application to run off a passive and active server setup.
http://www.terracotta.org/confluence/display/docs1/Creating+a+Terracotta+Server+Cluster#CreatingaTerracottaServerCluster-ACTIVEPASSIVEovernetwork
My question is, does my tc-config.xml file sit on the servers on or on the nodes to let them know which servers are which? I guess I am confused as to where I put the XML doc on the file system so I will be called properly.
|
|
|
07/03/2008 07:55:47
|
tgautier
seraphim
Joined: 06/05/2006 12:19:26
Messages: 1781
Offline
|
Yes, this point is not well spelled out in the docs.
You have two options, actually. To start with, the first option is easier, but in production, we recommend the latter.
First, let me explain:
The Terracotta clients - your JVM - load the tc-config file from two possible locations - either a file or a remove server (or an http address).
The Terracotta servers load the tc-config file from two possible locations - either a file or an http address.
So, the recommended setups are:
a) For development, load the tc-config file from the local filesystem for all tc clients (your jvms) and the tc server(s). Note that the clients will use the tc-config file to determine where the server is in this configuration, so you must make sure the servers section states where the servers are.
Code:
So you would start your servers like:
start-tc-server.sh -f tc-config.xml
and your clients like:
TC_CONFIG=tc-config.xml
Where tc-config.xml is the location of your tc-config.xml files.
Having all clients and servers load files from the filesystem can can lead to the files being out of sync from one another, especially if they are on different physical systems, so....
b) For production, load the tc-config file from the local filesystem *for the TC Server* only. It will automatically export the file at an http address, which can then be used by the L1 clients to get a copy. So the L1 clients (your jvms) should be configured to get their config from a server.
Code:
In this case, you still start your server the same way,
start-tc-server.sh -f tc-config.xml
But you point the clients to the server thusly:
TC_CONFIG=serverhost-a:9520,serverhost-b:9520
Where the serverhost-a is your primary server, and serverhost-b is your secondary server.
|
|
|
07/03/2008 08:09:19
|
rehsiftt
journeyman
Joined: 06/26/2008 06:42:32
Messages: 13
Offline
|
Perfect! That clears up alot. Thanks again for the great support.
|
|
|
07/03/2008 08:18:40
|
rehsiftt
journeyman
Joined: 06/26/2008 06:42:32
Messages: 13
Offline
|
One last question about tc-config
I am trying to edit my custom config but I am stuck on this one error.
*******************************************************************************
You have not specified a name for your L2, and there are 2 L2s defined in the configuration file. You must indicate which L2 this is.
*******************************************************************************
for reference this is what I have for my current tc-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<tc:tc-config xmlns:tc="http://www.terracotta.org/config"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.terracotta.org/schema/terracotta-4.xsd">
<servers>
<server host="192.168.1.241" name="server1">
<data>/root/terracotta/demo-server/server1-data</data>
<logs>/root/terracotta/demo-server/server1-logs</logs>
<l2-group-port>9530</l2-group-port>
<dso>
<persistence>
<mode>permanent-store</mode>
</persistence>
</dso>
<!--<update-check>
<enabled>true</enabled>
</update-check>-->
</server>
<server host="192.168.1.254" name="server2">
<data>/root/terracotta/demo-server/server2-data</data>
<logs>/root/terracotta/demo-server/server2-logs</logs>
<l2-group-port>9530</l2-group-port>
<dso>
<persistence>
<mode>permanent-store</mode>
</persistence>
</dso>
<!--<update-check>
<enabled>true</enabled>
</update-check>-->
</server>
<ha>
<mode>networked-active-passive</mode>
<networked-active-passive>
<election-time>5</election-time>
</networked-active-passive>
</ha>
</servers>
</tc:tc-config>
BTW, forgive me for using 2.5.4 release - I am trying to get this cluster running for a Smartfox Flash app so by request of the Smartfox team we are behind a version.
|
|
|
07/03/2008 09:08:42
|
tgautier
seraphim
Joined: 06/05/2006 12:19:26
Messages: 1781
Offline
|
You mean when starting your L2? I thought it told you what parameter it needs -
In any case start your server with the -n <server-name> parameter.
|
|
|
07/03/2008 09:24:39
|
rehsiftt
journeyman
Joined: 06/26/2008 06:42:32
Messages: 13
Offline
|
Thanks -n name worked great
|
|
|
07/18/2008 16:41:03
|
ilevy
consul
Joined: 04/16/2008 10:26:42
Messages: 357
Offline
|
There's now a document that covers the where and how of using configuration files with tc:
http://www.terracotta.org/confluence/display/docdraft/About+Terracotta+Configuration
|
|
|
|