-
Notifications
You must be signed in to change notification settings - Fork 314
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow to benchmark plugins from sources
With this commit we allow to build plugins from source code. This works for Elasticsearch core plugins (that are bundled along with the Elasticsearch repository) and also externally maintained plugins. Closes #309
- Loading branch information
1 parent
320fdf2
commit 2b99e6d
Showing
15 changed files
with
456 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,8 +4,7 @@ Using Elasticsearch Plugins | |
You can have Rally setup an Elasticsearch cluster with plugins for you. However, there are a couple of restrictions: | ||
|
||
* This feature is only supported from Elasticsearch 5.0.0 onwards | ||
* You cannot benchmark source-builds of plugins | ||
* Whereas Rally caches downloaded Elasticsearch distributions, plugins will always be installed via the Internet and thus each machine where an Elasticsearch node will be installed requires an active Internet connection. | ||
* Whereas Rally caches downloaded Elasticsearch distributions, plugins will always be installed via the Internet and thus each machine where an Elasticsearch node will be installed, requires an active Internet connection. | ||
|
||
Listing plugins | ||
--------------- | ||
|
@@ -14,14 +13,18 @@ To see which plugins are available, run ``esrally list elasticsearch-plugins``:: | |
|
||
Available Elasticsearch plugins: | ||
|
||
Name Configuration | ||
------------------ ---------------- | ||
Name Configuration | ||
----------------------- ---------------- | ||
analysis-icu | ||
analysis-kuromoji | ||
analysis-phonetic | ||
analysis-smartcn | ||
analysis-stempel | ||
analysis-ukrainian | ||
discovery-azure-classic | ||
discovery-ec2 | ||
discovery-file | ||
discovery-gce | ||
ingest-attachment | ||
ingest-geoip | ||
ingest-user-agent | ||
|
@@ -30,9 +33,13 @@ To see which plugins are available, run ``esrally list elasticsearch-plugins``:: | |
mapper-attachments | ||
mapper-murmur3 | ||
mapper-size | ||
repository-azure | ||
repository-gcs | ||
repository-hdfs | ||
repository-s3 | ||
store-smb | ||
x-pack monitoring-local | ||
x-pack security | ||
x-pack monitoring-local | ||
x-pack security | ||
|
||
Rally supports plugins only for Elasticsearch 5.0 or better. As the availability of plugins may change from release to release we recommend that you include the ``--distribution-version`` parameter when listing plugins. By default Rally assumes that you want to benchmark the latest master version of Elasticsearch. | ||
|
||
|
@@ -67,6 +74,33 @@ As mentioned above, Rally also allows you to specify a plugin configuration and | |
|
||
If you are behind a proxy, please set the environment variable ``ES_JAVA_OPTS`` accordingly on each target machine as described in the `Elasticsearch plugin documentation <https://www.elastic.co/guide/en/elasticsearch/plugins/current/_other_command_line_parameters.html#_proxy_settings>`_. | ||
|
||
Building plugins from sources | ||
----------------------------- | ||
|
||
Plugin authors may want to benchmark source builds of their plugins. To make this work, you need to manually edit Rally's configuration file in ``~/.rally/rally.ini``. Suppose, we want to benchmark the plugin "my-plugin". Then you need to add the following entries in the ``source`` section:: | ||
|
||
plugin.my-plugin.remote.repo.url = [email protected]:example-org/my-plugin.git | ||
plugin.my-plugin.src.subdir = elasticsearch-extra/my-plugin | ||
plugin.my-plugin.build.task = :my-plugin:plugin:assemble | ||
plugin.my-plugin.build.artifact.subdir = plugin/build/distributions | ||
|
||
Let's discuss these properties one by one: | ||
|
||
* ``plugin.my-plugin.remote.repo.url``: This is needed to let Rally checkout the source code of the plugin. If this is a private repo, credentials need to be setup properly. | ||
* ``plugin.my-plugin.src.subdir``: This is the directory to which the plugin will be checked out relative to ``src.root.dir``. In order to allow to build the plugin alongside Elasticsearch, the plugin needs to reside in a subdirectory of ``elasticsearch-extra`` (see also the `Elasticsearch testing documentation <https://github.com/elastic/elasticsearch/blob/master/TESTING.asciidoc#building-with-extra-plugins>`_. | ||
* ``plugin.my-plugin.build.task``: The Gradle task to run in order to build the plugin artifact. Note that his command is run from the Elasticsearch source directory as Rally assumes that you want to build your plugin alongside Elasticsearch. Mixing released Elasticsearch distributions with plugin source builds is not supported (nor is there an intention to do so). | ||
* ``plugin.my-plugin.build.artifact.subdir``: This is the subdirectory relative to ``plugin.my-plugin.src.subdir`` in which the final plugin artifact is located. | ||
|
||
In order to run a benchmark with ``my-plugin``, you'd invoke Rally as follows: ``esrally --revision="elasticsearch:some-elasticsearch-revision,my-plugin:some-plugin-revision" --elasticsearch-plugins="my-plugin"`` where you need to replace ``some-elasticsearch-revision`` and ``some-plugin-revision`` with the appropriate :ref:`git revisions <clr_revision>`. Adjust other command line parameters (like track or car) accordingly. In order for this to work, you need to ensure that: | ||
|
||
* All prerequisites for source builds are installed. | ||
* The Elasticsearch source revision is compatible with the chosen plugin revision. Note that you do not need to know the revision hash to build against an already released version and can use git tags instead. E.g. if you want to benchmark against Elasticsearch 5.6.1, you c0an specify ``--revision="elasticsearch:v5.6.1,my-plugin:some-plugin-revision"`` (see e.g. the `Elasticsearch tags on Github <https://github.com/elastic/elasticsearch/tags>`_ or use ``git tag`` in the Elasticsearch source directory on the console). | ||
* If your plugin needs to be configured, please ensure to create a proper plugin specification (see below). | ||
|
||
.. note:: | ||
Rally can build all `Elasticsearch core plugins <https://github.com/elastic/elasticsearch/tree/master/plugins>`_ out of the box without any further configuration. | ||
|
||
|
||
Anatomy of a plugin specification | ||
--------------------------------- | ||
|
||
|
@@ -100,7 +134,7 @@ In ``$TEAM_REPO_ROOT`` create the directory structure for the plugin and its con | |
That's it. Later, Rally will just copy all files in ``myplugin/default`` to the home directory of the Elasticsearch node that it configures. First, Rally will always apply the car's configuration and then plugins can add their configuration on top. This also explains why we have created a ``config/elasticsearch.yml``. Rally will just copy this file and replace template variables on the way. | ||
|
||
.. note:: | ||
If you create a new customization for a plugin, ensure that the plugin name in the team repository matches the official plugin name. Note that hyphens need to be replaced by underscores (e.g. "x-pack" becomes "x_pack"). The reason is that Rally allows to write custom install hooks and the plugin name will become the root package name of the install hook. However, hyphens are not supported in Python which is why we use underscores instead. | ||
If you create a new customization for a plugin, ensure that the plugin name in the team repository matches the core plugin name. Note that hyphens need to be replaced by underscores (e.g. "x-pack" becomes "x_pack"). The reason is that Rally allows to write custom install hooks and the plugin name will become the root package name of the install hook. However, hyphens are not supported in Python which is why we use underscores instead. | ||
|
||
|
||
The next step is now to create our two plugin configurations where we will set the variables for our config base "default". Create a file ``simple.ini`` in the ``myplugin`` directory:: | ||
|
@@ -125,14 +159,18 @@ Rally will now know about ``myplugin`` and its two configurations. Let's check t | |
|
||
Available Elasticsearch plugins: | ||
|
||
Name Configuration | ||
------------------ ---------------- | ||
Name Configuration | ||
----------------------- ---------------- | ||
analysis-icu | ||
analysis-kuromoji | ||
analysis-phonetic | ||
analysis-smartcn | ||
analysis-stempel | ||
analysis-ukrainian | ||
discovery-azure-classic | ||
discovery-ec2 | ||
discovery-file | ||
discovery-gce | ||
ingest-attachment | ||
ingest-geoip | ||
ingest-user-agent | ||
|
@@ -141,13 +179,17 @@ Rally will now know about ``myplugin`` and its two configurations. Let's check t | |
mapper-attachments | ||
mapper-murmur3 | ||
mapper-size | ||
myplugin simple | ||
myplugin advanced | ||
repository-azure | ||
repository-gcs | ||
repository-hdfs | ||
repository-s3 | ||
store-smb | ||
x-pack monitoring-local | ||
x-pack security | ||
myplugin simple | ||
myplugin advanced | ||
x-pack monitoring-local | ||
x-pack security | ||
|
||
As ``myplugin`` is not an official plugin, the Elasticsearch plugin manager does not know from where to install it, so we need to add the download URL to ``~/.rally/rally.ini`` as before:: | ||
As ``myplugin`` is not a core plugin, the Elasticsearch plugin manager does not know from where to install it, so we need to add the download URL to ``~/.rally/rally.ini`` as before:: | ||
|
||
[distributions] | ||
plugin.myplugin.release.url=https://example.org/myplugin/releases/{{VERSION}}/myplugin-{{VERSION}}.zip | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.