Commit 526c38e8 authored by ymwang's avatar ymwang

hadoop

parent 3d152a45
......@@ -14,6 +14,7 @@ import top.ninwoo.hadoop.api.po.MergeResult;
import top.ninwoo.hadoop.api.po.SplitResult;
import top.ninwoo.hadoop.api.service.HadoopComService;
import javax.annotation.PostConstruct;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
......@@ -21,8 +22,8 @@ import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.*;
//import top.ninwoo.bishe.starter.service.NetworkService;
import top.ninwoo.bishe.starter.service.NetworkService;
import top.ninwoo.bishe.starter.service.NetworkService;
/**
* 文件服务
......@@ -38,46 +39,33 @@ public class FileService {
@Autowired
private RestTemplate restTemplate;
@Autowired
private NetworkService networkService;
@Autowired
private HadoopComService hadoopComService;
//不需要了,我懒得改
Long clusterId = 11113L;//docker集群ID
//String[] wxName_list = new String[]{"sate1","sate2","sate3","sate4","sate5","sate6","sate7"};//获取卫星名字
String[] wxName_list = new String[]{"sate1","sate2","sate3","sate4","sate5","sate6","sate7"};//获取卫星名字
String[] wxName_list = new String[]{"sate2","sate3","sate4","sate5","sate6","sate7","sate8","sate9","sate10","sate11",
"sate12","sate13","sate14","sate15","sate16","sate17","sate18","sate19","sate20","sate21",
"sate22","sate23","sate24","sate25","sate26","sate27","sate28","sate29","sate30"};//获取卫星名字
private String[] ipList = new String[29];
private List <Integer> index = new ArrayList<Integer>() {} ;
/* @PostConstruct
@PostConstruct
public void init() {
*//* ipList = getIpList(11113l,"dbc_server");
System.out.println(Arrays.toString(ipList));*//*
System.out.println(Arrays.toString(ipList));
for (int k = 0; k < wxName_list.length; k++){
ipList[k] = getIpList(clusterId,wxName_list[k]);//通过卫星名字获取卫星ip
ipList[k] = getIpByAppName(clusterId,wxName_list[k]);//通过卫星名字获取卫星ip
}
}
*/
/*获取容器ip*/
/* String[] ipList = new String[]{"127.0.0.1:8080","127.0.0.1:8081","127.0.0.1:8082","127.0.0.1:8083","127.0.0.1:8084",
"127.0.0.1:8085","127.0.0.1:8086"};*/
/* public String[] getIpList(Long clusterId, String appName) {
List<String> ipListS = networkService.getIpListByAppName(clusterId, appName);//用于存储容器ip的list集合
String[] containerIp = new String[ipListS.size()];//将集合中的元素存在数组里,因为下边用的是数组
for (int i = 0; i < ipListS.size(); i++) {
if(!ipListS.isEmpty()){
String ip_tmp = ipListS.get(i);
String rep = ip_tmp.replaceAll("[\\[\\]]","");
String[] split_list = rep.split("/");
containerIp[i] = split_list[0]+":8082";
}
}
return containerIp;
}*/
/* public String getIpByAppName(Long clusterId,String appName) {
public String getIpByAppName(Long clusterId,String appName) {
List<String> ipList = networkService.getIpListByAppName(clusterId, appName);
if(!ipList.isEmpty()){
String ip_tmp = ipList.get(0);
......@@ -85,9 +73,9 @@ public class FileService {
return split_list[0] + ":8082";
}
return null;
}*/
}
//todo 可能会有找不到文件的情况
/* //todo 可能会有找不到文件的情况
public String getIpByAppName(Long clusterId,String appName) {
String str;
File file = new File(directoryOutput+"sateIP.txt");
......@@ -103,7 +91,7 @@ public class FileService {
e.printStackTrace();
}
return null;
}
}*/
/**
* 发送文件到分布式节点
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment