Forge Home

cassandra

Puppet module to manage a Cassandra cluster.

8,060 downloads

212 latest version

5.0 quality score

We run a couple of automated
scans to help you access a
module's quality. Each module is
given a score based on how well
the author has formatted their
code and documentation and
modules are also checked for
malware using VirusTotal.

Please note, the information below
is for guidance only and neither of
these methods should be considered
an endorsement by Puppet.

Version information

  • 5.0.2 (latest)
  • 5.0.1
  • 5.0.0
  • 4.0.0
  • 3.1.0
  • 3.0.0
  • 2.3.0
  • 2.2.1
  • 2.2.0
  • 2.1.2
  • 2.1.1
  • 2.1.0
  • 2.0.1
released Jun 28th 2023
This version is compatible with:
  • Puppet Enterprise 2023.2.x, 2023.1.x, 2023.0.x, 2021.7.x, 2021.6.x, 2021.5.x, 2021.4.x, 2021.3.x, 2021.2.x, 2021.1.x, 2021.0.x, 2019.8.x
  • Puppet >= 6.21.0 < 8.0.0
  • ,

Start using this module

  • r10k or Code Manager
  • Bolt
  • Manual installation
  • Direct download

Add this module to your Puppetfile:

mod 'trepasi-cassandra', '5.0.2'
Learn more about managing modules with a Puppetfile

Add this module to your Bolt project:

bolt module add trepasi-cassandra
Learn more about using this module with an existing project

Manually install this module globally with Puppet module tool:

puppet module install trepasi-cassandra --version 5.0.2

Direct download is not typically how you would use a Puppet module to manage your infrastructure, but you may want to download the module in order to inspect the code.

Download
Tags: cassandra

Documentation

trepasi/cassandra — version 5.0.2 Jun 28th 2023

Reference

Table of Contents

Classes

Defined types

Data types

Classes

cassandra

Puppet module for Cassandra cluster which enables to install, configure and manage Cassandra nodes. The module consists of the install class, which is included first, followed by config and config::topology classes. Finally, the service class is included and notification from config are forwarded to service.

This class is the main class of this module and the only one which should be included in your node manifests. For documentation of the particular feature, refer to the reference documentation of the other components.

Examples

include cassandra

Parameters

The following parameters are available in the cassandra class:

cassandra_package

Data type: String

name of the package to be installed

Default value: 'cassandra'

cassandra_ensure

Data type: String

ensure clause for cassandra package

Default value: 'installed'

tools_package

Data type: String

package name of cassandra tools

Default value: 'cassandra-tools'

tools_ensure

Data type: String

ensure clause for tools package

Default value: $cassandra_ensure

manage_service

Data type: Boolean

enables puppet to manage the service

Default value: true

service_ensure

Data type: Cassandra::Service::Ensure

ensure clause for cassandra service

Default value: undef

service_enable

Data type: Cassandra::Service::Enable

enable state of cassandra service

Default value: false

service_name

Data type: String

the name of the cassandra service

Default value: 'cassandra'

config_dir

Data type: Stdlib::Absolutepath

cassandra configuration directory

Default value: '/etc/cassandra'

environment

Data type: Hash

hash of environment variable name-value pairs which should be add

Default value: {}

jvm_option_sets

Data type: Hash

list of option sets containing JVM options, properties and advanced runtime options

Default value: {}

jvm_options

Data type: Array[String]

list of options to be passed to the JVM

Default value: []

java

Data type: Struct[{ properties => Optional[Hash], agents => Optional[Hash], runtime_options => Optional[Hash], adv_runtime_options => Optional[Hash], }]

input hash to the factory of java properties, agents, runtime_options and advanced_runtime_options

Default value: {}

java_gc

Data type: Optional[Hash]

input hash to the java::gc class

Default value: undef

config

Data type: Hash

configuration hash to be merged with local cassandra.yaml on the node

Default value: {}

initial_tokens

Data type: Optional[Hash[Stdlib::Host,Pattern[/^[0-9]+$/]]]

mapping inital token to nodes and merge them into the config

Default value: undef

node_key

Data type: Stdlib::Host

the key used in initial_tokens to identify nodes

Default value: $facts['networking']['fqdn']

cassandra_home

Data type: Stdlib::Absolutepath

homedirectory of cassandra user

Default value: '/var/lib/cassandra'

envfile

Data type: Stdlib::Absolutepath

envfile path containing environment settings

Default value: "${cassandra_home}/.cassandra.in.sh"

rackdc

Data type: Optional[Cassandra::Rackdc]

rack and dc settings to be used by GossipingPropertyFileSnitch

Default value: undef

topology

Data type: Optional[Hash]

hash describing the topology to be used by PropertyFileSnitch and GossipingPropertyFileSnitch

Default value: undef

topology_default

Data type: Optional[Pattern[/[a-zA-Z0-9.]:[a-zA-Z0-9.-]/]]

default dc and rack settings

Default value: undef

cassandra::config

This class is managing the following files:

  • /var/lib/cassandra/.cassandra.in.sh
  • /etc/cassandra/cassandra-rackdc.properties
  • /etc/cassandra/cassandra.yaml
  • /etc/cassandra/jvm.options

The main class of this module will include this class, you should not invoke this at all.

All parameter necessery for this class are defined in the main class.

The config parameter should contain only those settings you want to have non-default, i.e. want to change on the node. Keep in mind, that the structure of this hash must fit to the structure of cassandra.yaml.

Examples

main config file handling
cassandra::config:
  cluster_name: Example Cassandra cluster
  endpoint_snitch: PropertyFileSnitch
  seed_provider:
    - class_name: org.apache.cassandra.locator.SimpleSeedProvider
      parameters:
        - seeds: 10.0.0.1,10.0.1.1
  listen_address: "%{facts.networking.ip}"

cassandra::config::rackdc

This class manages the cassandra-rackdc.properties file, which is needed when using GossippingPropertyFileSnitch.

This class is contained with config, thus do not use it for its own.

Examples

simple rack and DC settings
cassandra::rackdc:
  dc: dc1
  rack: rackA
rack, DC and dc_suffix settings
cassandra::rackdc:
  dc: dc1
  rack: rackA
  dc_suffix: .example.org

cassandra::config::topology

This class manages the cassandra-topology.properties file, which is needed when using PropertyFileSnitch or GossippingPropertyFileSnitch.

This class is contained with config, thus do not use it for its own.

Examples

multi-dc and multi-rack topology
cassandra::topology:
  dc1:
    rackA:
    - 10.0.0.1
    - 10.0.0.2
    rackB:
    - 10.0.0.3
    - 10.0.0.4
  dc2:
    rackA:
    - 10.0.1.1
    - 10.0.1.2
    rackB:
    - 10.0.1.3
    - 10.0.1.4
setting up topology_default
cassandra::topology:
  dc1:
    rackA:
    - 10.0.0.1
    - 10.0.0.2
    rackB:
    - 10.0.0.3
    - 10.0.0.4
  dc2:
    rackA:
    - 10.0.1.1
    - 10.0.1.2
    rackB:
    - 10.0.1.3
    - 10.0.1.4
cassandra::topology_default: dc1:rackA

cassandra::install

This class is installing the Cassandra and optionally the Tools packages.

The main class of this module will include this class, you should not invoke this at all.

All parameter necessery for this class are defined in the main class.

Examples

install a specific version
cassandra::cassandra_ensure: 3.0.18
to install the latest version of cassandra-tools, independently from the cassandra version above
cassandra::tools_ensure: latest
if you don't want to install the tools package
cassandra::tools_ensure: absent
in the case, your package name is other
cassandra::cassandra_package: dsc22

cassandra::java::gc

Deprication notice: this class is now deprecated. Consider using JVM option sets instead.

This class allows to set consistent JVM options at once, especially for the purpose of garbage collection settings. This is enabled by managing jvm.options file, available from Cassandra version 3.0 and later.

GC parameters could be:

  • common parameters
    • numberOfGCLogFiles (Integer, defaults to: 10) - -XX:NumberOfGCLogFiles
    • gCLogFileSize (String, defaults to: 10M) - -XX:GCLogFileSize
  • G1 specific parameters
    • maxGCPauseMillis (Integer, defaults to: 500) - -XX:MaxGCPauseMillis
    • g1RSetUpdatingPauseTimePercent (Integer, defaults to: 5) - -XX:G1RSetUpdatingPauseTimePercent
    • initiatingHeapOccupancyPercent (Integer, defaults to: 70) - -XX:InitiatingHeapOccupancyPercent
    • parallelGCThreads (Optional[Integer], defaults to: undef) - -XX:ParallelGCThreads automatically set to number or cores-2 if >10 cores present
    • concGCThreads (Optional[Integer], defaults to: undef) - -XX:ConcGCThreads automatically set to -XX:ParallelGCThreads if the above is set

The config class contains a factory for this class which will create an instance using the settings of cassandra::java_gc, if not undef.

Examples

directly created
class { 'cassandra::java::gc':
  collector => 'g1',
}
factory generated
cassandra::java_gc:
  collector: g1
  params:
    maxGCPauseMillis: 300

Parameters

The following parameters are available in the cassandra::java::gc class:

collector

Data type: Enum['cms','g1']

select the garbage collector to use

params

Data type: Hash[String,Data]

parameter to set up the selected GC

Default value: {}

cassandra::reaper

This class is installing and managing an instance of cassandra-repear.

Examples

include cassandra::reaper

Parameters

The following parameters are available in the cassandra::reaper class:

package_ensure

Data type: String

package state to be ensured

Default value: 'latest'

template

Data type: Optional[String]

select the configuration template to which the settings are going to be merged

Default value: undef

settings

Data type: Hash

hash of cassandra-reaper settings to be merged

Default value: {}

configdir

Data type: Stdlib::Absolutepath

directory where to place the configuration file

Default value: '/etc/cassandra-reaper'

templatedir

Data type: Stdlib::Absolutepath

directory containing the template configurations

Default value: "${configdir}/configs"

service_ensure

Data type: Cassandra::Service::Ensure

serivce state to be ensured

Default value: 'running'

service_enable

Data type: Cassandra::Service::Enable

whether to enable or disable the service

Default value: true

cassandra::reaper::config

Managing the configuration of a cassandra reaper instance.

This class is included by cassandra::reaper and should not be used otherwise.

cassandra::reaper::install

Installing a cassandra reaper instance.

This class is included by cassandra::reaper and should not be used otherwise.

cassandra::reaper::service

Managing the service of a cassandra reaper instance.

This class is included by cassandra::reaper and should not be used otherwise.

cassandra::service

This class is controlling the Cassandra service on the nodes. Take care of the fact, that configuration changes will notify the service which may lead to onorchestrated node restarts on your cluster.

You probably don't want this happen in production.

Defined types

cassandra::environment::jvm_option

Each instance of this type is adding a JVM option to the JVM running the Cassandra. This enables you to set e.g. verbose:gc.

The config class contains a factory for this type which will create instances for each key of cassandra::jvm_options.

Examples

directly created
cassandra::jvm_option { 'verbose:gc': }
factory generated
cassandra::jvm_options:
  - verbose:gc
  - server

cassandra::environment::variable

Each instance of this type is adding a environment variable to the Cassandra process. This enables you to set e.g. MAX_HEAP_SIZE, HEAP_NEWSIZE, etc.

The config class contains a factory for this type which will create instances for each key of cassandra::environment.

Examples

directly created
cassandra::environment::variable { 'MAX_HEAP_SIZE':
  value => '8G',
}
factory generated
cassandra::environment:
  MAX_HEAP_SIZE: 8G
  HEAP_NEWSIZE: 2G

Parameters

The following parameters are available in the cassandra::environment::variable defined type:

id

Data type: String

name of the environment variable

Default value: $title

value

Data type: String

value to be assigned to the variable

cassandra::java::advancedruntimeoption

Each instance of this type adds a advanced runtime option to the JVM running Cassandra.

The config class contains a factory for this type which will create instances for each key of cassandra::java::runtime_options.

Examples

directly created
cassandra::java::advancedruntimeoption { 'LargePageSizeInBytes':
  value => '2m',
}
factory generated
cassandra::java:
  adv_runtime_options:
    LargePageSizeInBytes: 2m
    UseLargePages: true
    AlwaysPreTouch: true

Parameters

The following parameters are available in the cassandra::java::advancedruntimeoption defined type:

value

Data type: Scalar

a string value to be added to the runtime option or a boolean which will prefix the option with + or -

cassandra::java::agent

Each instance of this type adds an agent to the JVM running Cassandra.

The config class contains a factory for this type which will create instances for each key of cassandra::java::agents.

Examples

directly created
cassandra::java::agent { 'jmx_prometheus_javaagent.jar':
  value => '8080:config.yaml',
}
factory created
cassandra::java:
  agents:
    jmx_prometheus_javaagent.jar: 8080:config.yaml

Parameters

The following parameters are available in the cassandra::java::agent defined type:

value

Data type: Optional[String]

options to be added to the agent

Default value: undef

cassandra::java::property

Each instance of this type adds a property to the JVM running Cassandra.

The config class contains a factory for this type which will create instances for each key of cassandra::java::properties.

Examples

directly created
cassandra::java::property { 'cassandra.replace_address':
  value => '10.0.0.2'
}
factory generated
cassandra::java:
  properties:
    cassandra.consistent.rangemovement: false
    cassandra.replace_address: 10.0.0.2

Parameters

The following parameters are available in the cassandra::java::property defined type:

value

Data type: Scalar

the value the property is set to

cassandra::java::runtimeoption

Each instance of this type adds a runtime option to the JVM running Cassandra.

The config class contains a factory for this type which will create instances for each key of cassandra::java::runtime_options.

Examples

directly created
cassandra::java::runtimeoption { 'prof': }
factory generated
cassandra::java:
  runtime_options:
    check: jni
    prof:

Parameters

The following parameters are available in the cassandra::java::runtimeoption defined type:

value

Data type: Optional[Scalar]

value to be added to the runtime option

Default value: undef

cassandra::jvm_option_set

Select the file to be controlled by choosing, jvm, jvm8 or jvm11 and the variant server or clients. Options, properties and advanced runtime options can be defined to have particular values or to be removed from the configuration. Any option not mentioned will not be touched.

For Cassandra 3.x versions, only optsfile = jvm with variant = undef is supported, which will control the /etc/cassandra/jvm.options file. Since Cassandra versions >= 4.0 use distinct option files for server and clients, as well as Java independent, Java-8 and Java-11, use parameters optsfile and variant to select a particular options file.

Parameters

The following parameters are available in the cassandra::jvm_option_set defined type:

optsfile

Data type: Enum['jvm', 'jvm8', 'jvm11']

determine the file to control, either jvm for the independet options or jvm8 or jvm11 for the version dependant options

Default value: 'jvm'

variant

Data type: Optional[Enum['clients', 'server']]

leave this undef for Cassandra < 4.0, set it to server or clients if running >= 4.0

Default value: undef

options

Data type: Array[String]

list of basic JVM options, e.g. ea, server, Xms4g, etc.

Default value: []

properties

Data type: Hash[String,Optional[Scalar]]

java properties to be passed to the JVM

Default value: {}

sizeoptions

Data type: Hash[String,Optional[Scalar]]

JVM options having a value concatenated directly to the options, e.g. Xmx4g.

Default value: {}

advancedoptions

Data type: Hash[String,Optional[Scalar]]

advanced runtime options which may be feature toggles or values

Default value: {}

Data types

Cassandra::Rackdc

Hash allowing to setup the content of cassandra-rackdc.properties. Note, that the fields dc and rack mandatory to setup rackdc, while dc_suffix and prefer_local can be set optionally.

Alias of

Struct[{
  dc           => String,
  rack         => String,
  dc_suffix    => Optional[String],
  prefer_local => Optional[Boolean],
}]

Cassandra::Service::Enable

Service enable can be manual or mask besides the Boolean.

Alias of

Variant[Boolean, Enum['manual','mask']]

Cassandra::Service::Ensure

This type is simply missing from Stdlib.

Alias of

Optional[Variant[Boolean,Enum['stopped', 'running']]]