S4 provides a set of tools to:
s4 newCluster
s4 node
s4 s4r
s4 deploy
s4 zkServer
s4 zkServer -t
will start a Zookeeper server and automatically configure 2 clusterss4 status
./s4 |
will give you a list of available commands.
./s4 <command> -help |
will provide detailed documentation for each of these commands.
Before starting S4 nodes, you must define a logical cluster by specifying:
The cluster configuration is maintained in Zookeeper, and can be set using S4 tools:
./s4 newCluster -c=cluster1 -nbTasks=2 -flp=12000 |
See tool documentation by typing:
./s4 newCluster -help |
When starting an S4 node on a given host, you need to specify:
Example:
./s4 node -c=cluster1 -zk=host.domain.com |
S4 follows a modular design and uses Guice for defining modules and injecting dependencies.
An S4 node is composed of:
We provide default modules, but you may directly specify others through the command line, and it is also possible to override them with new modules and even specify new ones (custom modules classes must provide an empty no-args constructor). For instance, if you want to enable checkpointing, you should pass a checkpointing module (emc stands for extra modules classes):
./s4 node -c=cluster1 -emc=org.apache.s4.core.ft.FileSystemBackendCheckpointingModule |
You will probably need to tweak default parameters of the communication layer.
You may use inline parameters:
./s4 node -c=cluster1 -p=param1=value1,param2=value2 |
Instead of specifying node parameters inline, you may refer to a file with the '@' notation:
./s4 node @/path/to/config/file |
With contents of the referenced file like:
-c=cluster1 -zk=host.domain.com:42000 -p=param1=value1,param2=value2 |
S4 uses logback, and here is the default configuration file. You may tweak this configuration by adding your own logback.xml file in the lib/
directory (for a binary release) or in the subprojects/s4-tools/build/install/s4-tools/lib/
directory (for a source release or checkout from git).
A simple way to pass parameters to your application is by:
@Inject @Named('myParam') param |
This uses an internal Guice module that automatically injects your application parameters to matching @Named
parameters.