[英]MySQL Community Server installation on CentOS using Chef
我嘗試使用超市的Chef mysql cookbook在CentOS7上安裝MySQL Community Server : https : //supermarket.chef.io/cookbooks/mysql
我的食譜文件:
metadata.rb
depends 'mysql', '~> 8.0.4'
default.rb
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
看起來像這樣的問題: https : //github.com/chef-cookbooks/mysql/issues/443
謝謝你的時間!
我懷疑您可能需要為此使用其他食譜,因為以下命令在centos 7存儲庫中未顯示mysql-community-server。 也許嘗試mariadb食譜。
yum provides mysql*
但是,如果確實需要安裝mysql-community-server,則可能需要修改配方,如下所示
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
請記住,啟動mysql-community時,systemctl初始化腳本可能會遇到一些問題。
我設法通過以下更改來修復此設置:
metadata.rb
depends 'mysql'
depends 'mysql2_chef_gem'
depends 'database'
default.rb
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'
我添加了以下依賴項,並且運行良好。
cookbook "yum-mysql-community", '~> 4.0.1'
cookbook 'mysql', '~> 6.0'
cookbook 'yum-centos', '~> 3.0.0'
這里要注意的另一件事是記住在配方中提供package_name 。 我的食譜如下:
mysql_service 'foo' do
port '3306'
version '5.7'
package_name 'mysql-server'
initial_root_password 'root'
action [:create, :start]
end
希望能幫助到你!
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.