1. Introduction
The terracotta server provides a distributed data platform for terracotta products. The terracotta server cluster is known as the Terracotta Server array (TSA). The Terracotta server array can range from a single server to a basic dual-server concatenation for high availability (HA), to a multi-server array that provides configurable scale, high performance, and deep failover coverage.
The main features of the terracotta server include:
- Distributed Memory Data management: Manage more 10-100x data in memory than data grids
- Uncomplicated scalability: Simple configuration and deployment options to scale to meet growing demand and drive capacity planning
- High availability: Immediate failover of uptime and services
- Configurable health monitoring: Terracotta Health Checker monitors client and server health
- Persistent state: Automatically permanently stores all current shared memory data and enables rapid recovery after a server restart
- Node Auto-Reconnect: Temporarily disconnected server instances and clients rejoin the cluster without operator intervention
Server directory Description
Server
└─bin-executable files, such as files that start the server Start-tc-server
└─conf--Configuration file
└─lib
└─plugins
2. Configuration files
The terracotta configuration file is an XML-formatted file named Tc-config.
This file is used to configure all members of a single terracotta server array (TSA) stripe.
You can use the sample configuration file provided in the toolkit as the basis for the terracotta configuration. Some examples include inline annotations that describe configuration elements.
2.1 Explanation of the configuration section
Element name |
Describe |
Servers |
The Servers section defines all the servers that make up the cluster. High availability can be achieved by configuring and running a minimum of 2 servers. Note that if you do not explicitly configure which server to act as an active or passive role, this may change in the life cycle of the cluster. Each server element in the server section is identified by the name specified by the Name property:<server name= "ServerName" > |
Plugins |
The Plugins section provides additional services that can be provided to these servers by registering and configuring them, as well as providing common configuration information available to all services. expanded the functionality of the listed servers. Using an extension point is a requirement for the server to use your application endpoint (service). |
Properties |
The Tc-properties section exposes a list of key-value pairs to further customize the behavior of the cluster. Note that this section is usually empty. |
2.2 Simple Configuration examples
This is an example of a very simple server configuration file.
<Tc-configxmlns= "Http://www.terracotta.org/config"><Servers><ServerHost= "localhost"name= "TestServer0"><logs>Terracotta-kit-test/testserver0/logs</logs><Tsa-port>26270</Tsa-port><Tsa-group-port>26271</Tsa-group-port></Server></Servers></Tc-config>
This shows the key components of the standard configuration, but only one server that does not use an extension point.
Key points:
- Configure the namespace Http://www.terracotta.org/config.
- There is only one server named TestServer0. (The server name is important because it is used when the server is started, and in the actual deployment, localhost should be replaced with the full hostname or IP address of the server.) )
- A relative path to the log directory is given. (In the actual deployment, localhost should be replaced with the full hostname or IP address of the server.) )
- Tsa-port is the port that the client uses when connecting to the server (default is 9410).
- Although there are no other servers in this case (the default is 9530), the Tsa-group port is used for cross-server communication.
- In the example configuration above, it is not possible to restart or fail over because the restart support requires an extension point that provides this capability, and the failover requires at least two servers in the cluster.
2.3 Parameter substitution
Parameter substitution provides a way to replace a variable with a predefined system attribute in the Terracotta server configuration file. Therefore, you can intelligently populate a large number of fields based on machine-specific properties. Parameter substitution is typically used for host name, IP address, and directory path substitution.
The parameters you can use are replaced by the following:
Parameter name |
Describe |
%h |
The full host name |
%i |
IP Address |
%H |
User home Directory |
%n |
User name |
%o |
Operating system name |
%a |
Processor architecture |
%v |
Operating system version |
%t |
Temp directory (on Linux or Solaris, for example,/tmp) |
% (property) |
Java System Properties of the JVM (for example,% (java.home),% (Logs.path)) |
%d |
Timestamp (YYYYMMDDHHMMSSSSS) |
These parameters can be used where appropriate, including elements or attributes that expect a string or value path.
3. Start the server
Startup script Parameters:
- [-f/path/to/tc-config.xml]-Specify the profile path
- [-N server_name]-Specifies the startup server name when multiple servers are configured
On Windows:
CD <path/to/terracotta/kit>/server/binstart-tc-server.bat-f <path/to/server/config>/ Tc-config.xml
On Unix/mac:
CD <path/to/terracotta/kit>/server/bin. /start-tc-server. sh -F <path/to/server/config>/tc-config.xml
Note: Before you start the Terracotta server, check the required Java version. terracotta5.x requires support for Java 8.
Check the following information log to confirm that the server started successfully.Terracotta Server instance has started up as ACTIVE node on 0:0:0:0:0:0:0:0:9410 successfully, and is now ready for work.
Example of successful startup under Windows:
Terracotta Server: http://www.terracotta.org/open-source/
Ehcache of distributed cache and Terracotta-terracotta Server concept Chapter