Pregunta

Me han tareedor con la plantilla de MySQL's my.cnf en un intento estandarizar la configuración entre las bases de datos de esclavos usando títere.En este momento, estoy apuntando a la configuración de Innodb. ¿Hay opciones de configuración que puedan calcularse de manera segura contra las especificaciones de hardware, como la memoria, el disco y los procs?

¿Fue útil?

Solución

You need facter.

puppet:/etc/puppet/modules/master/lib/facter$ cat disks.rb
#!/usr/bin/ruby
#require 'facter'

mount = `/bin/mount`
disks=Array.new 
mount.split("\n").each_with_index { | disk,i |
  unless disk.scan(/ext3|simfs|reiserfs|xfs/).empty?
    d=disk.split[2]
    disks.push d
    disks.push ','
 end
}

Facter.add('disks') do
 setcode do
   disks
 end 
end 

` and in puppet.pp i use facts $disks

#add disk check to zabbix
exec { "create_host":
    command => "/bin/echo $fqdn $ipaddress $disks | do_work",
    require => File["/root/ticket"],
    subscribe => File["/root/ticket"],
    refreshonly => true,
}

see "Adding Custom Facts to Facter" on puppet labs.

Otros consejos

I'd be tempted to move the calculations into the erb file, for example the key_buffer_size is recommended to be set to 1/4 of the Systems RAM:

set-variable = key_buffer_size=<%= (memorysize.split(' ')[0].to_i * 1024) / 4 -%>M

there is no reason why you couldn't work on other variables available from Facter (number of processors etc) and come up with your own calculations to set other variables as above.

Remember ERB effectively provides a subset of Ruby so almost anything you can do in Ruby can be done in ERB.

puppet have the erb template, erb template can use the facter value ,like hostname or memor. and you can write you self facter shell script.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top