使用 ambari 删除服务时出错
Error deleting service using ambari
我正在尝试删除未能正确安装的服务,以便我可以尝试重新安装它。
我在 ambari UI 中找不到任何删除选项,所以我尝试使用 API 删除。但是,我遇到了一条错误消息:
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."
}
我正在使用 IBM Open Platform v4 的 docker 化版本,即 IOP_v4000_20150.zip
ambari 版本是:
[root@rvm /]# ambari-server --version
1.7.0_IBM
下面是 GET 命令的输出:
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"
}
}
]
}
问题:如何删除并重新安装spark?
您应该能够运行以下命令序列来停止然后删除 SPARK。
以下命令会将状态设置为已安装,也就是确保它不是 运行。
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
接下来的几个命令将确保每个组件都停止。
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
最后您可以通过执行以下命令来删除该服务:
curl -i -H "X-Requested-By: ambari" -u admin:admin -X DELETE \
http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK
然后您可以在 Ambari UI 中使用 'Add Service' 向导重新安装 SPARK。
我正在尝试删除未能正确安装的服务,以便我可以尝试重新安装它。
我在 ambari UI 中找不到任何删除选项,所以我尝试使用 API 删除。但是,我遇到了一条错误消息:
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."
}
我正在使用 IBM Open Platform v4 的 docker 化版本,即 IOP_v4000_20150.zip
ambari 版本是:
[root@rvm /]# ambari-server --version
1.7.0_IBM
下面是 GET 命令的输出:
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"
}
}
]
}
问题:如何删除并重新安装spark?
您应该能够运行以下命令序列来停止然后删除 SPARK。
以下命令会将状态设置为已安装,也就是确保它不是 运行。
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
接下来的几个命令将确保每个组件都停止。
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
最后您可以通过执行以下命令来删除该服务:
curl -i -H "X-Requested-By: ambari" -u admin:admin -X DELETE \
http://localhost:8080/api/v1/clusters/BI4_QSE/services/SPARK
然后您可以在 Ambari UI 中使用 'Add Service' 向导重新安装 SPARK。