0
我嘗試用下面的食譜創建我自己的MariaDB食譜:MariaDB食譜不起作用
我試着複製用於在手動安裝中安裝MariaDB的步驟。 mariadb.repo文件已創建,但除此之外,我沒有看到創建my.cnf或my.cnf.d文件和文件夾。
請讓我知道發生了什麼問題,或者我應該在什麼地方查找以找出導致出現問題的原因?
MariaDB的/食譜/ default.rb:
include_recipe "yum"
arch = node['kernel']['machine']
# Fedora reports the architecture as 'x86_64'
arch = 'amd64' if arch == 'x86_64'
arch = 'x86' unless arch == 'amd64'
pversion = node['platform_version'].split('.').first
case node["platform"] #Create Yum Repository for MariaDB
when "redhat"
yum_repository "MariaDB" do
name 'mariadb'
baseurl 'http://yum.mariadb.org/5.5/rhel6-amd64'
gpgkey 'https://yum.mariadb.org/RPM-GPG-KEY-MariaDB'
gpgcheck true
action :create
end
when "centos"
yum_repository "MariaDB" do
name 'mariadb'
baseurl "http://yum.mariadb.org/#{node['mariadb']['version']}/#{node['platform']}#{pversion}-#{arch}"
gpgkey 'https://yum.mariadb.org/RPM-GPG-KEY-MariaDB'
gpgcheck true
action :create
end
end
bash 'remove postfix' do
cwd '/etc'
code <<-EOH
rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
yum remove postfix
EOH
end
bash 'install_MariaDB-server-Client' do
cwd '/etc'
code <<-EOF
/usr/bin/expect -c 'spawn yum install MariaDB-server MariaDB-client
expect "Is this ok [y/d/N]:"
send "y\n" eof'
EOF
end
bash 'install postfix' do
cwd '/etc'
code <<-EOF
/usr/bin/expect -c 'spawn yum install postfix
expect "Is this ok [y/d/N]:"
send "y\n" eof'
EOF
end
# Start mariadb service
service "mysql" do
supports :status => true, :restart => true, :start => true
action [ :start, :enable]
end
bash "mysql_secure_installation" do
user "root"
code <<-EOF
/usr/bin/expect -c 'spawn /etc/mysql_secure_installation
expect "Enter current password for root (enter for none):"
send "\r"
expect "Change root password?"
send "y\n"
expect "New password:"
send "root\n"
expect "Re-enter new password:"
send "root\n"
expect "Remove anonymous users?"
send "y\n"
expect "Disallow root login remotely?"
send "y\n"
expect "Remove test database and access to it?"
send "y\n"
expect "Reload privilege tables now?"
send "y\n" eof'
EOF
end
上執行廚師客戶
[2015-03-03T11:16:52+00:00] WARN:
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
SSL validation of HTTPS requests is disabled. HTTPS connections are still
encrypted, but chef is not able to detect forged replies or man in the middle
attacks.
To fix this issue add an entry like this to your configuration file:
```
# Verify all HTTPS connections (recommended)
ssl_verify_mode :verify_peer
# OR, Verify only connections to chef-server
verify_api_cert true
```
要檢查SSL配置,或排除故障,您可以使用 knife ssl check
命令,像這樣:
knife ssl check -c /etc/chef/client.rb
Starting Chef Client, version 11.16.4
resolving cookbooks for run list: ["lgmariadb"]
Synchronizing Cookbooks:
- yum
- lgmariadb
Compiling Cookbooks...
Converging 7 resources
Recipe: yum::default
* yum_globalconfig[/etc/yum.conf] action create
* template[/etc/yum.conf] action create (up to date)
(up to date)
Recipe: lgmariadb::default
* yum_repository[mariadb] action create
* template[/etc/yum.repos.d/mariadb.repo] action create (up to date)
* execute[yum-makecache-mariadb] action nothing (skipped due to action :nothing)
* ruby_block[yum-cache-reload-mariadb] action nothing (skipped due to action :nothing)
(up to date)
* bash[remove postfix] action run
- execute "bash" "/tmp/chef-script20150303-14830-hcss75"
* bash[install_MariaDB-server-Client] action run
- execute "bash" "/tmp/chef-script20150303-14830-69e4w"
* bash[install postfix] action run
- execute "bash" "/tmp/chef-script20150303-14830-d4wjcl"
* service[mysql] action start
================================================================================
Error executing action `start` on resource 'service[mysql]'
================================================================================
Chef::Exceptions::Exec
----------------------
/bin/systemctl start mysql returned 6, expected 0
Resource Declaration:
---------------------
# In /var/chef/cache/cookbooks/lgmariadb/recipes/default.rb
89: service "mysql" do
90: supports :status => true, :restart => true, :start => true
91: action [ :start, :enable]
92: end
93:
Compiled Resource:
------------------
# Declared in /var/chef/cache/cookbooks/lgmariadb/recipes/default.rb:89:in `from_file'
service("mysql") do
provider Chef::Provider::Service::Systemd
action [:start, :enable]
supports {:status=>true, :restart=>true, :start=>true}
retries 0
retry_delay 2
guard_interpreter :default
service_name "mysql"
pattern "mysql"
cookbook_name "lgmariadb"
recipe_name "default"
end
Running handlers:
[2015-03-03T11:16:53+00:00] ERROR: Running exception handlers
Running handlers complete
[2015-03-03T11:16:53+00:00] ERROR: Exception handlers complete
[2015-03-03T11:16:53+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
Chef Client failed. 3 resources updated in 1.477241151 seconds
[2015-03-03T11:16:53+00:00] ERROR: service[mysql] (lgmariadb::default line 89) had an error: Chef::Exceptions::Exec: /bin/systemctl start mysql returned 6, expected 0
[2015-03-03T11:16:53+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)