如何在Apache Mesos中删除孤立的任务? [英] How to remove orphaned tasks in Apache Mesos?
问题描述
问题可能是由Mesos和Marathon 不同步引起的,但是解决方案提到了在GitHub上对我不起作用.
The problem maybe caused by Mesos and Marathon out of sync, but the solution mentioned on GitHub doesn't work for me.
当我找到孤立的任务时:
When I found the orphaned tasks:
我要做的是:
-
重新启动马拉松
restart Marathon
Marathon不会同步孤立的任务,但会启动新任务.
Marathon does not sync orphaned tasks, but start new tasks.
孤立任务仍然占用了资源,因此我必须删除它们.
Orphaned tasks still took the resources, so I have to delete them.
我在框架ef169d8a-24fc-41d1-8b0d-c67718937a48-0000
下找到了所有孤立任务,
I find all orphaned tasks under framework ef169d8a-24fc-41d1-8b0d-c67718937a48-0000
,
curl -XGET `http://c196:5050/master/frameworks
显示框架为unregistered_frameworks
:
{
"frameworks": [
.....
],
"completed_frameworks": [ ],
"unregistered_frameworks": [
"ef169d8a-24fc-41d1-8b0d-c67718937a48-0000",
"ef169d8a-24fc-41d1-8b0d-c67718937a48-0000",
"ef169d8a-24fc-41d1-8b0d-c67718937a48-0000"
]
}
尝试按框架ID删除框架(以便也删除框架下的任务)
Try to delete framework by framework ID (so that the tasks under framework would be delete too)
curl -XPOST http://c196:5050/master/teardown -d 'frameworkId=ef169d8a-24fc-41d1-8b0d-c67718937a48-0000'
但是得到No framework found with specified ID
那么,如何删除孤立的任务?
So, how to delete orphaned tasks?
推荐答案
有两个选项
-
使用相同的框架ID注册框架.做和解并杀死您收到的所有任务.例如,您可以按照以下方式进行操作
Register framework with same framework id. Do reconciliation and kill all tasks you receive. For example you can do it in following manner
- 下载代码
git clone https://github.com/janisz/mesos-cookbook.git
- 更改目录
cd mesos-cookbook/4_understanding_frameworks
- 在
scheduler.go
中,为您的URL更改主域名
- Download the code
git clone https://github.com/janisz/mesos-cookbook.git
- Change dir
cd mesos-cookbook/4_understanding_frameworks
- In
scheduler.go
change master for your URL If you want to mimic some other framework create
/tmp/framework.json
and fill it withFrameworkInfo
data:
{
"id": "<mesos-framewokr-id>",
"user": "<framework-user>",
"name": "<framework-name>",
"failover_timeout": 3600,
"checkpoint": true,
"hostname": "<hostname>",
"webui_url": "<framework-web-ui>"
}
运行go run scheduler.go scheduler.pb.go mesos.pb.go
等到failover_timeout
,以便Mesos会为您删除此任务.
Wait until failover_timeout
so Mesos will delete this tasks for you.
这篇关于如何在Apache Mesos中删除孤立的任务?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!