PinotHelixSegmentOnlineOfflineStateModelGenerator.PINOT_SEGMENT_ONLINE_OFFLINE_STATE_MODEL; if (admin.getClusters().contains(helixClusterName)) { LOGGER.info("cluster already exists ********************************************* "); if (isUpdateStateModel) {
public static void createHelixClusterIfNeeded(String helixClusterName, String zkPath) { final HelixAdmin admin = new ZKHelixAdmin(zkPath); if (admin.getClusters().contains(helixClusterName)) { LOGGER.info( "cluster already exist, skipping it.. ********************************************* "); return; } LOGGER.info("Creating a new cluster, as the helix cluster : " + helixClusterName + " was not found ********************************************* "); admin.addCluster(helixClusterName, false); LOGGER.info("Enable mirror maker machines auto join."); final HelixConfigScope scope = new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER) .forCluster(helixClusterName).build(); final Map<String, String> props = new HashMap<String, String>(); props.put(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, String.valueOf(true)); props.put(MessageType.STATE_TRANSITION + "." + HelixTaskExecutor.MAX_THREADS, String.valueOf(100)); admin.setConfig(scope, props); LOGGER.info("Adding state model definition named : OnlineOffline generated using : " + OnlineOfflineStateModel.class.toString() + " ********************************************** "); // add state model definition admin.addStateModelDef(helixClusterName, "OnlineOffline", OnlineOfflineStateModel.build()); LOGGER.info("New Cluster setup completed... ********************************************** "); }
@GET public Response getClusters() { HelixAdmin helixAdmin = getHelixAdmin(); List<String> clusters = helixAdmin.getClusters(); Map<String, List<String>> dataMap = new HashMap<>(); dataMap.put(ClusterProperties.clusters.name(), clusters); return JSONRepresentation(dataMap); }
public static void createHelixClusterIfNeeded(String helixClusterName, String zkPath) { final HelixAdmin admin = new ZKHelixAdmin(zkPath); if (admin.getClusters().contains(helixClusterName)) { LOGGER.info("cluster already exist, skipping it.. ********************************************* "); return; } LOGGER.info("Creating a new cluster, as the helix cluster : " + helixClusterName + " was not found ********************************************* "); admin.addCluster(helixClusterName, false); LOGGER.info("Enable mirror maker machines auto join."); final HelixConfigScope scope = new HelixConfigScopeBuilder(ConfigScopeProperty.CLUSTER) .forCluster(helixClusterName).build(); final Map<String, String> props = new HashMap<String, String>(); props.put(ZKHelixManager.ALLOW_PARTICIPANT_AUTO_JOIN, String.valueOf(true)); props.put(MessageType.STATE_TRANSITION + "." + HelixTaskExecutor.MAX_THREADS, String.valueOf(100)); admin.setConfig(scope, props); LOGGER.info("Adding state model definition named : OnlineOffline generated using : " + OnlineOfflineStateModel.class.toString() + " ********************************************** "); // add state model definition admin.addStateModelDef(helixClusterName, "OnlineOffline", OnlineOfflineStateModel.build()); LOGGER.info("New Cluster setup completed... ********************************************** "); }
List<String> clusters = setupTool.getClusterManagementTool().getClusters();
List<String> clusters = setupTool.getClusterManagementTool().getClusters();
StringRepresentation getClustersRepresentation() throws JsonGenerationException, JsonMappingException, IOException { ZkClient zkClient = ResourceUtil.getAttributeFromCtx(getContext(), ResourceUtil.ContextKey.ZKCLIENT); ClusterSetup setupTool = new ClusterSetup(zkClient); List<String> clusters = setupTool.getClusterManagementTool().getClusters(); ZNRecord clustersRecord = new ZNRecord("Clusters Summary"); clustersRecord.setListField("clusters", clusters); StringRepresentation representation = new StringRepresentation(ClusterRepresentationUtil.ZNRecordToJson(clustersRecord), MediaType.APPLICATION_JSON); return representation; }
Assert.assertTrue(ZKUtil.isClusterSetup(clusterName, _gZkClient)); List<String> list = tool.getClusters(); AssertJUnit.assertTrue(list.size() > 0);