简体   繁体   中英

vagrant : chef_solo | how i can change log path from mysql server and mongodb?

I'm working with vagrant and chef . As far as everything goes , only when I use the Logpath of mysql and mongodb change in the vagrant file , I get an error.

if anyone here has a tip and can help me would be happy.

In Vagrantfile I have stated so ...

: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

This line is the key problem: Operation not permitted - /vagrant/www/logs/mysql

which means it does not allow user to create directory under this path. Please check if user mysql is privileged to access directory /vagrant/www/logs . Maybe you need +x on /vagrant

First, I would not advise using this -- slow log writes will slow down most databases and I wouldn't want to do that to myself.

Anyhow, permissions on vagrant shared folders can be a bit tricky -- in some, if not many, cases you need to set owner / permission from the vagrantfile. This is a bit tricky for /vagrant but you could map another folder if you really don't want to vagrant ssh into the server to read the logs. To do so:

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

777 is probably overkill but you get the idea.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM