本文整理了Java中com.ucar.datalink.domain.media.parameter.zk.ZkMediaSrcParameter.getServers()
方法的一些代码示例,展示了ZkMediaSrcParameter.getServers()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ZkMediaSrcParameter.getServers()
方法的具体详情如下:
包路径:com.ucar.datalink.domain.media.parameter.zk.ZkMediaSrcParameter
类名称:ZkMediaSrcParameter
方法名:getServers
暂无
代码示例来源:origin: ucarGroup/DataLink
@Override
public String toString() {
return "zkAddress:"+zkParameter.getServers()+" znode:"+hbaseParameter.getZnodeParent();
}
代码示例来源:origin: ucarGroup/DataLink
@Override
public String toString() {
return "zkAddress:"+zkParameter.getServers()+" znode:"+hbaseParameter.getZnodeParent() + " table name:"+tableName;
}
代码示例来源:origin: ucarGroup/DataLink
@Override
public String toString() {
return "zkAddress:"+zkParameter.getServers()+" znode:"+hbaseParameter.getZnodeParent() + " table name:"+tableName;
}
代码示例来源:origin: ucarGroup/DataLink
@Override
public String toString() {
return "zkAddress:"+zkParameter.getServers()+" znode:"+hbaseParameter.getZnodeParent() + " table name:"+tableName;
}
代码示例来源:origin: ucarGroup/DataLink
@Override
public String toString() {
return "zkAddress:"+zkParameter.getServers()+" znode:"+hbaseParameter.getZnodeParent();
}
代码示例来源:origin: ucarGroup/DataLink
private List<MediaSourceInfo> buildZkMediaSources() {
List<MediaSourceInfo> list = mediaService.getMediaSourcesByTypes(MediaSourceType.ZOOKEEPER);
return list == null ?
Lists.newArrayList() :
list.stream().
filter(i -> ((ZkMediaSrcParameter) i.getParameterObj()).getServers().equals(ManagerConfig.current().getZkServer()))
.collect(Collectors.toList());
}
代码示例来源:origin: ucarGroup/DataLink
private void checkZkServers(ZkMediaSourceView zkMediaSourceView) throws IOException {
String servers = zkMediaSourceView.getZkMediaSrcParameter().getServers();
String[] serversArray = servers.split(",");
List<String> serversList = new ArrayList<String>();
for (String str : serversArray) {
serversList.add(str);
}
for (String server : serversList) {
String[] array = server.split(":");
if (array.length > 1) {
String host = array[0];
int port = Integer.valueOf(array[1]);
try {
String result = send4LetterWord(host, port, "ruok", 5000);
if (result.equals("imok\n")) {
continue;
}
} catch (IOException e) {
throw new IOException("Zk服务器验证失败.", e);
}
}else {
throw new ValidationException("ip地址格式不正确.");
}
}
}
代码示例来源:origin: ucarGroup/DataLink
private void checkZkInfo(MediaSourceInfo mediaSourceInfo) {
String msName = mediaSourceInfo.getName();
String namePrefix = "zk_";
if (!msName.startsWith(namePrefix)) {
throw new ValidationException(String.format("zk数据源名称必须以%s为前缀.", namePrefix));
}
Set<MediaSourceType> setMediaSource = new HashSet<MediaSourceType>();
setMediaSource.add(MediaSourceType.ZOOKEEPER);
List<MediaSourceInfo> zkList = getListByType(setMediaSource);
if (zkList != null) {
zkList.forEach(zk -> {
String servers = ((ZkMediaSrcParameter) zk.getParameterObj()).getServers();
if (servers.equals(((ZkMediaSrcParameter) mediaSourceInfo.getParameterObj()).getServers()) && !zk.getId().equals(mediaSourceInfo.getId())) {
throw new ValidationException(String.format("ip地址已经存在:%s.", servers));
}
});
}
}
代码示例来源:origin: ucarGroup/DataLink
private void setHdfsParameter(MediaSourceInfo mediaSourceInfo) {
HDFSMediaSrcParameter hdfsMediaSrcParameter = mediaSourceInfo.getParameterObj();
this.hdfsAddress = hdfsMediaSrcParameter.getNameServices();
this.hdfsUri = URI.create(this.hdfsAddress);
this.hadoopUser = hdfsMediaSrcParameter.getHadoopUser();
this.haNameNode1 = hdfsMediaSrcParameter.getNameNode1();
this.haNameNode2 = hdfsMediaSrcParameter.getNameNode2();
MediaSourceInfo zkMediaSrcInfo = DataLinkFactory.getObject(MediaSourceService.class).getById(hdfsMediaSrcParameter.getZkMediaSourceId());
String zkServers = ((ZkMediaSrcParameter) zkMediaSrcInfo.getParameterObj()).getServers();
String[] zkArray = zkServers.split(",");
List<String> zkList = new ArrayList<>();
Collections.addAll(zkList, zkArray);
List<String> ipList = new ArrayList<>();
for (String zk : zkList) {
String[] zkServer = zk.split(":");
ipList.add(zkServer[0]);
this.zkPort = zkServer[1];
}
this.zkUrl = String.join(",", ipList);
}
代码示例来源:origin: ucarGroup/DataLink
public static List<HBaseRange> generateHBaseSplitInfo(MediaSourceInfo info, String tableName, int splitCount) {
checkHbase(info);
HBaseMediaSrcParameter parameter = info.getParameterObj();
long zkId = parameter.getZkMediaSourceId();
String znode = parameter.getZnodeParent();
MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
checkZookeepr(zkInfo);
ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
HBaseParameterVO vo = new HBaseParameterVO();
vo.setTableName(tableName);
vo.setZkAddress(zkParameter.getServers());
vo.setPort(zkParameter.parsePort()+"");
vo.setZnode(parameter.getZnodeParent());
vo.setSplitCount(splitCount);
String json = execute(vo,GENERATE_SPLIT_INFO);
Map<String,Object> map = JSONObject.parseObject(json,Map.class);
JSONArray array = (JSONArray)map.get("range");
Object[] obj_arr = array.toArray();
List<HBaseRange> list = new ArrayList<>();
for(Object o : obj_arr) {
String str = JSONObject.toJSONString(o);
HBaseRange hr = JSONObject.parseObject(str, HBaseRange.class);
list.add(hr);
}
return list;
}
代码示例来源:origin: ucarGroup/DataLink
@RequestMapping(value = "/initZk")
@ResponseBody
public Page<ZkMediaSourceView> initZk() {
Set<MediaSourceType> setMediaSource = new HashSet<MediaSourceType>();
setMediaSource.add(MediaSourceType.ZOOKEEPER);
List<MediaSourceInfo> zkMediaSourceList = mediaSourceService.getListByType(setMediaSource);
List<ZkMediaSourceView> taskView = zkMediaSourceList.stream().map(i -> {
ZkMediaSourceView view = new ZkMediaSourceView();
view.setId(i.getId());
view.setName(i.getName());
view.setDesc(i.getDesc());
view.setCreateTime(i.getCreateTime());
view.getZkMediaSrcParameter().setMediaSourceType(i.getType());
view.getZkMediaSrcParameter().setServers(((ZkMediaSrcParameter) i.getParameterObj()).getServers());
view.getZkMediaSrcParameter().setSessionTimeout(((ZkMediaSrcParameter) i.getParameterObj()).getSessionTimeout());
view.getZkMediaSrcParameter().setConnectionTimeout(((ZkMediaSrcParameter) i.getParameterObj()).getConnectionTimeout());
return view;
}).collect(Collectors.toList());
return new Page<ZkMediaSourceView>(taskView);
}
代码示例来源:origin: ucarGroup/DataLink
public static int getRegionCount(MediaSourceInfo info, String tableName) {
checkHbase(info);
HBaseMediaSrcParameter parameter = info.getParameterObj();
long zkId = parameter.getZkMediaSourceId();
String znode = parameter.getZnodeParent();
MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
checkZookeepr(zkInfo);
ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
HBaseParameterVO vo = new HBaseParameterVO();
vo.setTableName(tableName);
vo.setZkAddress(zkParameter.getServers());
vo.setPort(zkParameter.parsePort()+"");
vo.setZnode(parameter.getZnodeParent());
String json = execute(vo,GET_REGION_COUNT);
int result = -1;
try {
result = Integer.parseInt(json);
} catch(Exception e) {
logger.error(e.getMessage(),e);
}
return result;
}
代码示例来源:origin: ucarGroup/DataLink
private ReplicationConfig buidReplicationConfig(HBaseReaderParameter readerParameter) {
ReplicationConfig config = new ReplicationConfig();
config.setHbaseName("hbase-4-datalink");
config.setZnodeParent(readerParameter.getReplZnodeParent());
ZkMediaSrcParameter zkMediaSrcParameter = DataLinkFactory.getObject(MediaSourceService.class).
getById(readerParameter.getReplZkMediaSourceId()).getParameterObj();
config.setZkConfig(new ZkConfig(zkMediaSrcParameter.getServers(), 6000, 60000));
return config;
}
}
代码示例来源:origin: ucarGroup/DataLink
/**
* 根据传入的MediaSourceInfo 获取所有表的元信息
* @param info
* @return
*/
public static List<MediaMeta> getTables(MediaSourceInfo info) {
checkHbase(info);
HBaseMediaSrcParameter parameter = info.getParameterObj();
long zkId = parameter.getZkMediaSourceId();
String znode = parameter.getZnodeParent();
MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
checkZookeepr(zkInfo);
ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
HBaseParameterVO vo = new HBaseParameterVO();
vo.setTableName("");
vo.setZkAddress(zkParameter.getServers());
vo.setPort(zkParameter.parsePort()+"");
vo.setZnode(parameter.getZnodeParent());
String json = execute(vo,GET_TABLES_URL);
return JSONObject.parseArray(json, MediaMeta.class);
}
代码示例来源:origin: ucarGroup/DataLink
/**
* 根据传入的MediaSourceInfo和表名,获取这个表下的所有列的元信息
* @param info
* @param tableName
* @return
*/
public static List<ColumnMeta> getColumns(MediaSourceInfo info, String tableName) {
checkHbase(info);
HBaseMediaSrcParameter parameter = info.getParameterObj();
long zkId = parameter.getZkMediaSourceId();
String znode = parameter.getZnodeParent();
MediaSourceInfo zkInfo = dao.findMediaSourceById(zkId);
checkZookeepr(zkInfo);
ZkMediaSrcParameter zkParameter = zkInfo.getParameterObj();
HBaseParameterVO vo = new HBaseParameterVO();
vo.setTableName(tableName);
vo.setZkAddress(zkParameter.getServers());
vo.setPort(zkParameter.parsePort()+"");
vo.setZnode(parameter.getZnodeParent());
String json = execute(vo,GET_COLUMNS_URL);
return JSONObject.parseArray(json, ColumnMeta.class);
}
内容来源于网络,如有侵权,请联系作者删除!