Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BIGTOP-4300: Install Kafka with tarball #122

Merged
merged 1 commit into from
Dec 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,23 @@

import java.io.IOException;
import java.text.MessageFormat;
import java.util.Properties;

@Slf4j
@AutoService(Script.class)
public class KafkaBrokerScript extends AbstractServerScript {

@Override
public ShellResult add(Params params) {
Properties properties = new Properties();
properties.setProperty(PROPERTY_KEY_SKIP_LEVELS, "1");

return super.add(params, properties);
}

@Override
public ShellResult configure(Params params) {
return KafkaSetup.config(params);
return KafkaSetup.configure(params);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ public String kafkaLimits() {
return (String) kafkaLimits.get("content");
}

@Override
public String confDir() {
return serviceHome() + "/config";
}

@Override
public String getServiceName() {
return "kafka";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
@NoArgsConstructor(access = AccessLevel.PRIVATE)
public class KafkaSetup {

public static ShellResult config(Params params) {
public static ShellResult configure(Params params) {
log.info("Configuring Kafka");
KafkaParams kafkaParams = (KafkaParams) params;

String confDir = kafkaParams.confDir();
Expand All @@ -52,7 +53,6 @@ public static ShellResult config(Params params) {
LinuxFileUtils.createDirectories(kafkaParams.getKafkaLogDir(), kafkaUser, kafkaGroup, PERMISSION_755, true);
LinuxFileUtils.createDirectories(kafkaParams.getKafkaPidDir(), kafkaUser, kafkaGroup, PERMISSION_755, true);

// server.properties
List<String> zookeeperServerHosts = LocalSettings.hosts("zookeeper_server");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("zk_server_list", zookeeperServerHosts);
Expand All @@ -66,7 +66,6 @@ public static ShellResult config(Params params) {
kafkaParams.kafkaBroker(),
paramMap);

// kafka-env
LinuxFileUtils.toFileByTemplate(
kafkaParams.getKafkaEnvContent(),
MessageFormat.format("{0}/kafka-env.sh", confDir),
Expand All @@ -75,7 +74,6 @@ public static ShellResult config(Params params) {
PERMISSION_644,
kafkaParams.getGlobalParamsMap());

// log4j
LinuxFileUtils.toFileByTemplate(
kafkaParams.getKafkaLog4jContent(),
MessageFormat.format("{0}/log4j.properties", confDir),
Expand All @@ -84,7 +82,6 @@ public static ShellResult config(Params params) {
PERMISSION_644,
kafkaParams.getGlobalParamsMap());

// kafka.limits
LinuxFileUtils.toFileByTemplate(
kafkaParams.kafkaLimits(),
MessageFormat.format("{0}/kafka.conf", KafkaParams.LIMITS_CONF_DIR),
Expand All @@ -93,6 +90,7 @@ public static ShellResult config(Params params) {
PERMISSION_644,
kafkaParams.getGlobalParamsMap());

return ShellResult.success("Kafka Server Configure success!");
log.info("Successfully configured Kafka");
return ShellResult.success();
}
}
Loading