How to disable Filesystem/URL Snapshots in 2.x

(Ankit Malpani) #1

I want to disable FS and URL snapshots in Elasticsearch 2.x. Essentially do not want users of the cluster messing around with the filesystem. Users are allowed to configure S3 repositories only.

I achieved this in 1.x by having a plugin do the following

repositoriesModule.registerRepository(FsRepository.TYPE, AbstractModule.class)

But 2.x seems to disallow registering same module twice and throws the following error

[2016-03-17 14:40:43,195][ERROR][bootstrap ] Exception ElasticsearchException[failed to invoke onModule]; nested: InvocationTargetException; nested: IllegalArgumentException[Can't register the same [repository] more than once for [url]]; at org.elasticsearch.plugins.PluginsService.processModule( at org.elasticsearch.plugins.PluginsService.processModules( at org.elasticsearch.node.Node.( at org.elasticsearch.node.Node.( at at org.elasticsearch.bootstrap.Bootstrap.setup( at org.elasticsearch.bootstrap.Bootstrap.init( at org.elasticsearch.bootstrap.Elasticsearch.main( Caused by: java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke( at sun.reflect.DelegatingMethodAccessorImpl.invoke( at java.lang.reflect.Method.invoke( at org.elasticsearch.plugins.PluginsService.processModule( ... 7 more Caused by: java.lang.IllegalArgumentException: Can't register the same [repository] more than once for [url] at org.elasticsearch.common.util.ExtensionPoint$ClassMap.registerExtension( at org.elasticsearch.repositories.RepositoryTypesRegistry.registerRepository( at org.elasticsearch.repositories.RepositoriesModule.registerRepository( at ... 12 more

(David Pilato) #2

I think that's an interesting use case and I'd probably open an issue about this: add a setting to disable fs repo on startup. Or add such a fine grained support in Shield. I don't think Shield supports that today.

@Igor_Motov WDYT?

(Ankit Malpani) #3

Thanks! I have filed

In general, I liked the ability in 1.x to be able to override default implementations with custom plugins but I cant find a way to do something similar with 2.x

(system) #4