• Stars
    star
    116
  • Rank 303,894 (Top 6 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 10 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

This project has been deprecated. Please use the DC/OS CLI.

mesos-cli

This project has been deprecated and is no longer being actively maintained. Please use the DC/OS CLI.

CLI tools to work with mesos.

What problem does this solve?

I am comfortable debugging programs from the command line. I have a set of tools that I use from coreutils that end up being used every day. A day doesn't go by when I've not used grep, find, or cat.

While mesos allows you to treat all the nodes in your data center as anonymous resources, debugging still needs to be done on specific hosts. Currently, it requires multiple tools and context switches to gather the pieces that you need to look at what a specific task is doing. Most of these existing tools don't work well with the command line and I'm unable to use the workflow that I've become comfortable with.

How is the problem solved?

To solve the problem, some of the coreutil commands have been re-implemented to work across the entire data center instead of a single host.

  • commands and options have been copied as closely as it makes sense. They should have the same options that you're used to.
  • pipe works the way you'd expect it to. You should be able to replace most host specific debug scripts easily.
  • mesos itself isn't required locally. Developers want to debug their tasks without having a local copy of mesos installed.
  • everything is task centric. There's no need to worry about specifying a framework if you don't want to, just put in the task id.
  • lazy matching. Task IDs are long and normally require cut/paste to get exact matches. Instead, all task parameters are partial matches, no need to type that long thing in.
  • auto-complete. Most parameters tab-complete (see the section on auto-completion to configure), just type a couple characters in and get what you're looking for.
  • extensibility. Write your own subcommands. Most of the required information can be accessed via. existing subcommands (leading master resolution via. mesos-resolve), so you only need to implement what you want and not re-invent the wheel.

Install

Note that if you've already installed mesos locally, you can either install this to a location other than /usr/local/bin via. pip options or remove /usr/local/bin/mesos. There should be no downsides to just removing it.

From PyPI:

pip install mesos.cli

From this repo:

python setup.py install

Create Environment

make env
source env/bin/activate

Build

python setup.py build

Test

make test

Command Completion

Task IDs? File names? Complete all the things! Configure command completion and you'll be able to tab complete most everything.

BASH

Add the following to your startup scripts:

complete -C mesos-completion mesos

ZSH

Add the following to your .zshrc:

source mesos-zsh-completion.sh

Note that bashcompinit is being used. If you're running an older version of ZSH, it won't work. Take a look at bin/mesos-zsh-completion.sh for information.

Configuration

Place a configuration file at any of the following:

./.mesos.json
~/.mesos.json
/etc/.mesos.json
/usr/etc/.mesos.json
/usr/local/etc/.mesos.json

You can override the location of this config via. MESOS_CLI_CONFIG.

If you're using a non-local master, you'll need to configure where the master should be found like so:

mesos config master zk://localhost:2181/mesos

Alternatively, you can create the config file yourself.

{
    "profile": "default",
    "default": {
        "master": "zk://localhost:2181/mesos",
        "log_level": "warning",
        "log_file": "/tmp/mesos-cli.log"
    }
}

Note that master accepts all values that mesos normally does, eg:

localhost:5050
zk://localhost:2181/mesos
file:///path/to/config/above

Profiles

Want to access multiple mesos clusters without changing config? You're in luck!

To change your profile, you can run:

mesos config profile new-profile

The old config will be maintained and can be switched back to at any point.

Config Options

{
    // Show stack traces on keyboard interrupt
    "debug": "false",

    // Path to where you'd like the log file
    "log_file": None,

    // Log level to use.
    "log_level": "warning",

    // Location of your master, this can be any of the values that mesos
    // supports which includes the following:
    //     localhost:5050
    //     zk://localhost:2181/mesos
    //     file:///path/to/config
    "master": "localhost:5050",

    // Scheme to use when connecting to mesos, can be either http or https
    "scheme": "http"
}

Commands

All commands have their own options and parameters. Make sure you run mesos [command] --help to get the potential options.

Most commands take a task-id as parameter. This does not need to be an exact match and for commands where it makes sense, can match multiple tasks. Suppose your cluster is running the following tasks:

hadoop.myjob.12345-1928731

rails.48271236-1231234

app-10.89934ht-2398hriwuher

app-20.9845uih-9823hriu-2938u422

  • A task-id of app will match both app-10 and app-20.
  • A task-id of myjob will only match the hadoop task.
  • A task-id of 1231234 will only match the rails task.

cat

mesos cat task-id file [file]

events

mesos events

observe events from the cluster. You will see the events occurring on the master and all slaves in the cluster (including new slaves as they arrive) as they occur.

find

mesos find task-id [path]

When multiple tasks match task-id, headers will be printed between their results.

head

mesos head -n 10 task-id file [file]

ls

mesos ls task-id [path]

The default view is ls -la. When multiple tasks match task-id, headers will be printed between their results.

ps

mesos ps

Output time, memory, cpu, command, user and slave/task_id information for currently running tasks.

scp

mesos scp file [file ...] remote_path

Upload local file(s) to the remote_path on every slave. Note that you will need to have SSH access to every slave you'd like to upload to.

ssh

mesos ssh task-id

This will SSH into the sandbox of the specified task on the slave that it is running on. Note that you need to have SSH access to this slave/sandbox.

tail

mesos tail -n 10 task-id file [file]

This also implements follow. Unlike normal tail, it will look for tasks/files being created on your mesos cluster and begin to follow those files as they are written to. You can start tail in --follow mode and then launch your tasks to watch everything has it happens.

Adding Commands

Commands are all separate scripts. The mesos script inspects your path and looks for everything that starts with mesos-. To add a new command, just name the script mesos-new-name and you'll have a new command. This makes it possible to write new sub-commands in whatever language you'd like.

There are some utils that are nice to have when you're doing a new command. While all of them are available in python via. this package, a subset is available via. existing commands. This allows you to focus on the new functionality you'd like in your command (in the language you're comfortable with).

config

mesos config [key] [value]

Output a json object containing all the mesos-cli config or you can get/set specific values in the configuration.

resolve

mesos resolve [master-config]

Take either the existing configured master or the one passed on the command line and discover where the leading master is. You'll be able to use the following format:

localhost:5050
zk://localhost:2181/mesos
file:///path/to/config/above

state

mesos state [slave-id]

Return the full JSON state of either the master or slave (partial matches are valid).

Testing

There are two ways to do testing. If you'd like to just test with your local setup:

python setup.py nosetests

For a full virtualenv + specific python versions (py26, py27), you can use tox:

tox

More Repositories

1

minuteman

[Deprecated] A distributed Load Balancer
632
star
2

dcos-vagrant

Local DC/OS cluster provisioning
Shell
541
star
3

deimos

Mesos containerizer hooks for Docker
Python
249
star
4

cassandra-mesos-deprecated

[DEPRECATED] This project is deprecated. It will be archived on December 1, 2017.
Java
185
star
5

docker-containers

Dockerfiles and assets for building Docker containers
Shell
175
star
6

aws-cli

Containerized AWS CLI on alpine to avoid requiring the aws cli to be installed on CI machines.
Shell
164
star
7

dcos-docker

DEPRECATED - Run DC/OS in Docker containers
Shell
159
star
8

dcos-cassandra-service

DEPRECATED—Open source Apache Cassandra running on DC/OS is now replaced by mesosphere/dcos-commons/frameworks/cassandra. This repository will be deleted at the end of 2017.
Java
116
star
9

dcos-docs

Documentation for DC/OS
HTML
95
star
10

elasticsearch-mesos

Elastic Search on Mesos
Scala
85
star
11

mesos-framework-tutorial

How to create a Mesos Framework in Go
Go
80
star
12

etcd-mesos

self-healing etcd on mesos!
Go
67
star
13

presentations

Slide decks from presentations given around the world.
CSS
67
star
14

iot-demo

IoT - It's the thing you want! And so here's a full-stack demo.
Scala
63
star
15

time-series-demo

A DC/OS time series demo
Scala
62
star
16

terraform-dcos

DC/OS Terraform Installation and Upgrading Scripts
HCL
62
star
17

sssp

S3 Proxy Mesos Framework
Scala
61
star
18

training

Mesosphere Training
Shell
60
star
19

dcos-metrics

The metrics pipeline for DC/OS 1.9-1.11
C++
58
star
20

spartan

[Deprecated] DNS Dispatcher: An RFC5625 Compliant DNS Forwarder
47
star
21

ansible-dcos

[DEPRECATED] Please consider using the Ansible Roles for DC/OS maintained by the Mesosphere SRE team
Python
37
star
22

dcos-gce

Ansible script to install DC/OS on Google Compute Engine
Python
30
star
23

mesos-hydra

MPICH2 Hydra scheduler for Apache Mesos.
Python
29
star
24

packet-terraform

Terraform scripts for packet.net
HCL
28
star
25

tweeter-go

Mini twitter clone - Demo application for DC/OS
Go
28
star
26

dcos-jenkins-dind-agent

Jenkins Docker-in-Docker agent
Shell
27
star
27

dcos-bootstrap

Install DC/OS on AWS using a single command
Python
25
star
28

navstar01

[Deprecated] Navstar orchestrates virtual overlay networks using VXLAN.
21
star
29

open-docs

[DEPRECATED] Documentation for Mesosphere supported open source projects.
HTML
20
star
30

multiverse

Experimental packages not ready to be in mesosphere/universe
Python
19
star
31

k8s-bootcamp

Kubernetes Training Bootcamp
CSS
18
star
32

cassandra-kairosdb-tutorial

GitHub stream data demo using KairosDB with Cassandra
Python
17
star
33

dcos-installer-ui-01

JavaScript
17
star
34

dcos-zeppelin

DCOS Zeppelin package
HTML
16
star
35

telemetry-net

Erlang
14
star
36

tf_dcos_core

A Terraform module to install, upgrade, and modify nodes for DC/OS clusters.
Shell
13
star
37

dcos-signal-01

A passive data forwarding service for telemetry and analytics gathering of DC/OS clusters.
Go
13
star
38

dcos-windows

Microsoft Windows support to DCOS
C++
12
star
39

mesos-slave-dind

Mesos Slave with Docker-in-Docker
Shell
12
star
40

community

DC/OS community content
11
star
41

3dt-01

Go
11
star
42

aws-cfn-bootstrap

Track the progress of DCOS launches on AWS
Python
11
star
43

dcos-kubectl

Command line tooling for Kubernetes on DCOS
Python
10
star
44

dcos-cli-docker

DCOS CLI in a Docker Container
Shell
10
star
45

velocity-training

Velocity NYC 2015 training session
Shell
10
star
46

stellar

Light-weight monitoring for DCOS
Python
9
star
47

dcos-tunnel

Python
8
star
48

mesos-overlay-modules

C++
8
star
49

secure-mesos-workshop

MesosCon 2017 workshop material.
Shell
8
star
50

mockserver

A mockserver that allows you to mock XHR, long-polling XHR, server sent events and websocket connections
TypeScript
8
star
51

kubeaddons-configs

DEPRECATED: konvoy addons (see https://github.com/mesosphere/kubernetes-base-addons instead)
Go
7
star
52

service-net

Discovery and routing for location-agnostic services.
Scala
7
star
53

fuzzlr

go-fuzz on Mesos!
Go
6
star
54

MongoDB-01

MongoDB Framework
Go
6
star
55

dcos-management

[WIP] additional subcommands to DC/OS CLI to manage mesos cluster (maintenance, etc.)
Python
6
star
56

dispatch

Execute scripts on your mesos cluster
Python
6
star
57

mesosphere-shared-reactjs

JavaScript
5
star
58

mesos-client

Wraps Mesos Event Stream API into rxjs Observable.
JavaScript
5
star
59

mesos-buildenv-01

Build environment for Mesos allowing builds of Mesos Modules with the same dependencies
Makefile
5
star
60

dcos-swarm

DCOS Swarm CLI
Python
5
star
61

octarine

Go
5
star
62

oscon-smack-stack

Labs for the SMACK Stack workshop at OSCON 2018
Shell
5
star
63

tutorial-artefacts

This repository is for hosting of additional artefacts from DC/OS tutorials hosted on the dcos.io website
Shell
5
star
64

redir

HTTP redirector of DNS SRV records with configurable load-balancing strategies.
Go
5
star
65

software-architecture

Software Architecture Tutorial
5
star
66

charts

Mesosphere Kubernetes-a-a-S Helm charts repository
Smarty
5
star
67

opstools

A collection of tools for DC/OS operators
4
star
68

oscon-mesos-2014

4
star
69

godep-licenses

Godep dependency license report generation tool
Shell
4
star
70

vny

Velocity New York Tutorial Files
4
star
71

boot2dcos

Shell
4
star
72

presentations-community

Slide decks from presentations by/with community partners
CSS
4
star
73

edge-proxy

nginx based reverse proxy for auth and SSL termination
Shell
3
star
74

hue

Hue ported to DCOS
3
star
75

helloworld

Go
3
star
76

dcos-cli-vpn

Shell
3
star
77

connection-manager

Allows to manage connections inside the browser and order them in a queue by priority.
JavaScript
3
star
78

packaging-docs

Documentation for the DC/OS Packaging Subsystem
Shell
3
star
79

kafka-service

For packaging Kafka and deploying with Ubuntu
Shell
3
star
80

edgelb-kubernetes

Kubernetes controller for Edge-LB for easy L4 (Service) and L7 (Ingress) apps load-balancing.
Go
3
star
81

recordio

Provides a function to read records in the RecordIO format from the input string.
JavaScript
3
star
82

dcos-debugging

Go
3
star
83

nifi-containers

Shell
2
star
84

qcon

2
star
85

hackers-at-berkeley

Example files for H@B workshop.
Python
2
star
86

gists

General Store for all gists in order to allow for easier shared editing.
2
star
87

data-service

The foundation for all data access within DC/OS UI
TypeScript
2
star
88

logstash-pkg

Package Logstash. For great justice.
Shell
2
star
89

dcos-test-utils

DEPRECATED: Please use https://github.com/dcos/dcos-test-utils
2
star
90

http-service

Wraps connections managed by the `@dcos/connection-manager` package into an Observable.
JavaScript
2
star
91

reactjs-mixin-01

JavaScript
2
star
92

dcos-ui-common

JavaScript
2
star
93

weave-guide

Guide for installing Weave onto DC/OS - Experimental
2
star
94

oinker-bot

A simple bot that Oinks
Scala
2
star
95

teamcity-slack-notifier

A python script that when run in TeamCity will post alerts to a Slack Channel
Python
2
star
96

extension-kid

👶 UI tool set for DI powered plugin system
TypeScript
2
star
97

less-color-lighten

A LESS plugin for a simple function that blends a given color with white or black to produce a new color that observes the same general hue as the source color
JavaScript
2
star
98

moxy-docker

2
star
99

connections

Provides different connection types with a unified interface
JavaScript
2
star
100

dcsh

#!/usr/local/bin/dcsh > #!/bin/bash
Python
2
star