Puppet Class: cassandra::system::sysctl

Inherits:
cassandra::params
Defined in:
manifests/system/sysctl.pp

Overview

Set Sysctl (kernel runtime parameters) as suggested in docs.datastax.com/en/landing_page/doc/landing_page/recommendedSettingsLinux.html

If any of the values is set into the target file, the sysctl command will be called with the provided file name as an argument.

Examples:

Basic requirement

require cassandra::system::sysctl

Parameters:

  • sysctl_args (string) (defaults to: '-p')

    Passed to the ‘sysctl` command

  • sysctl_file (string) (defaults to: $cassandra::params::sysctl_file)

    Path to the file to insert the settings into.

  • net_core_optmem_max (integer) (defaults to: 40960)

    The value to set for net.core.optmem_max

  • net_core_rmem_default (integer) (defaults to: 16777216)

    The value to set for net.core.rmem_default.

  • net_core_rmem_max (integer) (defaults to: 16777216)

    The value to set for net_core_rmem_max.

  • net_core_wmem_default (integer) (defaults to: 16777216)

    The value to set for net.core.wmem_default.

  • net_core_wmem_max (integer) (defaults to: 16777216)

    The value to set for net.core.wmem_max.

  • net_ipv4_tcp_rmem (string) (defaults to: $cassandra::params::net_ipv4_tcp_rmem)

    The value to set for net.ipv4.tcp_rmem.

  • net_ipv4_tcp_wmem (string) (defaults to: $cassandra::params::net_ipv4_tcp_wmem)

    The value to set for net.ipv4.tcp_wmem.

  • vm_max_map_count (integer) (defaults to: 1048575)

    The value to set for vm.max_map_count.

See Also:



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'manifests/system/sysctl.pp', line 24

class cassandra::system::sysctl (
  $sysctl_args           = '-p',
  $sysctl_file           = $cassandra::params::sysctl_file,
  $net_core_optmem_max   = 40960,
  $net_core_rmem_default = 16777216,
  $net_core_rmem_max     = 16777216,
  $net_core_wmem_default = 16777216,
  $net_core_wmem_max     = 16777216,
  $net_ipv4_tcp_rmem     = $cassandra::params::net_ipv4_tcp_rmem,
  $net_ipv4_tcp_wmem     = $cassandra::params::net_ipv4_tcp_wmem,
  $vm_max_map_count      = 1048575,
) inherits cassandra::params {
  ini_setting { "net.core.rmem_max = ${net_core_rmem_max}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.core.rmem_max',
    value   => $net_core_rmem_max,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "net.core.wmem_max = ${net_core_wmem_max}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.core.wmem_max',
    value   => $net_core_wmem_max,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "net.core.rmem_default = ${net_core_rmem_default}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.core.rmem_default',
    value   => $net_core_rmem_default,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "net.core.wmem_default = ${net_core_wmem_default}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.core.wmem_default',
    value   => $net_core_wmem_default,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "net.core.optmem_max = ${net_core_optmem_max}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.core.optmem_max',
    value   => $net_core_optmem_max,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "net.ipv4.tcp_rmem = ${net_ipv4_tcp_rmem}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.ipv4.tcp_rmem',
    value   => $net_ipv4_tcp_rmem,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "net.ipv4.tcp_wmem = ${net_ipv4_tcp_wmem}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'net.ipv4.tcp_wmem',
    value   => $net_ipv4_tcp_wmem,
    notify  => Exec['Apply sysctl changes'],
  }

  ini_setting { "vm.max_map_count = ${vm_max_map_count}":
    ensure  => present,
    path    => $sysctl_file,
    section => '',
    setting => 'vm.max_map_count',
    value   => $vm_max_map_count,
    notify  => Exec['Apply sysctl changes'],
  }

  exec { 'Apply sysctl changes':
    command     => "/sbin/sysctl ${sysctl_args} ${sysctl_file}",
    refreshonly => true,
  }
}