Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created on
12-07-2019
12:19 PM
- last edited on
12-07-2019
08:42 PM
by
ask_bill_brooks
hi all
we have 5 kafka brokers
we can stop or start the kafka service by API
but how to stop specific kafka broker by REST API?
for example , in this pic we can see 5 kafka brokers , and we want to stop/start only the second kafka broker by REST API
Created 12-08-2019 12:37 PM
@mike_bronson7
1. You can get the List of KAFKA Broker Hosts (hostnames) using the following API call.
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET http://$AMBARI_HOST:8080/api/v1/clusters/TestCluster/services/KAFKA/components/KAFKA_BROKER?fields=host_components/HostRoles/host_name
2. Once you know/decide the Hostname (For example: 'kafkabroker5.example.com') in which you want to stop/start the Kafka Broker then you can try the following:
.
A. To Stop Kafka Broker on Host 'kafkabroker5.example.com'
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Kafka Broker","operation_level":{"level":"HOST_COMPONENT","cluster_name":"TestCluster","host_name":"kafkabroker5.example.com","service_name":"KAFKA"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/TestCluster/hosts/kafkabroker5.example.com/host_components/KAFKA_BROKER.
B. To Start Kafka Broker on Host 'kafkabroker5.example.com'
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Start Kafka Broker","operation_level":{"level":"HOST_COMPONENT","cluster_name":"TestCluster","host_name":"kafkabroker5.example.com","service_name":"KAFKA"}},"Body":{"HostRoles":{"state":"STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/TestCluster/hosts/kafkabroker5.example.com/host_components/KAFKA_BROKER
.
Created 12-08-2019 12:37 PM
@mike_bronson7
1. You can get the List of KAFKA Broker Hosts (hostnames) using the following API call.
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X GET http://$AMBARI_HOST:8080/api/v1/clusters/TestCluster/services/KAFKA/components/KAFKA_BROKER?fields=host_components/HostRoles/host_name
2. Once you know/decide the Hostname (For example: 'kafkabroker5.example.com') in which you want to stop/start the Kafka Broker then you can try the following:
.
A. To Stop Kafka Broker on Host 'kafkabroker5.example.com'
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Stop Kafka Broker","operation_level":{"level":"HOST_COMPONENT","cluster_name":"TestCluster","host_name":"kafkabroker5.example.com","service_name":"KAFKA"}},"Body":{"HostRoles":{"state":"INSTALLED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/TestCluster/hosts/kafkabroker5.example.com/host_components/KAFKA_BROKER.
B. To Start Kafka Broker on Host 'kafkabroker5.example.com'
# curl -iv -u admin:admin -H "X-Requested-By: ambari" -X PUT -d '{"RequestInfo":{"context":"Start Kafka Broker","operation_level":{"level":"HOST_COMPONENT","cluster_name":"TestCluster","host_name":"kafkabroker5.example.com","service_name":"KAFKA"}},"Body":{"HostRoles":{"state":"STARTED"}}}' http://$AMBARI_HOST:8080/api/v1/clusters/TestCluster/hosts/kafkabroker5.example.com/host_components/KAFKA_BROKER
.