Puppet Class: solr

Inherits:
::solr::params
Defined in:
manifests/init.pp

Summary

Installs solr using the embedded version of jetty.

Overview

Configures solr and starts the service.

If using Centos, the firewall rules need to be configured as shown:

```
 add IP Tables
 /sbin/iptables -I INPUT 1 -p tcp --dport 8983 -j ACCEPT
 /sbin/service iptables save
 service iptables restart
```

Examples:


include solr

Parameters:

  • version (String) (defaults to: '6.6.6')

    The version to install.

  • url (String) (defaults to: 'http://archive.apache.org/dist/lucene/solr/')

    The url of the source repository for apache solr.

  • url_user (Optional[String]) (defaults to: undef)

    If the URL is password protected, the user name.

  • url_pass (Optional[String]) (defaults to: undef)

    If the URL is password protected, the password.

  • manage_user (Boolean) (defaults to: true)

    Whether to manage the solr user or not

  • solr_user (String) (defaults to: 'solr')

    Run Solr as this user ID. Note, creates this user.

  • solr_host (String) (defaults to: '127.0.0.1')

    Listen to connections from this network host Use 0.0.0.0 as solr_host to accept all connections.

  • solr_port (String) (defaults to: '8983')

    The network port used by Jetty

  • solr_timezone (String) (defaults to: 'UTC')

    The timezone used by Jetty

  • solr_heap (String) (defaults to: '512m')

    The heap size used by jetty.

  • solr_java_mem (Optional[String]) (defaults to: undef)

    If you want finer control over memory options, specify them directly with this variable. Arguments should be in the following format: “-Xms512m -Xmx512m” Note, the solr_heap parameter will not be used.

  • solr_downloads (String) (defaults to: '/opt/solr_downloads')

    Contains the solr tarballs and extracted dirs.

  • install_dir (String) (defaults to: '/opt')

    The install directory (‘-i`) parameter passed to the solr installer.

  • install_dir_mg (Boolean) (defaults to: false)

    Sets if this module should manage the install directory. True if this module should manage and false otherwise.

  • install_options (String) (defaults to: '-n')

    String of options to be passed to install_solr_service.sh script. The default option -n does not start Solr service after install, and does not abort on missing Java. Only valid for Solr version 6.3.0+. For versions less than 6.3.0, set to empty string.

  • solr_home (String) (defaults to: '/opt/solr/server/solr')

    The home directory for solr.

  • solr_options (Optional[Array]) (defaults to: undef)

    Additional options added to java start command line in addition to other options.

  • var_dir (String) (defaults to: '/var/solr')

    The var directory for solr.

  • solr_logs (String) (defaults to: '/var/log/solr')

    The directory for the solr logs.

  • java_home (String) (defaults to: $solr::params::java_home)

    The directory that contains the jvm. Default: (os specific)

    * Debian/Ubuntu: '/usr/lib/jvm/java-8-openjdk-amd64/jre'
    * CentOS/RHEL: '/usr/lib/jvm/jre-1.8.0'
    
  • manage_java (Boolean) (defaults to: true)

    True if this class should manage java and false if java is managed outside of this class.

  • solr_environment (Optional[Array]) (defaults to: undef)

    Bash style environment variables passed at the end of the solr server environment.

  • limit_nofile (Integer) (defaults to: 65000)

    Sets number of open files limit in systemd service file.

  • limit_nproc (Integer) (defaults to: 65000)

    Sets number of processes limit in systemd service file.

  • cores (Hash) (defaults to: {})

    An array of hashes that define a core which will be created with the create_resources function. See type solr::core for details.

  • required_packages (Array) (defaults to: $solr::params::required_packages)

    Specified in params and is platform dependent.

  • zk_hosts (Optional[Array]) (defaults to: undef)

    For configuring ZooKeeper ensemble.

  • zk_service (Optional[String]) (defaults to: undef)

    If Zookeeper is running on this node, ensure the Solr service starts before zk_service.

  • log4j_maxfilesize (String) (defaults to: '4MB')

    Maximum allowed log file size (in bytes) before rolling over. Suffixes “KB”, “MB” and “GB” are allowed.

  • log4j_maxbackupindex (String) (defaults to: '9')

    Maximum number of log backup files to keep.

  • log4j_rootlogger_loglevel (Variant[ Enum['ALL', 'DEBUG', 'ERROR', 'FATAL', 'INFO', 'OFF', 'TRACE', 'TRACE_INT', 'WARN'], String]) (defaults to: 'INFO')

    The loglevel to set for log4j.

  • schema_name (Optional[String]) (defaults to: undef)

    The Solr cores’ schema name. This should be set to ‘schema.xml` if using the classic schema.xml method. If using a managed schema, set this to Solr’s “managedSchemaResourceName” setting, typically ‘manage-schema’. Refer to Solr’s documentation for ‘core.properties` for details. Default: varies by version:

    Solr >= 5.6.0 will use 'manage-schema'
    Solr < 5.6.0 will default to 'schema.xml'
    
  • ssl_key_store (Optional[String]) (defaults to: undef)

    The path to the key store. If the key store is in the solr’s home/etc directory, than can be etc/KEY_STORE_FILE

  • ssl_key_store_password (Optional[String]) (defaults to: undef)

    The secret password of the key store. Required if ssl_key_store is set.

  • ssl_key_store_type (Optional[String]) (defaults to: 'JKS')

    The type of key store.

  • ssl_trust_store (Optional[String]) (defaults to: undef)

    If ssl_key_store is set and ssl_trust_store is undef, the settings will use the key store as the trust store. This can be set to an indepenent trust store.

  • ssl_trust_store_password (Optional[String]) (defaults to: undef)

    The password to the trust store. If undef and ssl_key_store_password is set, the trust store password will use the key store’s password.

  • ssl_trust_store_type (Optional[String]) (defaults to: 'JKS')

    The type of trust store.

  • ssl_need_client_auth (Optional[Boolean]) (defaults to: undef)

    Set to true if the client requires authentication.

  • ssl_want_client_auth (Optional[Boolean]) (defaults to: undef)

    Enables the client to authenticate but is not required.

  • ssl_client_key_store (Optional[String]) (defaults to: undef)

    If undef, will use values set for ssl_key_store for clients.

  • ssl_client_key_store_password (Optional[String]) (defaults to: undef)

    If undef, will use values set for ssl_key_store_password for clients.

  • ssl_client_trust_store (Optional[String]) (defaults to: undef)

    If undef, will use values set for ssl_trust_store for clients.

  • ssl_client_trust_store_password (Optional[String]) (defaults to: undef)

    If undef, will use values set for ssl_trust_store_password for clients.



175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
# File 'manifests/init.pp', line 175

class solr (
  String            $version                         = '6.6.6',
  String            $url                             = 'http://archive.apache.org/dist/lucene/solr/',
  Optional[String]  $url_user                        = undef,
  Optional[String]  $url_pass                        = undef,
  Boolean           $manage_user                     = true,
  String            $solr_user                       = 'solr',
  String            $solr_host                       = '127.0.0.1',
  String            $solr_port                       = '8983',
  String            $solr_timezone                   = 'UTC',
  String            $solr_heap                       = '512m',
  Optional[String]  $solr_java_mem                   = undef,
  String            $solr_downloads                  = '/opt/solr_downloads',
  String            $install_dir                     = '/opt',
  Boolean           $install_dir_mg                  = false,
  String            $install_options                 = '-n',
  String            $var_dir                         = '/var/solr',
  String            $solr_logs                       = '/var/log/solr',
  String            $solr_home                       = '/opt/solr/server/solr',
  Optional[Array]   $solr_options                    = undef,
  String            $java_home                       = $solr::params::java_home,
  Boolean           $manage_java                     = true,
  Optional[Array]   $solr_environment                = undef,
  Integer           $limit_nofile                    = 65000,
  Integer           $limit_nproc                     = 65000,
  Hash              $cores                           = {},
  Array             $required_packages               = $solr::params::required_packages,
  Optional[Array]   $zk_hosts                        = undef,
  Optional[String]  $zk_service                      = undef,
  String            $log4j_maxfilesize               = '4MB',
  String            $log4j_maxbackupindex            = '9',
  Variant[
    Enum['ALL', 'DEBUG', 'ERROR', 'FATAL',
        'INFO', 'OFF', 'TRACE',
        'TRACE_INT', 'WARN'],
    String]         $log4j_rootlogger_loglevel       = 'INFO',
  Optional[String]  $schema_name                     = undef,
  Optional[String]  $ssl_key_store                   = undef,
  Optional[String]  $ssl_key_store_password          = undef,
  Optional[String]  $ssl_key_store_type              = 'JKS',
  Optional[String]  $ssl_trust_store                 = undef,
  Optional[String]  $ssl_trust_store_password        = undef,
  Optional[String]  $ssl_trust_store_type            = 'JKS',
  Optional[Boolean] $ssl_need_client_auth            = undef,
  Optional[Boolean] $ssl_want_client_auth            = undef,
  Optional[String]  $ssl_client_key_store            = undef,
  Optional[String]  $ssl_client_key_store_password   = undef,
  Optional[String]  $ssl_client_trust_store          = undef,
  Optional[String]  $ssl_client_trust_store_password = undef,
) inherits ::solr::params{

  ## === Variables === ##
  $solr_env       = $solr::params::solr_env
  # The directory that contains cores.
  $solr_core_home = $solr_home
  $solr_pid_dir   = $var_dir
  $solr_bin       = "${install_dir}/solr/bin"
  $solr_server    = "${install_dir}/solr/server"
  # The directory to install shared libraries for use by solr.
  $solr_lib_dir   = "${solr_server}/solr-webapp/webapp/WEB-INF/lib"

  # The directory to the basic configuration example core.
  if versioncmp($solr::version, '7.0.0') >= 0 {
    $basic_dir    = "${solr_server}/solr/configsets/_default/conf"
  }else{
    $basic_dir    = "${solr_server}/solr/configsets/basic_configs/conf"
  }

  # If no value for `schema_name` is provided, use a sensible default for this
  # version of Solr.
  case $schema_name {
    undef: {
      # I have confirmed that managed-schema doesn't work in 5.5.3
      # So I am pushing to version 5.6.0.
      if versioncmp($solr::version, '5.6.0') >= 0 {
        $schema_filename = 'managed-schema'
      } else {
        $schema_filename = 'schema.xml'
      }
    }
    default: {
      $schema_filename = $schema_name
    }
  }

  contain solr::install
  contain solr::config
  contain solr::service

  Class['solr::install'] -> Class['solr::config']
  Class['solr::config'] ~> Class['solr::service']

  if is_hash($cores) {
    create_resources(::solr::core, $cores)
  }
}