mysql - 模板化 MySQL 的 my.cnf 以在 Puppet 中设置

标签 mysql optimization puppet

我的任务是对 MySQL 的 my.cnf 进行模板化,以尝试使用 Puppet 标准化从属数据库之间的配置。现在,我的目标是 innodb 设置。 是否存在可以根据内存、磁盘和进程等硬件规范安全计算的配置选项?

最佳答案

你需要事实。

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 

` 在 puppet.pp 中我使用 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,
}

请参阅 puppet labs 上的“将自定义事实添加到 Facter”。

关于mysql - 模板化 MySQL 的 my.cnf 以在 Puppet 中设置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5046244/

相关文章:

python - Python 中的字符串覆盖优化

windows - 使用 Puppet 更改 TrustedInstaller 拥有的注册表项的权限

arrays - Prometheus 配置文件与 Puppet : how to handle quotes and brackets in yaml config file?

mysql - 统计在接下来 7 天内同一日期预订的所有人数

optimization - Tensorflow:从训练中选择最佳模型

python - 循环将数据从串口读取到数据库

c# - 提高C#代码效率的方法

linux - Puppet - 如何清除目录

mysql - EF Code First Migrations - 两个程序集 - 查看错误的配置文件

mysql 多个多对多连接