Server 4

Sophora Server modes and connected Servers

Discover the different modes in which a Sophora Server can run. You can also learn more about Sophora Replica Servers and Delivery.

The property sophora.replication.mode in the sophora.properties file selects the mode in which the server is started. There are four different modes: none, master (Sophora Primary Server), slave (Sophora Replica Server) and stagingslave (Sophora Delivery Server). You also have the option to select cluster as the replication mode and specify the server mode with the additional property clusterMode. Valid cluster modes are master (Sophora Primary Server), slave (Sophora Replica Server) and open (the server starting first becomes Sophora Primary Server).

Server Modes

The property sophora.replication.mode in the sophora.properties file selects the mode in which the server is started. There are the four different modes none, master (Sophora Primary Server), slave (Sophora Replica Server) and stagingslave (Sophora Delivery Server), and a fifth option of choosing the replication mode cluster.

None

The Sophora Server starts in a stand alone mode. No JMS broker is launched and no JMS connection to a broker is established. This mode is useful for test systems without any Sophora Replica Servers.

Another use case is to temporarily disconnect a Delivery Server from its Sophora Primary Server. Normal Sophora Delivery Servers do not start without a connection to its Sophora Primary Server. To start the Sophora Server on the Delivery Server anyway, the Server can be started in mode none.

Sophora Primary Server

This is the normal mode for the main Sophora Server. In this mode, a JMS broker is launched within the server process. With the help of this JMS broker, Sophora Replica Servers can connect to the Sophora Primary Server and receive documents etc.

Sophora Replica Server

This mode is also called Replication Server or Backup Server. In this mode, the Sophora Replica Server receives all data from the Sophora Primary Server. Thus, it is a complete copy of the Sophora Primary Server and can be used in cases where the Sophora Primary Server is not available. Only administrators (Sophora users with a role possessing the system permission ADMIN) can log on to the server.

Sophora Replica Servers are connected to a persistent JMS queue in the Sophora Primary Server. Thus, no special synchronization is needed if the Sophora Replica Server is temporarily disconnected from the Sophora Primary Server.

Staging Server

The mode stagingslave is used for the Sophora Servers in the delivery. In this mode, the Sophora Replica Servers receive only published data from the Sophora Primary Server. When documents are put offline in the Sophora Primary Server, the corresponding documents on the Staging Server are marked as deleted. The version history of documents is not maintained on Delivery Servers. Documents are only available in their last published Version.

When started, the Delivery Servers always send a Sync-Request to the Sophora Primary Server. Based on the last modification date of a document on the Sophora Replica Server, the Sophora Primary Server sends all new documents (and other data) to the Sophora Replica Server.

Cluster

If you choose the replication mode cluster, you also have to set the additional property clusterMode. Possible values are master (Sophora Primary Server), slave (Sophora Replica Server) and open. Choosing the cluster modes master or slave will basically have the same effect as choosing master or slave as the replication mode. If you set the cluster mode to open, the first server from the cluster that is started becomes the Sophora Primary Server. All other cluster servers will serve as fallback Sophora Replica Servers.

Getting the Server Mode

You can 'ask' any Sophora server for its server mode. Calling the URL pattern http://<Hostname of the master>:<HTTP port>/serverMode will return a JSON snippet containing the server mode, for example:

{"serverMode":"MASTER"}

Possible values are: "STAGING_SLAVE", "REPLICATION_SLAVE", "MASTER" and "NONE".

Getting all connected Sophora Delivery Servers

You can 'ask' the Sophora Server for its connected Delivery Servers. This function is only available, if the Server has been started with the property

sophora.replication.mode=master

Calling the URL pattern http://<Hostname of the master>:<HTTP port of the master>/replicationSlaves/ will return a comma separated list of all currently connected Sophora Replica Servers, for example:

MASTER:serverM
REPLICATION_SLAVE:
STAGING_SLAVE:staging1,staging2

In this example, the Sophora Primary Server has two connected Delivery ("Staging") Servers (staging1 and staging2), but no Replica Server.

The returned list of Delivery Servers contains the names of those servers which are connected to the Sophora Primary Server at that moment. The returned list of Replica Servers contains all Replica Servers which are currently or have been connected at some time. This means that Replica Servers in the returned list are not necessarily connected to the master right now.

To configure the name of a replication or Delivery Server, you have to edit the following property in the sophora.properties file:

sophora.replication.slaveHostname=staging1

If this property is empty, the hostname is determined automatically. However, the property has to be present.

Shell Script to Determine the Sophora Replica Servers

The following shell script provides the function get_slaves which you can pass an URL and the desired type of Sophora Replica Server. The function returns a list of Sophora Replica Server names which you might want to iterate through. A corresponding example is given below.

#!/bin/bash
 
# get_slaves URL TYPE
function get_slaves() {
 wget -q -O - "${1}" |perl -ne "if (/^${2}:.+/) { s/^${2}://; print join(\"\\n\", split /,/); }"
}
 
get_slaves "http://master.subshell.com:1196/replicationSlaves" "STAGING_SLAVE" |while read slave ; do
 echo "slave: ${slave}"
done

Managing a JMS Connection Between Sophora Primary Server and Staging Server

It is possible to disconnect an active Delivery Server from the Sophora Primary Server. Thus, the Delivery Server will no longer receive JMS messages, and changes in the content are not recognized by the delivery.

This behaviour might be desired if there is maintenance to do at the Sophora Primary Server while the deliveries should continue their work. Therefore, it is also possible to reconnect the master and its Sophora Replica Server. The first thing taking place afterwards is a synchronization.

Starting/Stopping the Staging via HTTP

Calling the URL pattern http://<Hostname of the Sophora Replica Server>:<HTTP port of the Sophora Replica Server>/stagingSlaveAdmin/<Operation> enables you to execute the subsequent operations remotely:

  • /stop – Stops the JMS connection to the master.
  • /start – Establishes a JMS connection and synchronizes the Sophora Replica Servers.

Starting/Stopping the Delivery Server via JMX

The start and stop operations may also be executed via the JMX interface by using the start/stop operations on the com.subshell.sophora/StagingSlaveAdmin MBean. The bean also provides the information whether staging is currently enabled or not.

Starting/Stopping the Delivery Server via Shell Script

Starting the Delivery ("Staging")

> cd cms-directory/sophora 
> ./sophora.sh startStaging

Stopping the Delivery ("Staging")

> cd cms-directory/sophora 
> ./sophora.sh stopStaging

Last modified on 10/16/20

The content of this page is licensed under the CC BY 4.0 License. Code samples are licensed under the MIT License.

Icon