[Download] | [Documentation Home] | [Release Note]
Several Carbon servers such as DSS, BAM, GREG, BPS etc.. utilizes the Carbon scheduled tasks functionality in carrying out jobs that needs to be run periodically, and the task scheduling component fully support clustered, load-balanced, fail-over scenarios. Task scheduling in Carbon works in several modes, which are the following:
The standalone mode is used when a Carbon server is used in the standalone single server mode, and the tasks will run only in that local server. This is the mode that is set by default in any Carbon server that uses scheduled tasks.
In the clustered mode, a cluster of Carbon servers are put together, and the tasks are scheduled between them. So a single instance of a task is only run once at a time in the cluster in a specific node. Also, if a node fails for some reason, this will be detected by the rest of the nodes, and it will be suitably re-scheduled in one of the remaining servers. In the clustered mode, an external coordination server has to interfaced with the server, where we currently use Apache ZooKeeper for this functionality. This coordination functionality is by default disabled, and must be enabled using the configuration file at $SERVER_ROOT/repository/conf/etc/coordination-client-config.xml. For more information on configuring the coordination server, refer to http://docs.wso2.org/wiki/display/DSS300/Scheduled+Tasks.
The remote task provider mode is used specially in a large cloud deployment, where the task execution needs to be managed with more control, such as taking into the tenant partitioning etc.. which can be handled centrally using the WSO2 LB. Basically with this approach, the task trigger messages will originate from the task server, and will be sent to the target Carbon servers to execute the tasks. So here, all the other Carbon servers such as BAM, DSS etc.. will be running the servers in "REMOTE" task mode, and the Task Server itself have to be run in either "STANDALONE" or "CLUSTERED" mode. Here, the Task Server itself uses the same Carbon task component, so it also has to be configured with a proper task provider.
The task provider configuration is given in $SERVER_ROOT/repository/etc/tasks-config.xml. Here, specific settings for a task provider is given. A typical tasks-config.xml content is shown below:
<tasks-configuration xmlns:svns="http://org.wso2.securevault/configuration"> <!-- The currently running server mode; possible values are:- STANDALONE, CLUSTERED, REMOTE. NOTE: in CLUSTERED mode, the coordination service must be enabled at /repository/conf/etc/coordination-client-config.xml. --> <taskServerMode>STANDALONE</taskServerMode> <!-- To be used in CLUSTERED mode to notify how many servers are there in the task server cluster, the servers wait till this amount of servers are activated before the tasks are scheduled --> <taskServerCount>3</taskServerCount> <!-- The address to which the remote task server should dispatch the trigger messages to, usually this would be an endpoint to a load balancer --> <taskClientDispatchAddress>https://localhost:9448</taskClientDispatchAddress> <!-- The address of the remote task server --> <remoteServerAddress>https://localhost:9443</remoteServerAddress> <!-- The username to authenticate to the remote task server --> <remoteServerUsername>admin</remoteServerUsername> <!-- The password to authenticate to the remote task server --> <remoteServerPassword>admin</remoteServerPassword> <!-- Below contain a sample to be used when using with secure vault --> <!--remoteServerPassword svns:secretAlias="remote.task.server.password"></remoteServerPassword--> </tasks-configuration>
The configuration elements are explained in the XML comments. In the CLUSTERED mode, the "coordination-client-config.xml" should be edited to enable the coordination service.
In a Task Server involved setup, the other participating Carbon servers will be in the REMOTE mode, and the "remoteServerAddress" will be the URL to the Task Server. The "taskClientDispatchAddress" will be the address to its own server, where this would most probably will be the load balancer URL represending the current server type. In the Task Server itself, the configuration can be either STANDALONE or CLUSTERED.
The password fields in the configuration can be secured using the Carbon secure vault functionalities.
Below contains sample tasks-config.xml to be used for a DSS instance, which is interfaced with WSO2 TS.
<tasks-configuration xmlns:svns="http://org.wso2.securevault/configuration"> <taskServerMode>REMOTE</taskServerMode> <taskServerCount>0</taskServerCount> <taskClientDispatchAddress>https://data.stratos.acme.com</taskClientDispatchAddress> <remoteServerAddress>https://task.stratos.acme.com</remoteServerAddress> <remoteServerUsername>admin</remoteServerUsername> <remoteServerPassword>admin</remoteServerPassword> </tasks-configuration>
The following contains a samples of tasks-config.xml that can be used for WSO2 TS:
<tasks-configuration xmlns:svns="http://org.wso2.securevault/configuration"> <taskServerMode>STANDALONE</taskServerMode> <taskServerCount>0</taskServerCount> <taskClientDispatchAddress></taskClientDispatchAddress> <remoteServerAddress></remoteServerAddress> <remoteServerUsername></remoteServerUsername> <remoteServerPassword></remoteServerPassword> </tasks-configuration>
<tasks-configuration xmlns:svns="http://org.wso2.securevault/configuration"> <taskServerMode>CLUSTERED</taskServerMode> <taskServerCount>3</taskServerCount> <taskClientDispatchAddress></taskClientDispatchAddress> <remoteServerAddress></remoteServerAddress> <remoteServerUsername></remoteServerUsername> <remoteServerPassword></remoteServerPassword> </tasks-configuration>
In the clustered mode, the "coordination-client-config" should be edited to enable it and configure the coordination server(s).