9

I have a Mesos cluster and was running a Spark shell connected to it. I shut down the client, but Mesos still believes the framework should be active.

I am trying to have Mesos drop the framework by using DELETE with curl (https://issues.apache.org/jira/browse/MESOS-1390)

but I am getting no response from the server. Also, I am not sure how exactly to connect to the master: I have a multi-master setup managed by ZooKeeper, and I was trying to connect just to the active master:

curl -X DELETE http://<active master url>:5050/framworks/<framework id>

Can anyone verify if the above is the correct request? I am using mesos-0.20.0.

Thanks

Aaron
  • 442
  • 1
  • 5
  • 14

5 Answers5

21

There is a restfull option calling by post the url http://your_mesos:5050/master/teardown passing frameworkId parameter

curl -d@/tmp/post.txt -X POST http://your_mesos:5050/master/teardown

/tmp/post.txt is a file with the follow content:

frameworkId=23423-23423-234234-234234

I know is late but for future askers

EDIT: The endpoint is now called teardown.
Example (thanks @Jeff): curl -X POST http://your_mesos:5050/master/teardown -d 'frameworkId=23423-23423-234234-234234'

Nico Villanueva
  • 876
  • 8
  • 22
Montells
  • 6,389
  • 4
  • 48
  • 53
18

Just to keep this up to date: The master endpoint was renamed to teardown i.e. http://localhost:5050/master/teardown is the new way to go.

TEARDOWN Request (JSON):

POST /master/teardown HTTP/1.1
Host: masterhost:5050
Content-Type: application/json
frameworkId=12220-3440-12532-2345

TEARDOWN Response:

HTTP/1.1 200 Ok
js84
  • 3,676
  • 2
  • 19
  • 23
  • so should I write the suggested curl command as : curl -d@/tmp/post.txt -X POST http://localhost:5050/master/teardown ? – CruncherBigData Aug 20 '15 at 23:50
  • 1
    @CruncherBigData yes, just replace `shutdown` with `teardown`. By the way, you can write `-d 'frameworkId=#'` instead of using file. – solomkinmv Feb 29 '16 at 12:34
  • `curl -H "Content-Type: application/json" -X POST -d 'frameworkId=547d0f00-b084-4b5c-bd1b-5ea6c5f8abd1-0000' -v -L http://localhost:5050/teardown` (/master/teardown and /teardown are the same thing) – KarlKFI Feb 04 '17 at 01:37
5

Riffing on @montells work, a one-liner would be

echo "frameworkId= 23423-23423-234234-234234" | curl -d@- -X POST http://localhost:5050/master/shutdown
Brian Topping
  • 3,235
  • 28
  • 33
  • Anyone know where the API is documented? I haven't found it yet. Also, with Mesos 0.23+, /master/teardown is the new path as /master/shutdown is being deprecated. https://issues.apache.org/jira/browse/MESOS-2697 – codecraig Aug 03 '15 at 17:23
  • http api can be tracked via this ticket: https://issues.apache.org/jira/browse/MESOS-2289 – codecraig Aug 03 '15 at 17:28
  • Be careful of having a space in front of the ID. The space has caused me problems in the past – Peter Klipfel Mar 03 '16 at 00:41
3

Even though that JIRA issue mentions DELETE (in comments) it's not how framework shutdown is implemented. You need to do a POST request to /shutdown endpoint.

Examples: https://github.com/apache/mesos/blob/master/src/tests/teardown_tests.cpp

Regarding why the spark framework is not removed after you shutdown the client, I'm guessing it is because spark uses a high failover timeout? Nonetheless, I'm surprised that Mesos UI shows it as active instead of inactive.

Adam
  • 4,322
  • 1
  • 16
  • 22
vinodkone
  • 2,731
  • 4
  • 22
  • 21
3

Add this in your .bashrc:

#Mesos
killtask(){ curl -XPOST http://mesos_url:5050/master/teardown -d 'frameworkId='$@''; } ;

Sample usage:

killtask 123
Federico Ponzi
  • 2,682
  • 4
  • 34
  • 60