【发布时间】:2014-09-19 14:43:16
【问题描述】:
通过学习使用 puppet 和 vagrant,我的生活变得更轻松(我希望如此)。 我已经知道如何使用 Vagrant,但我想进行一个开箱即用的配置,以启动所有设置。所以我想用Puppet。 我使用了http://jamesmcfadden.co.uk/using-vagrant-and-puppet-to-build-a-php-nginx-and-mysql-environment/ 的教程,但似乎无法弄清楚如何启动 MySQL。
运行 Ubuntu 14.04LTS 我的 init.pp for MySQL 是
class mysql {
# Install mysql
package { ['mysql-server']:
ensure => present,
require => Exec['apt-get update'],
}
# Run mysql
service { 'mysql':
ensure => running,
require => Package['mysql-server'],
}
# Use a custom mysql configuration file
file { '/etc/mysql/my.cnf':
source => 'puppet:///modules/mysql/my.cnf',
require => Package['mysql-server'],
notify => Service['mysql'],
}
# We set the root password here
exec { 'set-mysql-password':
unless => 'mysqladmin -uroot -proot status',
command => "mysqladmin -uroot password a9120ed2b58af37862a83f5b9f850819ed08b2a9",
path => ['/bin', '/usr/bin'],
require => Service['mysql'];
}
}
但这给了我一个找不到mysql的错误。
err: /Stage[main]/Mysql/Service[mysql]/ensure: change from stopped to running fa
iled: Could not start Service[mysql]: Execution of '/sbin/start mysql' returned
1: at /tmp/vagrant-puppet-2/modules-0/mysql/manifests/init.pp:13
并将其更改为 mysqld(注意 'd')此消息消失了,但存在无法找到检查 mysql 是否正在运行的依赖项的问题(将它们更改为 'Service['mysqld ']':
err: /Stage[main]/Mysql/Service[mysqld]: Could not evaluate: Could not find init
script or upstart conf file for 'mysqld'
我做错了吗?
【问题讨论】:
-
显然
mysql没有尾随 d 是正确的,但您需要调查启动脚本失败的原因。尝试 syslog 或您可能让服务写入的任何专用mysql日志。
标签: mysql vagrant puppet ubuntu-14.04