Skip to content

Commit faa3f19

Browse files
authored
BIGTOP-4297: Install Tez with tarball (#120)
1 parent 10425e7 commit faa3f19

File tree

13 files changed

+147
-80
lines changed

13 files changed

+147
-80
lines changed

bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/flink/metainfo.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,17 +52,19 @@
5252
<package-specific>
5353
<architectures>
5454
<arch>x86_64</arch>
55+
<arch>aarch64</arch>
5556
</architectures>
5657
<packages>
5758
<package>
58-
<name>flink_3_3_0</name>
59+
<name>flink-1.16.2-1.tgz</name>
60+
<checksum>SHA-256:8c6da7cbab14b9cf0ce39c8c873b29f16c83df0b95b7af5cf3061a468efac228</checksum>
5961
</package>
6062
</packages>
6163
</package-specific>
6264
</package-specifics>
6365

6466
<required-services>
65-
<service>yarn</service>
67+
<service>hadoop</service>
6668
</required-services>
6769
</service>
6870
</metainfo>

bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/hadoop/metainfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
<packages>
113113
<package>
114114
<name>hadoop-3.3.6-1.tar.gz</name>
115-
<checksum>SHA-256:2a9312eac69a542c6266f1689d29ded243dde2d61add333a9762829008f97442</checksum>
115+
<checksum>SHA-256:0da6364126c6ea6dd0f5b545afec33957ee801d6db6c0874edb0aa5be1e89995</checksum>
116116
</package>
117117
</packages>
118118
</package-specific>

bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/kafka/metainfo.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@
4343
<package-specific>
4444
<architectures>
4545
<arch>x86_64</arch>
46+
<arch>aarch64</arch>
4647
</architectures>
4748
<packages>
4849
<package>
49-
<name>kafka_3_3_0</name>
50+
<name>kafka-2.8.2-1.tgz</name>
51+
<checksum>SHA-256:30a2d69ef081813624273d8a406c9b803c5868df998484e27207f85ea217870f</checksum>
5052
</package>
5153
</packages>
5254
</package-specific>

bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/solr/metainfo.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,12 @@
4747
<package-specific>
4848
<architectures>
4949
<arch>x86_64</arch>
50+
<arch>aarch64</arch>
5051
</architectures>
5152
<packages>
5253
<package>
53-
<name>solr_3_3_0</name>
54+
<name>solr-8.11.2-2.tgz</name>
55+
<checksum>SHA-256:fba6618e4c3a3133a4c4d57718e52cc797d10374f056825329a9e76b93de9f48</checksum>
5456
</package>
5557
</packages>
5658
</package-specific>

bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/tez/metainfo.xml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,17 +39,19 @@
3939
<package-specific>
4040
<architectures>
4141
<arch>x86_64</arch>
42+
<arch>aarch64</arch>
4243
</architectures>
4344
<packages>
4445
<package>
45-
<name>tez_3_3_0</name>
46+
<name>tez-0.10.2-1.tar.gz</name>
47+
<checksum>SHA-256:ebc2c195780fc76fb9b12e8987e48c301ca0b1916dca515f5c7a1122d74f397e</checksum>
4648
</package>
4749
</packages>
4850
</package-specific>
4951
</package-specifics>
5052

5153
<required-services>
52-
<service>hdfs</service>
54+
<service>hadoop</service>
5355
</required-services>
5456
</service>
5557
</metainfo>

bigtop-manager-server/src/main/resources/stacks/bigtop/3.3.0/services/zookeeper/metainfo.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<packages>
5555
<package>
5656
<name>zookeeper-3.7.2-1.tar.gz</name>
57-
<checksum>SHA-256:380f15d55c0282e33fdc7c2ec551bc5586f0ac126c243cd84347ccb775b846f3</checksum>
57+
<checksum>SHA-256:83e07f914eb3477c77245f4dc44031b82ea6ef1be3691687f469ddc4b8c720bb</checksum>
5858
</package>
5959
</packages>
6060
</package-specific>

bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezClientScript.java

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,21 +18,49 @@
1818
*/
1919
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.tez;
2020

21+
import org.apache.bigtop.manager.common.message.entity.pojo.PackageInfo;
22+
import org.apache.bigtop.manager.common.message.entity.pojo.RepoInfo;
2123
import org.apache.bigtop.manager.common.shell.ShellResult;
2224
import org.apache.bigtop.manager.stack.core.spi.param.Params;
2325
import org.apache.bigtop.manager.stack.core.spi.script.AbstractClientScript;
2426
import org.apache.bigtop.manager.stack.core.spi.script.Script;
27+
import org.apache.bigtop.manager.stack.core.tarball.TarballDownloader;
2528

2629
import com.google.auto.service.AutoService;
2730
import lombok.extern.slf4j.Slf4j;
2831

32+
import java.io.File;
33+
import java.util.List;
34+
2935
@Slf4j
3036
@AutoService(Script.class)
3137
public class TezClientScript extends AbstractClientScript {
3238

39+
/**
40+
* Tez tarball file doesn't need to be extracted, so here we override {@link #add(Params)} method
41+
* and do nothing after download the tarball file.
42+
*
43+
* @param params the parameters required for installation
44+
* @return ShellResult
45+
*/
46+
@Override
47+
public ShellResult add(Params params) {
48+
RepoInfo repo = params.repo();
49+
List<PackageInfo> packages = params.packages();
50+
51+
String repoUrl = repo.getBaseUrl();
52+
String stackHome = params.stackHome();
53+
for (PackageInfo packageInfo : packages) {
54+
String remoteUrl = repoUrl + File.separator + packageInfo.getName();
55+
TarballDownloader.download(remoteUrl, stackHome, packageInfo);
56+
}
57+
58+
return ShellResult.success();
59+
}
60+
3361
@Override
3462
public ShellResult configure(Params params) {
35-
return TezSetup.config(params);
63+
return TezSetup.configure(params);
3664
}
3765

3866
@Override

bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezParams.java

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,27 +77,14 @@ public Map<String, Object> tezEnv() {
7777
return tezEnv;
7878
}
7979

80-
@Override
81-
public String confDir() {
82-
return "/etc/tez/conf";
83-
}
84-
8580
public String hadoopConfDir() {
86-
return "/etc/hadoop/conf";
81+
return hadoopHome() + "/etc/hadoop";
8782
}
8883

8984
public String hadoopHome() {
9085
return stackHome() + "/hadoop";
9186
}
9287

93-
public String hdfsHome() {
94-
return stackHome() + "/hadoop-hdfs";
95-
}
96-
97-
public String yarnHome() {
98-
return stackHome() + "/hadoop-yarn";
99-
}
100-
10188
@Override
10289
public String getServiceName() {
10390
return "tez";

bigtop-manager-stack/bigtop-manager-stack-bigtop/src/main/java/org/apache/bigtop/manager/stack/bigtop/v3_3_0/tez/TezSetup.java

Lines changed: 22 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
package org.apache.bigtop.manager.stack.bigtop.v3_3_0.tez;
2020

2121
import org.apache.bigtop.manager.common.constants.Constants;
22+
import org.apache.bigtop.manager.common.message.entity.pojo.PackageInfo;
2223
import org.apache.bigtop.manager.common.shell.ShellResult;
23-
import org.apache.bigtop.manager.stack.bigtop.utils.HdfsUtil;
2424
import org.apache.bigtop.manager.stack.core.enums.ConfigType;
2525
import org.apache.bigtop.manager.stack.core.spi.param.Params;
2626
import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
@@ -31,23 +31,37 @@
3131
import lombok.extern.slf4j.Slf4j;
3232

3333
import java.text.MessageFormat;
34+
import java.util.List;
3435

3536
import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755;
3637

3738
@Slf4j
3839
@NoArgsConstructor(access = AccessLevel.PRIVATE)
3940
public class TezSetup {
4041

41-
public static ShellResult config(Params params) {
42+
public static ShellResult configure(Params params) {
43+
log.info("Configuring Tez");
4244
TezParams tezParams = (TezParams) params;
4345

4446
String confDir = tezParams.confDir();
45-
String hdfsUser = LocalSettings.users().get("hdfs");
47+
String serviceHome = tezParams.serviceHome();
48+
String libDir = serviceHome + "/lib";
49+
String hadoopUser = LocalSettings.users().get("hadoop");
4650
String tezUser = tezParams.user();
4751
String tezGroup = tezParams.group();
4852

49-
// tez-site
50-
log.info("Generating [{}/tez-site.xml] file", confDir);
53+
LinuxFileUtils.createDirectories(serviceHome, tezUser, tezGroup, Constants.PERMISSION_755, true);
54+
LinuxFileUtils.createDirectories(confDir, tezUser, tezGroup, Constants.PERMISSION_755, true);
55+
LinuxFileUtils.createDirectories(libDir, tezUser, tezGroup, Constants.PERMISSION_755, true);
56+
57+
List<PackageInfo> packages = params.packages();
58+
for (PackageInfo packageInfo : packages) {
59+
String source = tezParams.stackHome() + "/" + packageInfo.getName();
60+
String dest = libDir + "/tez.tar.gz";
61+
LinuxFileUtils.copyFile(source, dest);
62+
LinuxFileUtils.updateOwner(dest, tezUser, tezGroup, false);
63+
}
64+
5165
LinuxFileUtils.toFile(
5266
ConfigType.XML,
5367
MessageFormat.format("{0}/tez-site.xml", confDir),
@@ -57,8 +71,6 @@ public static ShellResult config(Params params) {
5771
tezParams.tezSite(),
5872
tezParams.getGlobalParamsMap());
5973

60-
// tez-env
61-
log.info("Generating [{}/tez-env.sh] file", confDir);
6274
LinuxFileUtils.toFileByTemplate(
6375
tezParams.getTezEnvContent(),
6476
MessageFormat.format("{0}/tez-env.sh", confDir),
@@ -67,10 +79,10 @@ public static ShellResult config(Params params) {
6779
PERMISSION_755,
6880
tezParams.getGlobalParamsMap());
6981

70-
HdfsUtil.createDirectory(hdfsUser, "/apps");
71-
HdfsUtil.uploadFile(tezUser, tezParams.serviceHome() + "/lib/tez.tar.gz", "/apps/tez");
82+
// HdfsUtil.createDirectory(hadoopUser, "/apps");
83+
// HdfsUtil.uploadFile(tezUser, tezParams.serviceHome() + "/lib/tez.tar.gz", "/apps/tez");
7284

7385
log.info("Successfully configured Tez");
74-
return ShellResult.success("Tez Configure success!");
86+
return ShellResult.success();
7587
}
7688
}

bigtop-manager-stack/bigtop-manager-stack-core/src/main/java/org/apache/bigtop/manager/stack/core/tarball/TarballDownloader.java

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
*/
1919
package org.apache.bigtop.manager.stack.core.tarball;
2020

21+
import org.apache.bigtop.manager.common.message.entity.pojo.PackageInfo;
22+
import org.apache.bigtop.manager.stack.core.exception.StackException;
23+
2124
import lombok.extern.slf4j.Slf4j;
2225

2326
import java.io.File;
@@ -30,7 +33,55 @@
3033
public class TarballDownloader {
3134

3235
@SuppressWarnings("ResultOfMethodCallIgnored")
33-
public static Boolean downloadFile(String fileUrl, String saveDir) {
36+
public static void download(String remoteUrl, String saveDir, PackageInfo packageInfo) {
37+
File localFile = new File(saveDir + File.separator + packageInfo.getName());
38+
String algorithm = packageInfo.getChecksum().split(":")[0];
39+
String checksum = packageInfo.getChecksum().split(":")[1];
40+
41+
if (localFile.exists()) {
42+
log.info("File [{}] exists, validating checksum", localFile.getAbsolutePath());
43+
} else {
44+
log.info("Downloading [{}] to [{}]", remoteUrl, saveDir);
45+
download(remoteUrl, saveDir);
46+
}
47+
48+
boolean validateChecksum = ChecksumValidator.validateChecksum(algorithm, checksum, localFile);
49+
if (!validateChecksum) {
50+
log.warn("Invalid checksum for [{}], re-downloading...", localFile.getAbsolutePath());
51+
localFile.delete();
52+
download(remoteUrl, saveDir);
53+
}
54+
55+
validateChecksum = ChecksumValidator.validateChecksum(algorithm, checksum, localFile);
56+
if (!validateChecksum) {
57+
log.error("Invalid checksum for [{}], exiting...", localFile.getAbsolutePath());
58+
throw new StackException("Invalid checksum for " + localFile.getAbsolutePath());
59+
}
60+
61+
log.info("Checksum validate successfully for [{}]", localFile.getAbsolutePath());
62+
}
63+
64+
private static void download(String remoteUrl, String saveDir) {
65+
int i = 1;
66+
while (true) {
67+
Boolean downloaded = downloadFile(remoteUrl, saveDir);
68+
if (downloaded) {
69+
break;
70+
} else {
71+
if (i == 3) {
72+
log.error("Failed to download [{}], exiting...", remoteUrl);
73+
throw new StackException("Failed to download " + remoteUrl);
74+
} else {
75+
log.error("Failed to download [{}], retrying...: {}", remoteUrl, i);
76+
}
77+
}
78+
79+
i++;
80+
}
81+
}
82+
83+
@SuppressWarnings("ResultOfMethodCallIgnored")
84+
private static Boolean downloadFile(String fileUrl, String saveDir) {
3485
HttpURLConnection httpConn = null;
3586
try {
3687
URL url = new URL(fileUrl);

0 commit comments

Comments
 (0)