【问题标题】:How to remove orphaned tasks in Apache Mesos?如何删除 Apache Mesos 中的孤立任务?
【发布时间】:2017-02-27 03:14:18
【问题描述】:

这个问题可能是由 Mesos 和 Marathon out of sync 引起的,但是 GitHub 上提到的解决方案对我不起作用。

当我发现孤儿任务时:

我做的是:

  1. 重启马拉松

  2. Marathon 不会同步孤立任务,而是启动新任务。

  3. 孤立的任务仍然占用资源,所以我必须删除它们。

  4. 我找到了框架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"
        ]
    }
    
  5. 尝试通过框架ID删除框架(这样框架下的任务也会被删除)

    curl -XPOST http://c196:5050/master/teardown -d 'frameworkId=ef169d8a-24fc-41d1-8b0d-c67718937a48-0000'
    

    但是得到No framework found with specified ID

那么,如何删除孤立的任务?

【问题讨论】:

    标签: mesos marathon


    【解决方案1】:

    有两种选择

    1. 使用相同的框架 id 注册框架。进行和解并杀死您收到的所有任务。例如,您可以通过以下方式进行操作

      • 下载代码git clone https://github.com/janisz/mesos-cookbook.git
      • 更改目录cd mesos-cookbook/4_understanding_frameworks
      • scheduler.go 中更改您的 URL 的 master
      • 如果您想模仿其他一些框架,请创建 /tmp/framework.json 并用 FrameworkInfo 数据填充它:

        {
          "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

      • 获取所有任务列表curl localhost:9090
      • 使用 curl -X DELETE "http://10.10.10.10:9090/?id=task_id" 删除任务
    2. 等到failover_timeout,Mesos 将为您删除此任务。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2010-10-20
      • 2016-07-08
      • 1970-01-01
      • 2011-07-18
      • 2021-08-10
      • 2016-07-10
      • 1970-01-01
      相关资源
      最近更新 更多