Apache Storm
Killing the Storm topology
Once we submit the storm topology to the Cluster,if it's required to kill it we can use below command.
>storm kill {TopologyName}
Eg:
1.>storm kill SampleTopology
2.>storm kill StormTopology
The above topology names are in a single word.If we click on it in UI page ,it will take you to the navigation page.
If suppose the topology names are contain multiple words with spaces,then the above command will not work.
1.>storm kill Sample Topology
(This topology will not able to kill It throws an RunTimeException saying :"Exception in thread "main" NotAliveException(msg:SampleStorm is not alive)" )
So for this we need to write a seperate java program to kill it.
java Program for Killing the Storm Topology names contain Spaces.
Program:
package com.storm.killing_topology;
import java.util.*;
import org.apache.thrift7.TException;
import backtype.storm.generated.KillOptions;
import backtype.storm.generated.Nimbus.Client;
import backtype.storm.generated.NotAliveException;
import backtype.storm.utils.NimbusClient;
import backtype.storm.utils.Utils;
public class KillingTopo1ogy {
public static void main(String[] args) throws NotAliveException, TException {
Map conf = Utils.readStormConfig();
Client client = NimbusClient.getConfiguredClient(conf).getClient();
KillOptions killOpts = new KillOptions();
//killOpts.set_wait_secs(waitSeconds) // time to wait before killing
client.killTopologyWithOpts(" Topology Name", killOpts) ;//provide topology name
}
}
here in place of the "Topology Name " in Quotes we can provide the topology names which can have spaces in their names.
Then Execute the above program by using below command.
>storm jar SampleStorm.jar com.storm.killing_topology.KillingTopo1ogy
Killing the Storm topology
Once we submit the storm topology to the Cluster,if it's required to kill it we can use below command.
>storm kill {TopologyName}
Eg:
1.>storm kill SampleTopology
2.>storm kill StormTopology
The above topology names are in a single word.If we click on it in UI page ,it will take you to the navigation page.
If suppose the topology names are contain multiple words with spaces,then the above command will not work.
1.>storm kill Sample Topology
(This topology will not able to kill It throws an RunTimeException saying :"Exception in thread "main" NotAliveException(msg:SampleStorm is not alive)" )
So for this we need to write a seperate java program to kill it.
java Program for Killing the Storm Topology names contain Spaces.
Program:
package com.storm.killing_topology;
import java.util.*;
import org.apache.thrift7.TException;
import backtype.storm.generated.KillOptions;
import backtype.storm.generated.Nimbus.Client;
import backtype.storm.generated.NotAliveException;
import backtype.storm.utils.NimbusClient;
import backtype.storm.utils.Utils;
public class KillingTopo1ogy {
public static void main(String[] args) throws NotAliveException, TException {
Map conf = Utils.readStormConfig();
Client client = NimbusClient.getConfiguredClient(conf).getClient();
KillOptions killOpts = new KillOptions();
//killOpts.set_wait_secs(waitSeconds) // time to wait before killing
client.killTopologyWithOpts(" Topology Name", killOpts) ;//provide topology name
}
}
here in place of the "Topology Name " in Quotes we can provide the topology names which can have spaces in their names.
Then Execute the above program by using below command.
>storm jar SampleStorm.jar com.storm.killing_topology.KillingTopo1ogy