Skip to content
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 @@ -31,7 +31,7 @@
</property>
<property>
<name>zookeeper.connect</name>
<value><![CDATA[<#if zk_server_list?? ><#list zk_server_list as host>${host}:2181<#sep>,</#sep></#list><#else>localhost:2181</#if>]]></value>
<value>localhost:2181</value>
<description>
Zookeeper also allows you to add a "chroot" path which will make all kafka data for this cluster appear
under a particular path.
Expand All @@ -43,14 +43,14 @@
</property>
<property>
<name>listeners</name>
<value><![CDATA[PLAINTEXT://<#if host?? >${host}:9092<#else>localhost:9092</#if>]]></value>
<value>PLAINTEXT://${host}:9092</value>
<description>
host and port where kafka broker will be accepting connections. localhost will be substituted with hostname.
</description>
</property>
<property>
<name>advertised.listeners</name>
<value><![CDATA[PLAINTEXT://<#if host?? >${host}:9092<#else>localhost:9092</#if>]]></value>
<value>PLAINTEXT://${host}:9092</value>
<description>
Listeners to publish to ZooKeeper for clients to use, if different than the listeners config property.
</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@

<property>
<name>solr_zookeeper_quorum</name>
<value>
<![CDATA[<#if zookeeper_quorum?? ><#list zookeeper_quorum as host>${host}:2181<#sep>,</#sep></#list><#else>localhost:2181</#if>]]></value>
<value>localhost:2181</value>
<description>Placeholder for Solr Zookeeper connection string. (Use the cluster one by default, you can override
this with a custom one if ZK needs to be external)
</description>
Expand Down Expand Up @@ -187,19 +186,19 @@

<property>
<name>solr_extra_java_opts</name>
<value />
<value/>
<description>Extra Solr java options (e.g.: -Dproperty=value), that will be added to SOLR_OPTS environment
variable
</description>
</property>

<property>
<name>solr_gc_log_opts</name>
<value />
<value/>
</property>
<property>
<name>solr_gc_tune</name>
<value />
<value/>
</property>
<property>
<name>solr_min_mem</name>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</property>
<property>
<name>zookeeper.connect</name>
<value><![CDATA[<#if zk_server_list?? ><#list zk_server_list as host>${host}:2181<#sep>,</#sep></#list><#else>localhost:2181</#if>]]></value>
<value>localhost:2181</value>
<description>
Zookeeper also allows you to add a "chroot" path which will make all kafka data for this cluster appear
under a particular path.
Expand All @@ -43,14 +43,14 @@
</property>
<property>
<name>listeners</name>
<value><![CDATA[PLAINTEXT://<#if host?? >${host}:9092<#else>localhost:9092</#if>]]></value>
<value>PLAINTEXT://${host}:9092</value>
<description>
host and port where kafka broker will be accepting connections. localhost will be substituted with hostname.
</description>
</property>
<property>
<name>advertised.listeners</name>
<value><![CDATA[PLAINTEXT://<#if host?? >${host}:9092<#else>localhost:9092</#if>]]></value>
<value>PLAINTEXT://${host}:9092</value>
<description>
Listeners to publish to ZooKeeper for clients to use, if different than the listeners config property.
</description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,15 @@
import org.apache.bigtop.manager.stack.core.spi.param.Params;
import org.apache.bigtop.manager.stack.core.utils.LocalSettings;

import org.springframework.util.CollectionUtils;

import com.google.auto.service.AutoService;
import lombok.Getter;
import lombok.NoArgsConstructor;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@AutoService(Params.class)
Expand All @@ -49,12 +53,20 @@ public KafkaParams(ComponentCommandPayload componentCommandPayload) {
globalParamsMap.put("java_home", javaHome());
globalParamsMap.put("kafka_conf_dir", confDir());
globalParamsMap.put("security_enabled", false);
globalParamsMap.put("host", hostname());
}

@GlobalParams
public Map<String, Object> kafkaBroker() {
Map<String, Object> kafkaBroker = LocalSettings.configurations(getServiceName(), "kafka-broker");
kafkaDataDir = (String) kafkaBroker.get("log.dirs");

List<String> zookeeperServerHosts = LocalSettings.componentHosts("zookeeper_server");
if (!CollectionUtils.isEmpty(zookeeperServerHosts)) {
String zkServerListStr =
zookeeperServerHosts.stream().map(s -> s + ":2181").collect(Collectors.joining(","));
kafkaBroker.put("zookeeper.connect", zkServerListStr);
}
return kafkaBroker;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,13 @@
import org.apache.bigtop.manager.common.shell.ShellResult;
import org.apache.bigtop.manager.stack.core.enums.ConfigType;
import org.apache.bigtop.manager.stack.core.spi.param.Params;
import org.apache.bigtop.manager.stack.core.utils.LocalSettings;
import org.apache.bigtop.manager.stack.core.utils.linux.LinuxFileUtils;

import lombok.AccessLevel;
import lombok.NoArgsConstructor;
import lombok.extern.slf4j.Slf4j;

import java.text.MessageFormat;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_644;
import static org.apache.bigtop.manager.common.constants.Constants.PERMISSION_755;
Expand All @@ -53,18 +49,14 @@ public static ShellResult configure(Params params) {
LinuxFileUtils.createDirectories(kafkaParams.getKafkaLogDir(), kafkaUser, kafkaGroup, PERMISSION_755, true);
LinuxFileUtils.createDirectories(kafkaParams.getKafkaPidDir(), kafkaUser, kafkaGroup, PERMISSION_755, true);

List<String> zookeeperServerHosts = LocalSettings.componentHosts("zookeeper_server");
Map<String, Object> paramMap = new HashMap<>();
paramMap.put("zk_server_list", zookeeperServerHosts);
paramMap.put("host", kafkaParams.hostname());
LinuxFileUtils.toFile(
ConfigType.PROPERTIES,
MessageFormat.format("{0}/server.properties", confDir),
kafkaUser,
kafkaGroup,
PERMISSION_644,
kafkaParams.kafkaBroker(),
paramMap);
kafkaParams.getGlobalParamsMap());

LinuxFileUtils.toFileByTemplate(
kafkaParams.getKafkaEnvContent(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import java.text.MessageFormat;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

@Getter
@Slf4j
Expand Down Expand Up @@ -71,12 +72,17 @@ public Map<String, Object> solrEnv() {
solrPort = (String) solrEnv.get("solr_port");
solrPidFile = solrPidDir + "/solr-" + solrPort + ".pid";

List<String> ZookeeperServerHosts = LocalSettings.componentHosts("zookeeper_server");
Map<String, Object> ZKPort = LocalSettings.configurations("zookeeper", "zoo.cfg");
String clientPort = (String) ZKPort.get("clientPort");
List<String> zookeeperServerHosts = LocalSettings.componentHosts("zookeeper_server");
Map<String, Object> zKPort = LocalSettings.configurations("zookeeper", "zoo.cfg");
String clientPort = (String) zKPort.get("clientPort");
zNode = (String) solrEnv.get("solr_znode");
zkString = MessageFormat.format("{0}:{1}", ZookeeperServerHosts.get(0), clientPort);
zkString = MessageFormat.format("{0}:{1}", zookeeperServerHosts.get(0), clientPort);
zkHost = MessageFormat.format("{0}{1}", zkString, zNode);

String zkServerListStr =
zookeeperServerHosts.stream().map(s -> s + ":2181").collect(Collectors.joining(","));
solrEnv.put("solr_zookeeper_quorum", zkServerListStr);

return solrEnv;
}

Expand Down
Loading