Author: Jed Glazner Version: 0.2.1 Modified: 12/09/2011
This module uses HTTP requests to talk to the apache solr request handlers to gather information and report errors. Because of this the minion doesn't necessarily need to reside on the actual slave. However if you want to use the signal function the minion must reside on the physical solr host.
This module supports multi-core and standard setups. Certain methods are master/slave specific. Make sure you set the solr.type. If you have questions or want a feature request please ask.
salt.modules.solr.
abort_import
(handler, host=None, core_name=None, verbose=False)¶MASTER ONLY Aborts an existing import command to the specified handler. This command can only be run if the minion is configured with solr.type=master
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.abort_import dataimport None music {'clean':True}
salt.modules.solr.
backup
(host=None, core_name=None, append_core_to_path=False)¶Tell solr make a backup. This method can be mis-leading since it uses the backup API. If an error happens during the backup you are not notified. The status: 'OK' in the response simply means that solr received the request successfully.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.backup music
salt.modules.solr.
core_status
(host=None, core_name=None)¶MULTI-CORE HOSTS ONLY Get the status for a given core or all cores if no core is specified
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.core_status None music
salt.modules.solr.
delta_import
(handler, host=None, core_name=None, options=None, extra=None)¶Submits an import command to the specified handler using specified options. This command can only be run if the minion is configured with solr.type=master
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.delta_import dataimport None music {'clean':True}
salt.modules.solr.
full_import
(handler, host=None, core_name=None, options=None, extra=None)¶MASTER ONLY Submits an import command to the specified handler using specified options. This command can only be run if the minion is configured with solr.type=master
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.full_import dataimport None music {'clean':True}
salt.modules.solr.
import_status
(handler, host=None, core_name=None, verbose=False)¶Submits an import command to the specified handler using specified options. This command can only be run if the minion is configured with solr.type: 'master'
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.import_status dataimport None music False
salt.modules.solr.
is_replication_enabled
(host=None, core_name=None)¶SLAVE CALL Check for errors, and determine if a slave is replicating or not.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.is_replication_enabled music
salt.modules.solr.
lucene_version
(core_name=None)¶Gets the lucene version that solr is using. If you are running a multi-core setup you should specify a core name since all the cores run under the same servlet container, they will all have the same version.
Return: dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.lucene_version
salt.modules.solr.
match_index_versions
(host=None, core_name=None)¶SLAVE CALL Verifies that the master and the slave versions are in sync by comparing the index version. If you are constantly pushing updates the index the master and slave versions will seldom match. A solution to this is pause indexing every so often to allow the slave to replicate and then call this method before allowing indexing to resume.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.match_index_versions music
salt.modules.solr.
optimize
(host=None, core_name=None)¶Search queries fast, but it is a very expensive operation. The ideal process is to run this with a master/slave configuration. Then you can optimize the master, and push the optimized index to the slaves. If you are running a single solr instance, or if you are going to run this on a slave be aware than search performance will be horrible while this command is being run. Additionally it can take a LONG time to run and your HTTP request may timeout. If that happens adjust your timeout settings.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.optimize music
salt.modules.solr.
ping
(host=None, core_name=None)¶Does a health check on solr, makes sure solr can talk to the indexes.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.ping music
salt.modules.solr.
reload_core
(host=None, core_name=None)¶MULTI-CORE HOSTS ONLY Load a new core from the same configuration as an existing registered core. While the "new" core is initializing, the "old" one will continue to accept requests. Once it has finished, all new request will go to the "new" core, and the "old" core will be unloaded.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.reload_core None music
Return data is in the following format:
{'success':bool, 'data':dict, 'errors':list, 'warnings':list}
salt.modules.solr.
reload_import_config
(handler, host=None, core_name=None, verbose=False)¶MASTER ONLY re-loads the handler config XML file. This command can only be run if the minion is a 'master' type
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.reload_import_config dataimport None music {'clean':True}
salt.modules.solr.
replication_details
(host=None, core_name=None)¶Get the full replication details.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.replication_details music
salt.modules.solr.
set_is_polling
(polling, host=None, core_name=None)¶SLAVE CALL Prevent the slaves from polling the master for updates.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.set_is_polling False
salt.modules.solr.
set_replication_enabled
(status, host=None, core_name=None)¶MASTER ONLY Sets the master to ignore poll requests from the slaves. Useful when you don't want the slaves replicating during indexing or when clearing the index.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.set_replication_enabled false, None, music
salt.modules.solr.
signal
(signal=None)¶Signals Apache Solr to start, stop, or restart. Obviously this is only going to work if the minion resides on the solr host. Additionally Solr doesn't ship with an init script so one must be created.
CLI Example:
salt '*' solr.signal restart
salt.modules.solr.
version
(core_name=None)¶Gets the solr version for the core specified. You should specify a core here as all the cores will run under the same servlet container and so will all have the same version.
Return : dict<str,obj>:
{'success':boolean, 'data':dict, 'errors':list, 'warnings':list}
CLI Example:
salt '*' solr.version