使用Chef在CentOS上安装MySQL社区服务器

问题描述 投票:0回答:3

我尝试使用来自超市的Chef mysql cookbook在CentOS 7上安装MySQL社区服务器:qazxsw poi

我的食谱文件:

metadata.rb

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

default.rb

depends 'mysql', '~> 8.0.4'

我执行了:

mysql_service 'db_some_data' do
  port '3306'
  version '5.7'
  initial_root_password 'abc123'
  action [:create, :start]
end

并得到以下错误:

berks install
kitchen test -d never

看起来像这个问题:================================================================================ Error executing action `install` on resource 'yum_package[mysql-community-server]' ================================================================================ Chef::Exceptions::Package ------------------------- No candidate version available for mysql-community-server Resource Declaration: --------------------- # In /tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_server_installation_package.rb 17: package package_name do 18: version package_version if package_version 19: options package_options if package_options 20: notifies :install, 'package[perl-Sys-Hostname-Long]', :immediately if plaform_family?('suse') 21: notifies :run, 'execute[Initial DB setup script]', :immediately if platfom_family?('suse') 22: action :install 23: end 24: Compiled Resource: ------------------ # Declared in /tmp/kitchen/cache/cookbooks/mysql/libraries/mysql_server_installation_pckage.rb:17:in `block in <class:MysqlServerInstallationPackage>' yum_package("mysql-community-server") do package_name "mysql-community-server" action [:install] retries 0 retry_delay 2 default_guard_interpreter :default declared_type :package cookbook_name "obiwan" version "5.7.11-1.el7" flush_cache {:before=>false, :after=>false} end Platform: --------- x86_64-linux

谢谢你的时间!

mysql centos chef
3个回答
0
投票

我怀疑你可能需要使用不同的食谱,因为下面的命令没有在centos 7 repo中显示mysql-community-server。也许尝试mariadb食谱。

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

但是,如果你真的必须安装mysql-community-server,你可能需要修改你的配方

yum provides mysql*

请记住,启动mysql-community时可能会遇到systemctl init脚本的一些问题。


0
投票

我设法通过以下更改来修复此设置:

metadata.rb

execute 'mysql-community-repo' do
 command 'yum localinstall https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
 action :run
end

 mysql_service 'db_some_data' do
  port '3306'
  version '5.7'
  initial_root_password 'abc123'
  action [:create, :start]
 end   

default.rb

depends 'mysql'
depends 'mysql2_chef_gem'
depends 'database'

0
投票

问题的存在是因为mysql_client 'default' do action :create end mysql_service 'db_some_data' do port '3306' version '5.7' initial_root_password 'abc123' action [:create, :start] end mysql2_chef_gem 'default' do action :install end 还不支持

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

我添加了以下依赖项,它工作正常。

cookbook 'mysql', '~> 8.0'

这里要注意的另一件事是记住在配方中提供package_name。我的食谱看起来像这样:

cookbook "yum-mysql-community", '~> 4.0.1'
cookbook 'mysql', '~> 6.0'
cookbook 'yum-centos', '~> 3.0.0'

希望能帮助到你!

© www.soinside.com 2019 - 2024. All rights reserved.