use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class ZkIntegrationTestBase method beforeSuite.
@BeforeSuite
public void beforeSuite() throws Exception {
// TODO: use logging.properties file to config java.util.logging.Logger levels
java.util.logging.Logger topJavaLogger = java.util.logging.Logger.getLogger("");
topJavaLogger.setLevel(Level.WARNING);
// Due to ZOOKEEPER-2693 fix, we need to specify whitelist for execute zk commends
System.setProperty("zookeeper.4lw.commands.whitelist", "*");
_zkServer = TestHelper.startZkServer(ZK_ADDR);
AssertJUnit.assertTrue(_zkServer != null);
ZKClientPool.reset();
_gZkClient = new ZkClient(ZK_ADDR);
_gZkClient.setZkSerializer(new ZNRecordSerializer());
_gSetupTool = new ClusterSetup(_gZkClient);
_baseAccessor = new ZkBaseDataAccessor<>(_gZkClient);
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestNonOfflineInitState method setupCluster.
private static void setupCluster(String clusterName, String ZkAddr, int startPort, String participantNamePrefix, String resourceNamePrefix, int resourceNb, int partitionNb, int nodesNb, int replica, String stateModelDef, boolean doRebalance) throws Exception {
if (_gZkClient.exists("/" + clusterName)) {
LOG.warn("Cluster already exists:" + clusterName + ". Deleting it");
_gZkClient.deleteRecursively("/" + clusterName);
}
ClusterSetup setupTool = new ClusterSetup(ZkAddr);
setupTool.addCluster(clusterName, true);
setupTool.addStateModelDef(clusterName, "Bootstrap", TestHelper.generateStateModelDefForBootstrap());
for (int i = 0; i < nodesNb; i++) {
int port = startPort + i;
setupTool.addInstanceToCluster(clusterName, participantNamePrefix + "_" + port);
}
for (int i = 0; i < resourceNb; i++) {
String dbName = resourceNamePrefix + i;
setupTool.addResourceToCluster(clusterName, dbName, partitionNb, stateModelDef);
if (doRebalance) {
setupTool.rebalanceStorageCluster(clusterName, dbName, replica);
}
}
}
use of org.apache.helix.tools.ClusterSetup in project helix by apache.
the class TestJobTimeoutTaskNotStarted method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_numDbs = 1;
_numNodes = 1;
_numParitions = 50;
_numReplicas = 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();
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);
clusterConfig.setMaxConcurrentTaskPerInstance(_numParitions);
_configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
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 TestRebalanceRunningTask method beforeClass.
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
_numNodes = 2;
_numParitions = 2;
// only Master, no Slave
_numReplicas = 1;
_numDbs = 1;
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
_setupTool.addCluster(CLUSTER_NAME, true);
setupParticipants();
setupDBs();
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 TestStateTransitionTimeout method beforeClass.
@Override
@BeforeClass
public void beforeClass() throws Exception {
System.out.println("START " + CLASS_NAME + " at " + new Date(System.currentTimeMillis()));
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursively(namespace);
}
_setupTool = new ClusterSetup(ZK_ADDR);
// setup storage cluster
_setupTool.addCluster(CLUSTER_NAME, true);
_setupTool.addResourceToCluster(CLUSTER_NAME, TEST_DB, _PARTITIONS, STATE_MODEL);
for (int i = 0; i < NODE_NR; i++) {
String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
}
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, TEST_DB, 3);
// Set the timeout values
IdealState idealState = _setupTool.getClusterManagementTool().getResourceIdealState(CLUSTER_NAME, TEST_DB);
String stateTransition = "SLAVE" + "-" + "MASTER" + "_" + Message.Attributes.TIMEOUT;
idealState.getRecord().setSimpleField(stateTransition, "300");
String command = "-zkSvr " + ZK_ADDR + " -addResourceProperty " + CLUSTER_NAME + " " + TEST_DB + " " + stateTransition + " 200";
ClusterSetup.processCommandLineArgs(command.split(" "));
}
Aggregations