tree: bbdd8ddaddfad05e8f75fbeec2de3b4cda905b56 [path history] [tgz]
  1. src/
  2. .gitignore
  3. pom.xml
  4. README.md
helix-archetype/README.md

helix-archetype

A maven archetype that sets up a sample Apache Helix project.

Generate

Then generate your application, substituting project.version as appropriate.

mvn archetype:generate \
  -DarchetypeGroupId=org.apache.helix \
  -DarchetypeArtifactId=helix-archetype \
  -DarchetypeVersion=${project.version} \
  -DgroupId=com.example \
  -DartifactId=my-app \
  -Dname=MyApp \
  -DinteractiveMode=false

This creates a simple OnlineOffline application, though it should be straightforward to change the state model by referencing the Helix documentation.

The pom.xml creates a single versioned artifact, which can run all of your cluster's roles via the ${name}Main entry point.

This makes it a little nicer to manage multiple different cluster roles: just build this artifact, and deploy it everywhere with different CLI args.

Example

To get started, build the artifact after generating your application:

cd my-app
mvn install

Run a ZooKeeper

java -jar target/my-app-1.0-SNAPSHOT.jar zookeeper 2191 /tmp/zk

Set up a cluster, then add a node and a resource with 4 partitions

java -jar target/my-app-1.0-SNAPSHOT.jar setup --zkSvr localhost:2191 --addCluster TEST_CLUSTER
java -jar target/my-app-1.0-SNAPSHOT.jar setup --zkSvr localhost:2191 --addNode TEST_CLUSTER node0
java -jar target/my-app-1.0-SNAPSHOT.jar setup --zkSvr localhost:2191 --addResource TEST_CLUSTER test 4 OnlineOffline

Run a controller

java -jar target/my-app-1.0-SNAPSHOT.jar controller --zkSvr localhost:2191 --cluster TEST_CLUSTER

Run a participant (note: does nothing)

java -jar target/my-app-1.0-SNAPSHOT.jar participant localhost:2181 TEST_CLUSTER node0

Rebalance the resource (should work...)

java -jar target/my-app-1.0-SNAPSHOT.jar setup  --zkSvr localhost:2191 --rebalance TEST_CLUSTER test 1

Clean up temporary ZooKeeper files, after finished

rm -rf /tmp/zk