[[installing-marvel]]
== Installing Marvel

To use Marvel, you need to install two components:

* An Elasticsearch plugin that collects data from each node in your cluster. 
This plugin must be installed on every node. 
* A Kibana app that provides the Marvel monitoring and management UI. 

By default, the Marvel plugin stores data in the same Elasticsearch cluster 
where it is installed. If you are monitoring a production cluster we recommend 
that you store the Marvel data in a separate monitoring cluster. Sending the Marvel
data to a monitoring cluster helps ensure that you can continue to monitor your
production cluster if it's in an unhealthy state. 

For basic installation instructions, see <<getting-started, Getting Started with Marvel>>. For 
information about storing Marvel data in a separate monitoring cluster, see <<monitoring-cluster, 
Setting up a Separate Monitoring Cluster>>.

[float]
[[marvel-prequisites]]
=== Marvel Installation Prequisites

* Elasticsearch {esversion} or later.
* Kibana {kibanaversion} or later.
* A modern web browser - http://www.elastic.co/subscriptions/matrix#matrix_browsers[Supported 
Browsers].

[float]
[[package-installation]]
=== Installing Marvel on a DEB/RPM Package Installation

If you use the DEB/RPM packages to install Elasticsearch, by default Elasticsearch is installed in 
`/usr/share/elasticsearch` and the configuration files are stored in `/etc/elasticsearch`. (For the 
complete list of default paths, see {ref}/setup-dir-layout.html#_deb_and_rpm[Directory Layout] in
the Elasticsearch Reference.)

To install the Marvel and License plugins on a DEB/RPM package installation, you need to run 
`bin/plugin -i` from the `/usr/share/elasticsearch` directory with superuser permissions, and 
specify the location of the configuration files by setting `-Des.path.conf`. For example:

[source,shell]
----------------------------------------------------------
cd /usr/share/elasticsearch
sudo bin/plugin install license
sudo bin/plugin install marvel-agent
----------------------------------------------------------

[float]
[[offline-installation]]
=== Installing Marvel on Offline Machines

Elasticsearch’s `bin/plugin` script requires direct Internet access to download and install the 
License and Marvel plugins. If your server doesn’t have Internet access, you can manually 
download and install the plugins.

To install Marvel on a machine that doesn't have Internet access:

. Manually download the License and Marvel binaries: 
+
** https://download.elastic.co/elasticsearch/license/license-latest.zip[
https://download.elastic.co/elasticsearch/license/license-latest.zip]
** https://download.elastic.co/elasticsearch/marvel/marvel-agent-latest.zip[
https://download.elastic.co/elasticsearch/marvel/marvel-agent-latest.zip]

. Transfer the zip files to the offline machine.

. Run `bin/plugin` with the `-u` option to install the plugins using the zip files. For example:
+
[source,shell]
----------------------------------------------------------
bin/plugin install file:///path/to/file/license-latest.zip <1>
bin/plugin install file:///path/to/file/marvel-agent-latest.zip
----------------------------------------------------------
<1> Note that you must specify an absolute path to the zip file after the `file://` protocol.

[float]
[[monitoring-cluster]]
=== Setting up a Separate Monitoring Cluster

To store Marvel data in a separate monitoring cluster:

. Set up the Elasticsearch cluster you want to use for monitoring. For example, a two host cluster
with the nodes `es-mon-1` and `es-mon-2`.

. Disable Marvel data collection for the nodes in your monitoring cluster by configuring the 
`marvel.agent.enabled`  setting in their `elasticsearch.yml` configuration files.
+
[source,yaml]
------------------------
marvel.agent.enabled: false
------------------------

. Install the Marvel and License plugins on the nodes in your monitoring cluster:
+
[source,sh]
----------------
bin/plugin install license
bin/plugin install marvel-agent
----------------

. Start Elasticsearch on the nodes in your monitoring cluster:
+
[source,shell]
----------------------------------------------------------
bin/elasticsearch
----------------------------------------------------------

. Configure the nodes in your production cluster to send Marvel data to your monitoring cluster by 
configuring the `marvel.agent.exporter.es.hosts` setting in their `elasticsearch.yml` 
configuration files:
+
[source,yaml]
------------------------
marvel.agent.exporter.es.hosts: ["es-mon-1:9200","es-mon-2:9200"]
------------------------

. Install the Marvel and License plugins on the nodes in your production cluster: 
+
[source,sh]
----------------
bin/plugin install license
bin/plugin install marvel-agent
----------------


. Restart Elasticsearch on the nodes in your production cluster
+
[source,shell]
----------------------------------------------------------
bin/elasticsearch
---------------------------------------------------------
+
TIP: You may want to temporarily {ref}/modules-cluster.html[disable shard
allocation] before you restart your nodes to avoid unnecessary shard
reallocation during the install process.

. Install the Marvel app into Kibana.

. Run Kibana and open the Marvel app to verify the installation. You should
see an overview of your cluster's status: