Kibana framework for Mesos.
This uses the Mesos-Framework project. The framework is generic and only becomes a Kibana framework with the correct configuration.
(Features come from the upstream Mesos-Framework and Mesos-Starter projects)
- State stored in ZooKeeper
- Mesos Authorisation
- ZooKeeper Authorisation (should work, requires testing)
- Live horizontal scaling via REST endpoint
- Jar mode (no docker)
- Resource specification (including port)
- Import Kibana.yml settings file
- "Spread" orchestration strategy (Spreads instances across distinct hosts)
- Decoupled from Kibana. Use any version.
- Decoupled from Mesos. Use any version 0.25+.
- Single endpoint to check health of all instances
To start the kibana framework, simply start the mesosframework binary or docker container with a properties file containing your settings.
First install minimesos, then run:
minimesos up --num-agents 3
export MINIMESOS_MARATHON=http://192.168.99.100:8080
docker run -d elasticsearch:latest
curl -sS -o marathon.json https://raw.githubusercontent.com/mesos/kibana/master/manual-tests/marathon-minimesos-docker.json ; curl -XPOST -H 'Content-Type:application/json' -d @marathon.json $MINIMESOS_MARATHON/v2/apps
This will start a cluster of Kibana instances running on your local machine connecting to a static elasticsearch instance. Please check out the Elasticsearch framework if you are interested in running Elasticsearch.
If you want to run on your own cluster, you will probably want to customize the installation using a properties file, rather than in the marathon file itself. This marathon file will ask Mesos to download the properties file from a url. First export the locations of your master and first slave, then run these commands:
export MASTER=${master ip address}
export SLAVE0=${elasticsearch ip address - see json file}
curl -sS -o marathon.json https://raw.githubusercontent.com/mesos/kibana/master/manual-tests/marathon-docker.json
cat marathon.json | sed -e 's/$MASTER/'"$MASTER"'/' | sed -e 's/$SLAVE0/'"$SLAVE0"'/' | curl -XPOST -H 'Content-Type:application/json' -d @- http://$MASTER:8080/v2/apps
See the marathon file and the properties file for further ways to customize the installation.
Sometimes people don't want to run docker. This example will install a Kibana cluster using the java binaries. This marathon file will ask Mesos to download the properties file from a url. First export the locations of your master and first slave, then run these commands:
export MASTER=${master ip address}
export SLAVE0=${elasticsearch ip address - see json file}
curl -sS -o marathon.json https://raw.githubusercontent.com/mesos/kibana/master/manual-tests/marathon-jar.json
cat marathon.json | sed -e 's/$MASTER/'"$MASTER"'/' | sed -e 's/$SLAVE0/'"$SLAVE0"'/' | curl -XPOST -H 'Content-Type:application/json' -d @- http://$MASTER:8080/v2/apps
See the marathon file and the properties file for further ways to customize the installation.
Because this project uses Mesos-Framework there is no Kibana-specific code to compile or download. To run, simply pass a configuration file or options. Example marathon files can be found in the manual-tests directory.
All options can be specified as either:
- A cli parameter:
--mesos.command=pwd
- A properties file:
mesos.command=pwd
- Java options:
-Dmesos.command=pwd
- Environmental variables:
MESOS_COMMAND=pwd
In that order of preference.
To pass a configuration file, the following property must be set:
--spring.config.location=my.properties
(Or the env varSPRING_CONFIG_LOCATION
, etc.)
All settings are written in properties or argument format. Remember that these can also be specified in environment or yml format.
Command | Description |
---|---|
spring.application.name |
Required application name for Spring |
mesos.framework.name |
Framework name used in Mesos and ZooKeeper |
mesos.master |
URL of the master (usually provided by ZooKeeper) |
mesos.zookeeper.server |
IP:PORT of the zookeeper server |
mesos.resources.cpus |
CPUs allocated to the task |
mesos.resources.mem |
RAM allocated to the task |
mesos.resources.count |
Number of task instances |
mesos.resources.ports.${VAR}.host |
A requested port, where VAR is the name of the port. |
mesos.resources.ports.${VAR}.container |
When in bridge mode, the container port to map the host port to. |
mesos.docker.image |
Docker image to use |
mesos.docker.network |
Type of docker network |
mesos.command |
The command to run |
mesos.uri[0..] |
Files to download into the Mesos sandbox |
logging.level.com.containersolutions.mesos |
Logging level |
mesos.principal |
The principal for Mesos Auth. |
mesos.secret |
The secret for Mesos Auth. |
mesos.healthCheck.command |
The command to run as the Mesos healthcheck |
Note that there are more parameters. See Mesos-Starter.
First upload the settings file into the task sandbox with the mesos.uri
property:
mesos.uri[0]=https://gist.githubusercontent.com/philwinder/592a1ab2db40431c1b08/raw/kibana.yml
The file can be a local file (local to the host that the task is to run on) or a url.
Then copy that file into the kibana config directory, overwriting the default. Kibana does not expose a config location parameter so overwriting is the only way to pass the settings into Kibana. For example, in jar mode:
mesos.command= cp $MESOS_SANDBOX/kibana.yml $MESOS_SANDBOX/kibana-*/config/kibana.yml ; cd kibana-* ; bin/kibana --port=$UI_5061 --elasticsearch ${elasticsearch.http}
Or when in docker mode:
mesos.command=mv $MESOS_SANDBOX/kibana.yml /opt/kibana/config/kibana.yml ; kibana --port=$UI_5061 --elasticsearch ${elasticsearch.http}
Ports are allocated by Mesos and provided to the application as an environmental variable. For example:
mesos.resources.ports.UI_5061.host=ANY
mesos.resources.ports.UI_5061.container=5601
Assigns an unprivileged port to the environmental variable UI_5061
. This environmental variable can now be use in the mesos.command
, if required.
The value can be one of the following types:
Command | Description |
---|---|
ANY |
The next available unprivileged port (>1024) |
UNPRIVILEGED |
The next available unprivileged port (>1024) |
PRIVILEGED |
The next available privileged port (<=1024) |
1234 |
A specific port (e.g. 1234) |
MesosFramework uses Spring Actuator to provide health and metrics endpoints. To access the health endpoint visit: http://${SCHEDULER_IP_ADDRESS}:${server.port}/health
. Acuator defaults the server.port
to 8080, although it is recommended to reserve ports in the marathon command and set this port explicitly. E.g. jar mode json file
See the Spring documentation for more information.
This adds an endpoint at the following location to control the number of instances in the cluster. The endpoint matches the properties file definition of the same name:
GET /mesos/resources/count
Returns the current number of requested instances. For example to get the current number of instances:
$ curl -s http://${SCHEDULER_IP_ADDRESS}:${server.port}/mesos/resources/count
3
POST /mesos/resources/count
with a body of type Integer
will set the number of requested instances. For example, to set the number of instances to 1:
$ curl -XPOST -H 'Content-Type: text/plain' http://${SCHEDULER_IP_ADDRESS}:${server.port}/mesos/resources/count -d 1
This project is sponsored by Cisco Cloud Services.
Apache License 2.0