1

我正在与 vagrant 和 chef 一起工作。就一切而言,只有当我在 vagrant 文件中使用 mysql 和 mongodb 的 Logpath 更改时,才会出现错误。

如果这里有人有小费并且可以帮助我会很高兴。

在 Vagrantfile 我已经说过了......

:mysql => {
        :server_root_password => 'password',
        :server_debian_password => 'password',
        :server_repl_password => 'password',
        :allow_remote_root => true,
        :log_dir => "/vagrant/www/logs/mysql",
        :tunable => {
          :log_slow_queries => "/vagrant/www/logs/mysql/slow.log",
          :log_error => true,
          :log_warnings => true
        }
},
:mongodb => {
      :logpath => "/vagrant/www/logs/mongodb"
},



================================================================================
Error executing action `create` on resource 'directory[/vagrant/www/logs/mysql]'
================================================================================

Errno::EPERM
------------
Operation not permitted - /vagrant/www/logs/mysql

Resource Declaration:
---------------------
# In /tmp/vagrant-chef/chef-solo-1/cookbooks/mysql/recipes/server.rb

117:     directory path do
118:       owner     'mysql' unless platform?('windows')
119:       group     'mysql' unless platform?('windows')
120:       action    :create
121:       recursive true
122:     end
123:   end

Compiled Resource:
------------------
# Declared in /tmp/vagrant-chef/chef-solo-1/cookbooks/mysql/recipes/server.rb:117:in `block in from_file'

directory("/vagrant/www/logs/mysql") do
  provider Chef::Provider::Directory
  action [:create]
  retries 0
  retry_delay 2
  path "/vagrant/www/logs/mysql"
  recursive true
  cookbook_name :mysql
  recipe_name "server"
  owner "mysql"
  group "mysql"
  mode 493
end

[2013-10-31T01:03:09-07:00] DEBUG: Re-raising exception: Errno::EPERM - directory[/vagrant/www/logs/mysql] (mysql::server line 117) had an error: Errno::EPERM: Operation not permitted - /vagrant/www/logs/mysql
4

2 回答 2

0

首先,我不建议使用这个——缓慢的日志写入会减慢大多数数据库的速度,我不想对自己这样做。

无论如何,对 vagrant 共享文件夹的权限可能有点棘手——在某些情况下,如果不是很多,您需要从 vagrantfile 设置所有者/权限。这对于 /vagrant 来说有点棘手,但如果您真的不想将 vagrant ssh 放入服务器以读取日志,则可以映射另一个文件夹。为此:

config.vm.synced_folder "logs", "/logs", :mount_options => ['dmode=777', 'fmode=777']

777 可能是矫枉过正,但你明白了。

于 2013-11-29T01:08:32.840 回答
0

这条线是关键问题:Operation not permitted - /vagrant/www/logs/mysql

这意味着它不允许用户在此路径下创建目录。请检查用户mysql是否有权访问目录/vagrant/www/logs。也许你+x需要/vagrant

于 2013-11-03T14:31:35.227 回答