mysql - Chef MySql Recipe : MySql does not start after reboot

标签 mysql ubuntu chef-infra vagrant

我正在尝试在 vagrant 中安装 mysql 配方。我用this Recipe 。

MySql 服务在 vagrant up 之后启动,但重新启动后我无法执行 vagrant provisionvagrant up,因为服务器失败开始。

我已经意识到,Vagrant 会删除 /var/run 目录;它创建 mysqld 目录(用于套接字),但不创建 mysql(用于 pid 文件)。 MySql找不到目录,无法创建pid文件。

我怎样才能让它发挥作用?为什么 Vagrant 创建 mysqld,而不创建 mysql?

我还尝试了不同的盒子(precise32、cloud daily precision64)。

盒子:http://files.vagrantup.com/precise32.box Vagrant 文件:

Vagrant.configure("2") do |config|
  config.vm.box = "precise32"
  config.omnibus.chef_version = :latest

  config.vm.box_url = "http://files.vagrantup.com/precise32.box"

  config.vm.network :forwarded_port, guest: 8000, host: 8080

  config.vm.provider :virtualbox do |vb|
    vb.gui = true
  end
  config.vm.provision :chef_solo do |chef|
    chef.cookbooks_path = "./chef-repo/cookbooks"
    chef.add_recipe "apt"
    chef.add_recipe "mysql::server"
    chef.json = {
      "mysql" => {
                  "server_root_password" => "password",
                  "server_repl_password" => "password",
                  "server_debian_password" => "password"
                 }
    }
  end
end

最佳答案

问题出在 MySql Recipe 中:不知何故/var/run/mysqld 没有被删除,所以解决方法是:更改 <mysql_cookbook>/libraries/provider_mysql_service_ubuntu.rb

pid_file = '/var/run/mysql/mysql.pid' 

pid_file = '/var/run/mysqld/mysqld.pid' 

我也在github上提出了一个问题,所以将来这个bug可以在master中修复

关于mysql - Chef MySql Recipe : MySql does not start after reboot,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22818096/

相关文章:

php - UNION ALL - JOIN 如何限制为 1

mysql - 不允许主机 'X' 连接到此 MySQL 服务器

ubuntu - 无法在 Ubuntu 8 上安装 OpenSSL 1.1

linux - knife ssh - jetty 会突然停止

ruby - Chef客户端IP地址

mysql - STI MySQL 有趣的 select as with case

mysql - 如何用这么多 AND 组织我的查询

gcc - 在 Ubuntu 10.10 32 位上构建 gcc-4.0.4。检测到缓冲区溢出

ubuntu - 在 NGINX 中更改域名的最简单方法

linux - Knife 工问题