Introducing the command line for your datacenter

Sep 02, 2014

Thomas Rampelberg


3 min read

The command line interface (CLI) has always been the essential tool for operating in a server environment. Type a command. Get a result. Pipe that result into another command. It's the fastest way to work with your servers and applications interactively.
But for Mesos users, the traditional Linux CLI has been hamstrung by its attachment to individual machines. Modern applications on Mesos do not run on a single machine; they are distributed systems, composed of interconnected services running across the entire datacenter. This means developers and operators need to think about applications at datacenter scale, and their their tools, also, need to operate at datacenter scale. So: Where does that leave the CLI?
Today we're happy to announce a new and greatly enhanced version of the Mesos CLI built by Mesosphere as open source that is being contributed back to the Apache Mesos project. The new Mesos CLI operates inside your Linux shell and its commands mirror the simplicity and command structure of the Linux CLI, but extends it to operate beyond a single machine. Install the Mesos CLI extensions, and the CLI tool you use every day will now know about your entire Mesos cluster.
Getting started
Installing the Mesos CLI extensions couldn't be simpler. Simply run this command:
pip install mesos.cli
When the pip install finishes, you now have a new set of commands in your CLI, all invoked with the mesos prefix. These Mesos commands understand and express the layers of abstraction in Mesos. They understand how tasks run across many machines and they are aware of Mesos-specific details, such as all of your Mesos applications and task names - complete with tab-autocomplete to save you typing.
The Mesos Commands Will be Familiar
Many of the commands in the Mesos CLI extension will be immediately recognized by Linux developers, as they map directly to familiar Linux commands. For example, mesos tail and mesos find do pretty much what you would expect from tail and find, only the Mesos versions, rather than running on a single machine, now operate at the level of the the entire datacenter.
Some Examples to Try
So let's jump right into some example commands you can run.
Instead of tailing a single file, you should be able to tail every file you are interested in, anywhere in your datacenter. Let's say that you are running an application with Marathon. You're working at debugging a problem and would like to see the stdout for every instance of this application. Now, you can!
mesos tail -f app-name
There are all kinds of events occurring throughout the Mesos cluster. One way to keep track of this would be to ssh into every master and slave. For those who are lazy (like me), you can run a single command.
mesos events
When developing an application on my laptop, it is important to know whether the app is actually running or not. There's no reason to be limited to just your laptop with Mesos! Why not see everything that is running, everywhere in your datacenter!
mesos ps
For more details and an in-depth list of commands, check out the mesos-cli project.

Ready to get started?