Permalink
Browse files

add mandatory plugins support in conf

  • Loading branch information...
1 parent bf36681 commit 017f48a187cea3a7806ebc1631b70ed9d5877976 @Paikan Paikan committed with Paikan Feb 17, 2012
Showing with 23 additions and 2 deletions.
  1. +8 −1 config/elasticsearch.yml
  2. +15 −1 src/main/java/org/elasticsearch/plugins/PluginsService.java
@@ -82,11 +82,11 @@
#
# node.rack: rack314
-
# By default, multiple nodes are allowed to start from the same installation location
# to disable it, set the following:
# node.max_local_storage_nodes: 1
+
#################################### Index ####################################
# You can set a number of options (such as shard/replica options, mapping
@@ -165,6 +165,13 @@
# path.plugins: /path/to/plugins
+#################################### Plugin ###################################
+
+# If a plugin listed here is not installed for current node, the node will not start.
+#
+# plugin.mandatory: mapper-attachments,lang-groovy
+
+
################################### Memory ####################################
# ElasticSearch performs poorly when JVM starts swapping: you should ensure that
@@ -74,8 +74,22 @@ public PluginsService(Settings settings, Environment environment) {
// first, find all the ones that are in the classpath
Map<String, Plugin> plugins = Maps.newHashMap();
plugins.putAll(loadPluginsFromClasspath(settings));
+ Set<String> sitePlugins = sitePlugins();
+
+ String[] mandatoryPlugins = settings.getAsArray("plugin.mandatory", null);
+ if (mandatoryPlugins != null) {
+ Set<String> missingPlugins = Sets.newHashSet();
+ for (String mandatoryPlugin : mandatoryPlugins) {
+ if (!plugins.containsKey(mandatoryPlugin) && !sitePlugins.contains(mandatoryPlugin) && !missingPlugins.contains(mandatoryPlugin)) {
+ missingPlugins.add(mandatoryPlugin);
+ }
+ }
+ if (!missingPlugins.isEmpty()) {
+ throw new ElasticSearchException("Missing mandatory plugins " + missingPlugins);
+ }
+ }
- logger.info("loaded {}, sites {}", plugins.keySet(), sitePlugins());
+ logger.info("loaded {}, sites {}", plugins.keySet(), sitePlugins);
this.plugins = ImmutableMap.copyOf(plugins);

0 comments on commit 017f48a

Please sign in to comment.