Member since
08-08-2017
1652
Posts
30
Kudos Received
11
Solutions
My Accepted Solutions
| Title | Views | Posted |
|---|---|---|
| 2001 | 06-15-2020 05:23 AM | |
| 16487 | 01-30-2020 08:04 PM | |
| 2151 | 07-07-2019 09:06 PM | |
| 8362 | 01-27-2018 10:17 PM | |
| 4740 | 12-31-2017 10:12 PM |
06-04-2018
10:05 AM
@jay can you help me please , from some unclear reason I get "This post is currently awaiting moderation. If you believe this to be in error, contact a system administrator." on new question , what we can do to resolve this ?
... View more
05-28-2018
09:04 AM
@Michael Bronson, It is highly unlikely that you will get the same version number when using epoch timestamp, The number changes every millisecond. So each time you execute "version"+str(int(time.time() * 1000000)) you will get a new unique number.
... View more
06-04-2018
12:04 PM
who is the "system administrator." , in that case ?
... View more
05-25-2018
03:28 PM
1 Kudo
@Michael Bronson, Yes. Your both the above configs looks file and your final curl call will look like this curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '[
{
"Clusters": {
"desired_config": [
{
"type": "kafka-env",
"tag": "unique value",
"properties" : {
"content" : "\n#!/bin/bash\n\n# Set KAFKA specific environment variables here.\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}\nexport PATH=$PATH:$JAVA_HOME/bin\nexport PID_DIR={{kafka_pid_dir}}\nexport LOG_DIR={{kafka_log_dir}}\nexport KAFKA_KERBEROS_PARAMS={{kafka_kerberos_params}}\nexport JMX_PORT=9997\n# Add kafka sink to classpath and related depenencies\nif [ -e \"/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\" ]; then\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/lib/*\nfi\n\nif [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then\n. /etc/kafka/conf/kafka-ranger-env.sh\nfi\nexport KAFKA_HEAP_OPTS=\"-Xmx8g -Xms8g\"\nKAFKA_JVM_PERFORMANCE_OPTS=\"-XX:MetaspaceSize=96m -XX:+UseG1GC-XX:MaxGCPauseMillis=20 - XX:InitiatingHeapOccupancyPercent=35 -XX:G1HeapRegionSize=16M-XX:MinMetaspaceFreeRatio=50 - XX:MaxMetaspaceFreeRatio=80\n"",
"is_supported_kafka_ranger" : "true",
"kafka_log_dir" : "/var/log/kafka",
"kafka_pid_dir" : "/var/run/kafka",
"kafka_user" : "kafka",
"kafka_user_nofile_limit" : "128000",
"kafka_user_nproc_limit" : "65536"
},
"service_config_version_note": "New config version"
}
]
}
}
]' "http://master02:8080/api/v1/clusters/HDP"
... View more
05-25-2018
09:57 AM
2 Kudos
@Michael Bronson, You can do this in 3 steps. 1. Get the latest version tag for kafka-env. You can do this by hitting below curl request #curl -u admin:admin -H "X-Requested-By: ambari" http://{ambari-host}:{ambari-port}/api/v1/clusters/{cluster-name}?fields=Clusters/desired_configs
Sample resp:
{
"href" : "http://localhost:8080/api/v1/clusters/clustername?fields=Clusters/desired_configs",
"Clusters" : {
"cluster_name" : "clustername",
"version" : "HDP-2.6",
"desired_configs" : {
"accumulo-env" : {
"tag" : "version1525370182117",
"version" : 8
},
"accumulo-log4j" : {
"tag" : "version1525368283467",
"version" : 4
},
"accumulo-logsearch-conf" : {
"tag" : "version1525368283467",
"version" : 4
},
"accumulo-site" : {
"tag" : "version1525987821696",
"version" : 9
},
"kafka-env" : {
"tag" : "version1526330057712",
"version" : 1
},
"admin-properties" : {
"tag" : "version1526330057712",
"version" : 1
},
"ams-env" : {
"tag" : "version1",
"version" : 1
},
"ams-grafana-env" : {
"tag" : "version1",
"version" : 1
}
}
}
}
2) Get the tag for kafka-env from the above response. For above example call, tag for kafka-env is "version1526330057712". Now get the latest kafka-env config by using the above tag and the curl call. curl -u admin:admin -H "X-Requested-By: ambari" "http://{ambari-host}:{ambari-port}/api/v1/clusters/{cluster-name}/configurations?type=kafka-env&tag={tag-version}"
Sample resp:
{
"href" : "http://localhost:8080/api/v1/clusters/clustername/configurations?type=kafka-env&tag=version1525370182459",
"items" : [
{
"href" : "http://localhost:8080/api/v1/clusters/clustername/configurations?type=kafka-env&tag=version1525370182459",
"tag" : "version1525370182459",
"type" : "kafka-env",
"version" : 10,
"Config" : {
"cluster_name" : "clustername",
"stack_id" : "HDP-2.6"
},
"properties" : {
"content" : "\n#!/bin/bash\n\n# Set KAFKA specific environment variables here.\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}\nexport PATH=$PATH:$JAVA_HOME/bin\nexport PID_DIR={{kafka_pid_dir}}\nexport LOG_DIR={{kafka_log_dir}}\n{% if kerberos_security_enabled or kafka_other_sasl_enabled %}\nexport KAFKA_KERBEROS_PARAMS=\"-Djavax.security.auth.useSubjectCredsOnly=false {{kafka_kerberos_params}}\"\n{% else %}\nexport KAFKA_KERBEROS_PARAMS={{kafka_kerberos_params}}\n{% endif %}\n# Add kafka sink to classpath and related depenencies\nif [ -e \"/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\" ]; then\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/lib/*\nfi\nif [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then\n. /etc/kafka/conf/kafka-ranger-env.sh\nfi",
"is_supported_kafka_ranger" : "true",
"kafka_keytab" : "/etc/security/keytabs/kafka.service.keytab",
"kafka_log_dir" : "/var/log/kafka",
"kafka_pid_dir" : "/var/run/kafka",
"kafka_principal_name" : "kafka/_HOST@KDC_COLO.COM",
"kafka_user" : "kafka",
"kafka_user_nofile_limit" : "128000",
"kafka_user_nproc_limit" : "65536"
}
}
]
}
3) Copy the properties json from the above response. Append your config "export KAFKA_HEAP_OPTS="-Xms3g -Xmx3g" to the content field under properties json. New content json should look like below "content" : "\n#!/bin/bash\n\n# Set KAFKA specific environment variables here.\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}\nexport PATH=$PATH:$JAVA_HOME/bin\nexport PID_DIR={{kafka_pid_dir}}\nexport LOG_DIR={{kafka_log_dir}}\n{% if kerberos_security_enabled or kafka_other_sasl_enabled %}\nexport KAFKA_KERBEROS_PARAMS=\"-Djavax.security.auth.useSubjectCredsOnly=false {{kafka_kerberos_params}}\"\n{% else %}\nexport KAFKA_KERBEROS_PARAMS={{kafka_kerberos_params}}\n{% endif %}\n# Add kafka sink to classpath and related depenencies\nif [ -e \"/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\" ]; then\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/lib/*\nfi\nif [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then\n. /etc/kafka/conf/kafka-ranger-env.sh\nfi\nexport KAFKA_HEAP_OPTS=\"-Xms3g -Xmx3g\"" 4) Post the new config to ambari curl -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '[
{
"Clusters": {
"desired_config": [
{
"type": "kafka-env",
"tag": "unique value",
"properties": {
"content" : "\n#!/bin/bash\n\n# Set KAFKA specific environment variables here.\n\n# The java implementation to use.\nexport JAVA_HOME={{java64_home}}\nexport PATH=$PATH:$JAVA_HOME/bin\nexport PID_DIR={{kafka_pid_dir}}\nexport LOG_DIR={{kafka_log_dir}}\n{% if kerberos_security_enabled or kafka_other_sasl_enabled %}\nexport KAFKA_KERBEROS_PARAMS=\"-Djavax.security.auth.useSubjectCredsOnly=false {{kafka_kerberos_params}}\"\n{% else %}\nexport KAFKA_KERBEROS_PARAMS={{kafka_kerberos_params}}\n{% endif %}\n# Add kafka sink to classpath and related depenencies\nif [ -e \"/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\" ]; then\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/ambari-metrics-kafka-sink.jar\n export CLASSPATH=$CLASSPATH:/usr/lib/ambari-metrics-kafka-sink/lib/*\nfi\nif [ -f /etc/kafka/conf/kafka-ranger-env.sh ]; then\n. /etc/kafka/conf/kafka-ranger-env.sh\nfi\nexport KAFKA_HEAP_OPTS=\"-Xms3g -Xmx3g\"",
"is_supported_kafka_ranger": "true",
"kafka_keytab": "/etc/security/keytabs/kafka.service.keytab",
"kafka_log_dir": "/var/log/kafka",
"kafka_pid_dir": "/var/run/kafka",
"kafka_principal_name": "kafka/_HOST@KDC_COLO.COM",
"kafka_user": "kafka",
"kafka_user_nofile_limit": "128000",
"kafka_user_nproc_limit": "65536"
},
"service_config_version_note": "New config version"
}
]
}
}
]' "http://localhost:8080/api/v1/clusters/clustername" Make sure to give unique value for the tag key in the above json. Add all the properties obtained from step 3 in the above curl call and add extra config values if you need any After doing these steps, new config will be added to Kafka. Restart kafka for the changes to reflect. Reference : https://cwiki.apache.org/confluence/display/AMBARI/Modify+configurations . -Aditya
... View more
05-24-2018
12:59 PM
@Jay now I get the right values from ps -ef | grep kafka kafka 74086 1 99 12:53 ? 00:00:15 /usr/jdk64/jdk1.8.0_112/bin/java -Xms3g -Xmx3g -server now is it possible to set the value export KAFKA_HEAP_OPTS="-Xms3g -Xmx3g" by API ? * we want to automate this process by script bash
... View more
05-22-2018
07:31 PM
@Michael Bronson For the password you need to send the basic authorization header like this -H 'Authorization: Basic XXXXXXX' Following link shows how to create the header using most popular languages: https://gist.github.com/brandonmwest/a2632d0a65088a20c00a HTH
... View more
05-16-2018
08:10 PM
and about - "as well the zookeeper data" , how to do this?
... View more
05-14-2018
08:12 PM
meenwhile we only move the index files and start the kafka , what you think about ?
... View more
05-13-2018
06:29 PM
@Michael Bronson You may want to check the logs(server.log) when kafka process stops before changing any existing configs.
... View more