mysql - 如何使用 mysql Recipe ?

标签 mysql chef-infra chef-recipe

我正在尝试在 Chef Supermarket 中使用最新版本的 mysql Recipe :

https://supermarket.chef.io/cookbooks/mysql

(8.3.1)

我已将其添加为包装 Recipe ,并创建了一个我试图在 Test Ktichen 中旋转的小 Recipe :

include_recipe 'mysql'

mysql_service 'foo' do
  port '3306'
  version '5.7'
  initial_root_password 'change me'
  action [:create, :start]
end

mysql_config 'logging' do
  instance 'instance-1'
  source 'my.cnf.erb'
  action :create
  notifies :restart, 'mysql_service[instance-1]'
end

这很快就会失败:

could not find recipe default for cookbook mysql

依赖的“mysql”位于说明书metadata.rb中。

我看到一些帖子说这本 Recipe 已经进行了重大重构...但我仍然不知道如何实际使用它...

最佳答案

include_recipe方法用于调用指定的配方。如果没有给出配方,例如include_recipe '<cookbook_name>' ,它将调用默认配方,即default.rb。

https://docs.chef.io/recipes.html#include-recipes

就您而言,mysql是一本基础 Recipe ,只有在 Wrapper Recipe 中使用的库和资源。因此,您可以调用类似 mysql_config 的资源。但是include_recipe将会失败,因为该 Recipe 中没有 Recipe 。

https://github.com/chef-cookbooks/mysql

关于mysql - 如何使用 mysql Recipe ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43371860/

相关文章:

ruby - Chef 错误在资源 `start` 上执行操作 'service[httpd]'

mysql - 为什么我在 SQL 上不断收到相同的错误消息

mysql - 使用 mysql 别名从 2 个表中选择列

linux - Chef Recipe ArgumentError 未知指令 : "\n"

chef-infra - 具有自定义 GUID 的 Windows 防火墙的 Chef Guard

chef-infra - 如何使 Chef 与特定用户一起执行并加载其环境值

php - if 语句(已验证)

php - 将 MIkrotik 日期时间转换为 Mysql 日期时间

chef-infra - Chef Recipe - 资源中不可用的模块方法

docker - 来自守护程序的错误响应:容器f88566c370dd未运行