Jelajahi Sumber

AMBARI-8173. Kafka does not provide any default value for kafka.log.dirs and creates confusion / poor UX. (Sriharsha Chintalapani via yusaku)

Yusaku Sako 10 tahun lalu
induk
melakukan
6dc6cc7823

+ 1 - 1
ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/configuration/kafka-broker.xml

@@ -23,7 +23,7 @@
 <configuration>
 <configuration>
   <property>
   <property>
     <name>log.dirs</name>
     <name>log.dirs</name>
-    <value></value>
+    <value>/kafka-logs</value>
     <description>
     <description>
       A comma-separated list of one or more directories in which Kafka data is stored.
       A comma-separated list of one or more directories in which Kafka data is stored.
       Each new partition that is created will be placed in the directory which currently has the fewest partitions.
       Each new partition that is created will be placed in the directory which currently has the fewest partitions.

+ 6 - 0
ambari-server/src/main/resources/stacks/HDP/2.2/services/KAFKA/package/scripts/kafka.py

@@ -35,6 +35,12 @@ def kafka():
     kafka_server_config = mutable_config_dict(params.config['configurations']['kafka-broker'])
     kafka_server_config = mutable_config_dict(params.config['configurations']['kafka-broker'])
     kafka_server_config['broker.id'] = brokerid
     kafka_server_config['broker.id'] = brokerid
     kafka_server_config['host.name'] = params.hostname
     kafka_server_config['host.name'] = params.hostname
+    kafka_data_dir = kafka_server_config['log.dirs']
+    Directory(filter(None,kafka_data_dir.split(",")),
+              owner=params.kafka_user,
+              group=params.user_group,
+              recursive=True)
+
     conf_dir = params.conf_dir
     conf_dir = params.conf_dir
     properties_config("server.properties",
     properties_config("server.properties",
                       conf_dir=params.conf_dir,
                       conf_dir=params.conf_dir,

+ 1 - 0
ambari-web/app/data/HDP2/site_properties.js

@@ -1724,6 +1724,7 @@ module.exports =
       "displayName": "log.dirs",
       "displayName": "log.dirs",
       "value": "",
       "value": "",
       "defaultValue": "",
       "defaultValue": "",
+      "defaultDirectory": "/kafka-logs",
       "displayType": "directories",
       "displayType": "directories",
       "serviceName": "KAFKA",
       "serviceName": "KAFKA",
       "filename": "kafka-broker.xml",
       "filename": "kafka-broker.xml",

+ 7 - 0
ambari-web/app/models/service_config.js

@@ -533,6 +533,7 @@ App.ServiceConfigProperty = Ember.Object.extend({
       case 'yarn.nodemanager.local-dirs':
       case 'yarn.nodemanager.local-dirs':
       case 'yarn.nodemanager.log-dirs':
       case 'yarn.nodemanager.log-dirs':
       case 'mapred.local.dir':
       case 'mapred.local.dir':
+      case 'log.dirs':  // for Kafka Broker
         this.unionAllMountPoints(!isOnlyFirstOneNeeded, localDB);
         this.unionAllMountPoints(!isOnlyFirstOneNeeded, localDB);
         break;
         break;
       case 'fs.checkpoint.dir':
       case 'fs.checkpoint.dir':
@@ -655,6 +656,12 @@ App.ServiceConfigProperty = Ember.Object.extend({
           setOfHostNames.push(component.hostName);
           setOfHostNames.push(component.hostName);
         }, this);
         }, this);
         break;
         break;
+      case 'log.dirs':
+        components = masterComponentHostsInDB.filterProperty('component', 'KAFKA_BROKER');
+        components.forEach(function (component) {
+          setOfHostNames.push(component.hostName);
+        }, this);
+        break;
     }
     }
 
 
     // In Add Host Wizard, if we did not select this slave component for any host, then we don't process any further.
     // In Add Host Wizard, if we did not select this slave component for any host, then we don't process any further.