use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestJobFailureHighThreshold method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
_numDbs = 1;
_numNodes = 1;
_numParitions = 5;
_numReplicas = 1;
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
setupParticipants();
setupDBs();
startParticipants();
createManagers();
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, CONTROLLER_PREFIX);
_controller.syncStart();
HelixClusterVerifier clusterVerifier = new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkClient(_gZkClient).build();
Assert.assertTrue(clusterVerifier.verify(10000));
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestJobFailureTaskNotStarted method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
_numDbs = 1;
_numNodes = 2;
_numParitions = 2;
_numReplicas = 1;
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
setupParticipants();
setupDBs();
startParticipantsWithStuckTaskStateModelFactory();
createManagers();
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, CONTROLLER_PREFIX);
_controller.syncStart();
// Enable cancellation
ConfigAccessor _configAccessor = new ConfigAccessor(_gZkClient);
ClusterConfig clusterConfig = _configAccessor.getClusterConfig(CLUSTER_NAME);
clusterConfig.stateTransitionCancelEnabled(true);
_configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestJobTimeout method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_numNodes = 2;
_numParitions = 2;
// only Master, no Slave
_numReplicas = 1;
_numDbs = 1;
_participants = new MockParticipantManager[_numNodes];
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
setupParticipants();
setupDBs();
startParticipants();
createManagers();
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, CONTROLLER_PREFIX);
_controller.syncStart();
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestUserContentStore method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
// Setup cluster and instances
ClusterSetup setupTool = new ClusterSetup(ZK_ADDR);
setupTool.addCluster(CLUSTER_NAME, true);
for (int i = 0; i < _numNodes; i++) {
String storageNodeName = PARTICIPANT_PREFIX + "_" + (_startPort + i);
setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
// start dummy participants
for (int i = 0; i < _numNodes; i++) {
final String instanceName = PARTICIPANT_PREFIX + "_" + (_startPort + i);
// Set task callbacks
Map<String, TaskFactory> taskFactoryReg = new HashMap<String, TaskFactory>();
taskFactoryReg.put("ContentStoreTask", new TaskFactory() {
@Override
public Task createNewTask(TaskCallbackContext context) {
return new ContentStoreTask();
}
});
taskFactoryReg.put("TaskOne", new TaskFactory() {
@Override
public Task createNewTask(TaskCallbackContext context) {
return new TaskOne();
}
});
taskFactoryReg.put("TaskTwo", new TaskFactory() {
@Override
public Task createNewTask(TaskCallbackContext context) {
return new TaskTwo();
}
});
_participants[i] = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, instanceName);
// Register a Task state model factory.
StateMachineEngine stateMachine = _participants[i].getStateMachineEngine();
stateMachine.registerStateModelFactory("Task", new TaskStateModelFactory(_participants[i], taskFactoryReg));
_participants[i].syncStart();
}
// Start controller
String controllerName = CONTROLLER_PREFIX + "_0";
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, controllerName);
_controller.syncStart();
// Start an admin connection
_manager = HelixManagerFactory.getZKHelixManager(CLUSTER_NAME, "Admin", InstanceType.ADMINISTRATOR, ZK_ADDR);
_manager.connect();
_driver = new TaskDriver(_manager);
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestAddClusterV2 method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis()));
String namespace = "/" + CONTROLLER_CLUSTER;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
for (int i = 0; i < CLUSTER_NR; i++) {
namespace = "/" + CLUSTER_PREFIX + "_" + CLASS_NAME + "_" + i;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
}
_setupTool = new ClusterSetup(ZK_ADDR);
// setup CONTROLLER_CLUSTER
_setupTool.addCluster(CONTROLLER_CLUSTER, true);
for (int i = 0; i < NODE_NR; i++) {
String controllerName = CONTROLLER_PREFIX + "_" + i;
_setupTool.addInstanceToCluster(CONTROLLER_CLUSTER, controllerName);
}
// setup cluster of clusters
for (int i = 0; i < CLUSTER_NR; i++) {
String clusterName = CLUSTER_PREFIX + "_" + CLASS_NAME + "_" + i;
_setupTool.addCluster(clusterName, true);
_setupTool.activateCluster(clusterName, CONTROLLER_CLUSTER, true);
}
final String firstCluster = CLUSTER_PREFIX + "_" + CLASS_NAME + "_0";
setupStorageCluster(_setupTool, firstCluster, TEST_DB, 20, PARTICIPANT_PREFIX, START_PORT, "MasterSlave", 3, true);
// start dummy participants for the first cluster
for (int i = 0; i < NODE_NR; i++) {
String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_participants[i] = new MockParticipantManager(ZK_ADDR, firstCluster, instanceName);
_participants[i].syncStart();
}
// start distributed cluster controllers
for (int i = 0; i < NODE_NR; i++) {
String controllerName = CONTROLLER_PREFIX + "_" + i;
_distControllers[i] = new ClusterDistributedController(ZK_ADDR, CONTROLLER_CLUSTER, controllerName);
_distControllers[i].syncStart();
}
verifyClusters();
}
Aggregations