Reputation: 24606
I'm trying to delete a service that failed to install correctly so that I can attempt to reinstall it.
I couldn't find any options for deleting in the ambari UI so I'm trying to delete using the API. However, I hit an error message:
curl -u admin:admin -H 'X-Requested-By:ambari' -X DELETE \
'http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK'
{
"status" : 500,
"message" : "org.apache.ambari.server.controller.spi.SystemException:
An internal system exception occurred: Cannot remove SPARK.
Desired state STARTED is not removable.
Service must be stopped or disabled."
}
I'm using the dockerised version of IBM Open Platform v4, i.e. IOP_v4000_20150.zip
The ambari version is:
[root@rvm /]# ambari-server --version
1.7.0_IBM
Below is the output from the GET command:
curl -u admin:admin -H 'X-Requested-By:ambari' -X GET \
'http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK'
{
"href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK",
"ServiceInfo" : {
"cluster_name" : "BI4_QSE",
"maintenance_state" : "OFF",
"service_name" : "SPARK",
"state" : "INSTALLED"
},
"components" : [
{
"href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_CLIENT",
"ServiceComponentInfo" : {
"cluster_name" : "BI4_QSE",
"component_name" : "SPARK_CLIENT",
"service_name" : "SPARK"
}
},
{
"href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_JOBHISTORYSERVER",
"ServiceComponentInfo" : {
"cluster_name" : "BI4_QSE",
"component_name" : "SPARK_JOBHISTORYSERVER",
"service_name" : "SPARK"
}
},
{
"href" : "http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_THRIFTSERVER",
"ServiceComponentInfo" : {
"cluster_name" : "BI4_QSE",
"component_name" : "SPARK_THRIFTSERVER",
"service_name" : "SPARK"
}
}
]
}
Question: how can I delete and reinstall spark?
Upvotes: 1
Views: 3031
Reputation: 1637
You should be able to run the following sequence of commands to stop and then remove SPARK.
The following command will set state to INSTALLED, aka ensure its not RUNNING.
curl -i -H "X-Requested-By: ambari" -u admin:admin -X PUT \
-d '{"RequestInfo":{"context":"Stop Service"},"Body":{"ServiceInfo":{"state":"INSTALLED"}}}' \
http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK
The next few commands will ensure each component is stopped.
curl -i -H "X-Requested-By: ambari" -u admin:admin -X PUT \
-d '{"RequestInfo":{"context":"Stop All Components"},"Body":{"ServiceComponentInfo":{"state":"INSTALLED"}}}' \
http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_THRIFTSERVER
curl -i -H "X-Requested-By: ambari" -u admin:admin -X PUT \
-d '{"RequestInfo":{"context":"Stop All Components"},"Body":{"ServiceComponentInfo":{"state":"INSTALLED"}}}' \
http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK/components/SPARK_JOBHISTORYSERVER
Finally you can remove the service by executing the following command:
curl -i -H "X-Requested-By: ambari" -u admin:admin -X DELETE \
http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK
You can then reinstall SPARK using the 'Add Service' wizard in Ambari UI.
Upvotes: 5