Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
OpenXG-WIC-Cnf
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
3
Issues
3
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
CommunityXG
OpenXG-WIC-Cnf
Commits
526c38e8
Commit
526c38e8
authored
Dec 14, 2020
by
ymwang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
hadoop
parent
3d152a45
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
30 deletions
+18
-30
apps/cnf-hadoop-computing/cnf-hadoop-client/src/main/java/top/ninwoo/hadoop/client/service/FileService.java
...in/java/top/ninwoo/hadoop/client/service/FileService.java
+18
-30
No files found.
apps/cnf-hadoop-computing/cnf-hadoop-client/src/main/java/top/ninwoo/hadoop/client/service/FileService.java
View file @
526c38e8
...
...
@@ -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] = getIp
List
(clusterId,wxName_list[k]);//通过卫星名字获取卫星ip
ipList
[
k
]
=
getIp
ByAppName
(
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;
}
}
*/
/**
* 发送文件到分布式节点
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment