本文整理汇总了Java中org.apache.helix.ConfigAccessor.getClusterConfig方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigAccessor.getClusterConfig方法的具体用法?Java ConfigAccessor.getClusterConfig怎么用?Java ConfigAccessor.getClusterConfig使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.helix.ConfigAccessor
的用法示例。
在下文中一共展示了ConfigAccessor.getClusterConfig方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableBatchMessageMode
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@Override
public void enableBatchMessageMode(String clusterName, boolean enabled) {
if (!ZKUtil.isClusterSetup(clusterName, _zkClient)) {
throw new HelixException("cluster " + clusterName + " is not setup yet");
}
ConfigAccessor accessor = new ConfigAccessor(_zkClient);
ClusterConfig clusterConfig = accessor.getClusterConfig(clusterName);
clusterConfig.setBatchMessageMode(enabled);
accessor.setClusterConfig(clusterName, clusterConfig);
}
示例2: enablePersistBestPossibleAssignment
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
protected void enablePersistBestPossibleAssignment(ZkClient zkClient, String clusterName,
Boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setPersistBestPossibleAssignment(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
示例3: enablePersistIntermediateAssignment
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
protected void enablePersistIntermediateAssignment(ZkClient zkClient, String clusterName,
Boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setPersistIntermediateAssignment(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
示例4: enableTopologyAwareRebalance
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
protected void enableTopologyAwareRebalance(ZkClient zkClient, String clusterName,
Boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setTopologyAwareEnabled(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
示例5: enableDelayRebalanceInCluster
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
protected void enableDelayRebalanceInCluster(ZkClient zkClient, String clusterName,
boolean enabled) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setDelayRebalaceEnabled(enabled);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
示例6: beforeClass
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@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.deleteRecursive(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);
}
示例7: beforeClass
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@BeforeClass
public void beforeClass() throws Exception {
_participants = new MockParticipantManager[_numNodes];
_numDbs = 1;
_numNodes = 1;
_numParitions = 50;
_numReplicas = 1;
String namespace = "/" + CLUSTER_NAME;
if (_gZkClient.exists(namespace)) {
_gZkClient.deleteRecursive(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));
}
示例8: testDisableCluster
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@Test
public void testDisableCluster() throws Exception {
ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME);
clusterConfig.setMaxPartitionsPerInstance(10);
configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
int i = 0;
for (String stateModel : TestStateModels) {
String db = "Test-DB-" + i++;
createResourceWithDelayedRebalance(CLUSTER_NAME, db, stateModel, _PARTITIONS, _replica,
_replica, -1);
_testDBs.add(db);
}
Thread.sleep(100);
Assert.assertTrue(_clusterVerifier.verify());
MaintenanceSignal maintenanceSignal = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance());
Assert.assertNull(maintenanceSignal);
for (i = 2; i < NUM_NODE; i++) {
_participants.get(i).syncStop();
}
Thread.sleep(500);
maintenanceSignal = _dataAccessor.getProperty(_dataAccessor.keyBuilder().maintenance());
Assert.assertNotNull(maintenanceSignal);
Assert.assertNotNull(maintenanceSignal.getReason());
}
示例9: setDelayTimeInCluster
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
protected void setDelayTimeInCluster(ZkClient zkClient, String clusterName, long delay) {
ConfigAccessor configAccessor = new ConfigAccessor(zkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(clusterName);
clusterConfig.setRebalanceDelayTime(delay);
configAccessor.setClusterConfig(clusterName, clusterConfig);
}
示例10: testWithDomainId
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@Test (enabled = false)
public void testWithDomainId() throws InterruptedException {
int replicas = 2;
ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
// 1. disable all participants except one node, then set domain Id
for (int i = NODE_NR - 1; i >= 0; i--) {
if (i < replicas) {
setDomainId(_participants[i].getInstanceName(), configAccessor);
} else {
setInstanceEnable(_participants[i].getInstanceName(), false, configAccessor);
}
}
// enable topology aware
ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME);
clusterConfig.setTopologyAwareEnabled(true);
clusterConfig.setTopology("/Rack/Instance");
clusterConfig.setFaultZoneType("Rack");
configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
// Ensure error caused by node config changes has been removed.
// Error may be recorded unexpectedly when a resource from other tests is not cleaned up.
accessor.removeProperty(errorNodeKey);
_setupTool.addResourceToCluster(CLUSTER_NAME, testDb, 5,
BuiltInStateModelDefinitions.MasterSlave.name(), RebalanceMode.FULL_AUTO.name(),
CrushRebalanceStrategy.class.getName());
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, replicas);
HelixClusterVerifier verifier =
new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR)
.setResources(new HashSet<>(Collections.singleton(testDb))).build();
Assert.assertTrue(verifier.verify());
// Verify there is no rebalance error logged
Assert.assertNull(accessor.getProperty(errorNodeKey));
checkRebalanceFailureGauge(false);
// 2. enable the rest nodes with no domain Id
for (int i = replicas; i < NODE_NR; i++) {
setInstanceEnable(_participants[i].getInstanceName(), true, configAccessor);
}
// Verify there is rebalance error logged
Assert.assertNotNull(pollForError(accessor, errorNodeKey));
checkRebalanceFailureGauge(true);
// 3. reset all nodes domain Id to be correct setting
for (int i = replicas; i < NODE_NR; i++) {
setDomainId(_participants[i].getInstanceName(), configAccessor);
}
_setupTool.rebalanceStorageCluster(CLUSTER_NAME, testDb, replicas);
Thread.sleep(1000);
// Verify that rebalance error state is removed
checkRebalanceFailureGauge(false);
// clean up
_setupTool.getClusterManagementTool().dropResource(CLUSTER_NAME, testDb);
clusterConfig.setTopologyAwareEnabled(false);
}
示例11: beforeClass
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@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.deleteRecursive(namespace);
}
_gSetupTool.addCluster(CLUSTER_NAME, true);
for (int i = 0; i < NUM_NODE; i++) {
String instanceName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_gSetupTool.addInstanceToCluster(CLUSTER_NAME, instanceName);
// start dummy participants
MockParticipantManager participant =
new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, instanceName);
participant.syncStart();
_participants.add(participant);
}
// start controller
String controllerName = CONTROLLER_PREFIX + "_0";
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, controllerName);
_controller.syncStart();
_clusterVerifier =
new BestPossibleExternalViewVerifier.Builder(CLUSTER_NAME).setZkAddr(ZK_ADDR).build();
enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true);
_dataAccessor = new ZKHelixDataAccessor(CLUSTER_NAME, _baseAccessor);
ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME);
clusterConfig.setMaxOfflineInstancesAllowed(_maxOfflineInstancesAllowed);
configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
for (int i = 0; i < 3; i++) {
String db = "Test-DB-" + i++;
createResourceWithDelayedRebalance(CLUSTER_NAME, db,
BuiltInStateModelDefinitions.MasterSlave.name(), _PARTITIONS, 3, 3, -1);
}
Thread.sleep(100);
Assert.assertTrue(_clusterVerifier.verify());
}
开发者ID:apache,项目名称:helix,代码行数:46,代码来源:TestClusterInMaintenanceModeWhenReachingOfflineInstancesLimit.java
示例12: beforeClass
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@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.deleteRecursive(namespace);
}
_setupTool = new ClusterSetup(_gZkClient);
_setupTool.addCluster(CLUSTER_NAME, true);
ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(CLUSTER_NAME);
clusterConfig.setTopology("/instance");
clusterConfig.setFaultZoneType("instance");
configAccessor.setClusterConfig(CLUSTER_NAME, clusterConfig);
for (int i = 0; i < NUM_NODE; i++) {
String storageNodeName = PARTICIPANT_PREFIX + "_" + (START_PORT + i);
_setupTool.addInstanceToCluster(CLUSTER_NAME, storageNodeName);
_nodes.add(storageNodeName);
String tag = "tag-" + i % 2;
_setupTool.getClusterManagementTool().addInstanceTag(CLUSTER_NAME, storageNodeName, tag);
_nodeToTagMap.put(storageNodeName, tag);
InstanceConfig instanceConfig =
configAccessor.getInstanceConfig(CLUSTER_NAME, storageNodeName);
instanceConfig.setDomain("instance=" + storageNodeName);
configAccessor.setInstanceConfig(CLUSTER_NAME, storageNodeName, instanceConfig);
}
// start dummy participants
for (String node : _nodes) {
MockParticipantManager participant = new MockParticipantManager(ZK_ADDR, CLUSTER_NAME, node);
participant.syncStart();
_participants.add(participant);
}
// start controller
String controllerName = CONTROLLER_PREFIX + "_0";
_controller = new ClusterControllerManager(ZK_ADDR, CLUSTER_NAME, controllerName);
_controller.syncStart();
enablePersistBestPossibleAssignment(_gZkClient, CLUSTER_NAME, true);
//enableTopologyAwareRebalance(_gZkClient, CLUSTER_NAME, true);
}
示例13: beforeMethod
import org.apache.helix.ConfigAccessor; //导入方法依赖的package包/类
@BeforeMethod
public void beforeMethod() throws InterruptedException {
final int NUM_PARTITIONS = 10;
final int NUM_REPLICAS = 3;
// Cluster and resource setup
String className = TestHelper.getTestClassName();
String methodName = TestHelper.getTestMethodName();
_clusterName = className + "_" + methodName;
_setupTool = new ClusterSetup(ZK_ADDR);
_admin = _setupTool.getClusterManagementTool();
_setupTool.addCluster(_clusterName, true);
_setupTool.addResourceToCluster(_clusterName, RESOURCES[0], NUM_PARTITIONS,
BuiltInStateModelDefinitions.MasterSlave.name(), RebalanceMode.SEMI_AUTO.toString());
_setupTool.addResourceToCluster(_clusterName, RESOURCES[1], NUM_PARTITIONS,
BuiltInStateModelDefinitions.OnlineOffline.name(), RebalanceMode.SEMI_AUTO.toString());
_setupTool.addResourceToCluster(_clusterName, RESOURCES[2], NUM_PARTITIONS,
BuiltInStateModelDefinitions.MasterSlave.name(), RebalanceMode.FULL_AUTO.toString());
_setupTool.addResourceToCluster(_clusterName, RESOURCES[3], NUM_PARTITIONS,
BuiltInStateModelDefinitions.OnlineOffline.name(), RebalanceMode.FULL_AUTO.toString());
// Enable persist best possible assignment
ConfigAccessor configAccessor = new ConfigAccessor(_gZkClient);
ClusterConfig clusterConfig = configAccessor.getClusterConfig(_clusterName);
clusterConfig.setPersistBestPossibleAssignment(true);
configAccessor.setClusterConfig(_clusterName, clusterConfig);
// Configure and start the participants
_participants = new MockParticipantManager[RESOURCES.length];
for (int i = 0; i < _participants.length; i++) {
String host = "localhost";
int port = 12918 + i;
String id = host + '_' + port;
_setupTool.addInstanceToCluster(_clusterName, id);
_participants[i] = new MockParticipantManager(ZK_ADDR, _clusterName, id);
_participants[i].syncStart();
}
// Rebalance the resources
for (int i = 0; i < RESOURCES.length; i++) {
_setupTool.rebalanceResource(_clusterName, RESOURCES[i], NUM_REPLICAS);
}
// Start the controller
_controller = new ClusterControllerManager(ZK_ADDR, _clusterName, "controller_0");
_controller.syncStart();
Thread.sleep(1000);
}