Puppet Class: mongodb::mongos

Inherits:
mongodb::globals
Defined in:
manifests/mongos.pp

Summary

This installs a Mongo Shard daemon.

Overview

This class should only be used if you want to implement sharding within your mongodb deployment.

This class allows you to configure the mongos daemon (responsible for routing) on your platform.

}

Examples:

mongos can be installed the following way.

class {'mongodb::mongos' :
 configdb => ['configsvr1.example.com:27018'],

Parameters:

  • config (Stdlib::Absolutepath) (defaults to: '/etc/mongos.conf')

    Path of the config file. If not specified, the module will use the default for your OS distro.

  • config_content (Optional[String[1]]) (defaults to: undef)

    Config content if the default doesn’t match one needs.

  • config_template (Optional[String[1]]) (defaults to: undef)

    Path to the config template if the default doesn’t match one needs.

  • configdb (Variant[String[1], Array[String[1]]]) (defaults to: '127.0.0.1:27019')

    Array of the config servers IP addresses the mongos should connect to.

  • config_data (Optional[Hash]) (defaults to: undef)

    Hash containing key-value pairs to allow for additional configuration options to be set in user-provided template.

  • service_manage (Boolean) (defaults to: true)

    Whether or not the MongoDB sharding service resource should be part of the catalog.

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

    This setting can be used to override the default Mongos service provider. If not specified, the module will use whatever service provider is the default for your OS distro.

  • service_name (String[1]) (defaults to: 'mongos')

    This setting can be used to override the default Mongos service name. If not specified, the module will use whatever service name is the default for your OS distro.

  • service_user (String[1])

    The user used by Systemd for running the service. If not specified, the module will use the default for your OS distro.

  • service_group (String[1])

    The group used by Systemd for running the service If not specified, the module will use the default for your OS distro.

  • service_template (String[1]) (defaults to: 'mongodb/mongos/mongos.service-dropin.epp')

    Path to the service template if the default doesn’t match one needs.

  • service_enable (Boolean) (defaults to: true)

    This setting can be used to specify if the service should be enable at boot

  • service_ensure (Stdlib::Ensure::Service) (defaults to: 'running')

    This setting can be used to specify if the service should be running

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

    This setting can be used to override the default status check command for your Mongos service. If not specified, the module will use whatever service name is the default for your OS distro.

  • package_ensure (String[1]) (defaults to: pick($mongodb::globals::version, 'present'))

    This setting can be used to specify if puppet should install the package or not

  • package_name (String) (defaults to: "mongodb-${mongodb::globals::edition}-mongos")

    This setting can be used to specify the name of the package that should be installed. If not specified, the module will use whatever service name is the default for your OS distro.

  • unixsocketprefix (Stdlib::Absolutepath) (defaults to: '/var/run/mongodb')

    The path for the UNIX socket. If this option has no value, the mongos process creates a socket with /tmp as a prefix.

  • pidfilepath (Stdlib::Absolutepath) (defaults to: '/var/run/mongodb/mongos.pid')

    Specify a file location to hold the PID or process ID of the mongod process. If not specified, the module will use the default for your OS distro.

  • logpath (Variant[Boolean, Stdlib::Absolutepath]) (defaults to: '/var/log/mongodb/mongos.log')

    Specify the path to a file name for the log file that will hold all diagnostic logging information. Unless specified, mongod will output all log information to the standard output.

  • fork (Boolean) (defaults to: true)

    Set to true to fork server process at launch time. The default setting depends on the operating system.

  • bind_ip (Optional[Array[Stdlib::IP::Address]]) (defaults to: undef)

    Set this option to configure the mongod or mongos process to bind to and listen for connections from applications on this address. If not specified, the module will use the default for your OS distro.

  • port (Optional[Stdlib::Port]) (defaults to: undef)

    Specifies a TCP port for the server instance to listen for client connections.

  • restart (Boolean) (defaults to: true)

    Specifies whether the service should be restarted on config changes.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'manifests/mongos.pp', line 89

class mongodb::mongos (
  String[1] $service_user,
  String[1] $service_group,
  Stdlib::Absolutepath $config                       = '/etc/mongos.conf',
  Optional[String[1]] $config_content                = undef,
  Optional[String[1]] $config_template               = undef,
  Variant[String[1], Array[String[1]]] $configdb     = '127.0.0.1:27019',
  Optional[Hash] $config_data                        = undef,
  Boolean $service_manage                            = true,
  Optional[String] $service_provider                 = undef,
  String[1] $service_name                            = 'mongos',
  String[1] $service_template                        = 'mongodb/mongos/mongos.service-dropin.epp',
  Boolean $service_enable                            = true,
  Stdlib::Ensure::Service $service_ensure            = 'running',
  Optional[String] $service_status                   = undef,
  String[1] $package_ensure                          = pick($mongodb::globals::version, 'present'),
  String $package_name                               = "mongodb-${mongodb::globals::edition}-mongos",
  Stdlib::Absolutepath $unixsocketprefix             = '/var/run/mongodb',
  Stdlib::Absolutepath $pidfilepath                  = '/var/run/mongodb/mongos.pid',
  Variant[Boolean, Stdlib::Absolutepath] $logpath    = '/var/log/mongodb/mongos.log',
  Boolean $fork                                      = true,
  Optional[Array[Stdlib::IP::Address]] $bind_ip      = undef,
  Optional[Stdlib::Port] $port                       = undef,
  Boolean $restart                                   = true,
) inherits mongodb::globals {
  contain mongodb::mongos::install
  contain mongodb::mongos::config
  contain mongodb::mongos::service

  unless $package_ensure in ['absent', 'purged'] {
    Class['mongodb::mongos::install'] -> Class['mongodb::mongos::config']

    if $restart {
      # If $restart is true, notify the service on config changes (~>)
      Class['mongodb::mongos::config'] ~> Class['mongodb::mongos::service']
    } else {
      # If $restart is false, config changes won't restart the service (->)
      Class['mongodb::mongos::config'] -> Class['mongodb::mongos::service']
    }
  } else {
    Class['mongodb::mongos::service'] -> Class['mongodb::mongos::config'] -> Class['mongodb::mongos::install']
  }
}