简体   繁体   English

如何更改自定义游民箱的php和mysql设置

[英]How do I change php and mysql settings for custom vagrant box

I use this vagrant box to develop on local pc for magento. 我用这个无聊的盒子在magento的本地PC上开发。 Magento works too slow and I have to adjust the settings. Magento工作太慢,我必须调整设置。 There is not much documentation about how to change php and mysql settings. 没有太多关于如何更改php和mysql设置的文档。 Plus I'm very very beginner at subject. 另外,我是这个学科的非常初学者。

Do I edit the setting inside the server with ssh or do I change cookbooks and then do vagrant provision or reload? 我是使用ssh编辑服务器内部的设置还是更改菜谱,然后进行无用的配置或重新加载? If I edit inside the server can I do vagrant provision ? 如果我在服务器内部进行编辑,我可以进行游民提供吗? will it overwrite the setting that I changed in the server? 它会覆盖我在服务器中更改的设置吗?

For mysql setting I changed this file to my needs but when I did vagrant up --provision after vagrant halt I got this error: (mysql did not start ) 对于mysql设置,我将此文件更改为需要的文件,但是当我vagrant up --provision vagrant halt vagrant up --provision后,我却出现了此错误:(mysql没有启动)

=> default: ================================================================================
=> default: Error executing action `restart` on resource 'service[mysql]'
=> default: ================================================================================
=> default:
=> default: Chef::Exceptions::Exec
=> default: ----------------------
=> default: /sbin/restart mysql returned 1, expected 0
=> default:
=> default: Resource Declaration:
=> default: ---------------------
=> default: # In /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/recipes/server.rb
=> default:
=> default: 217:
=> default: 218:   service "mysql" do
=> default: 219:     action :start
=> default: 220:   end
=> default: 221: end
=> default:
=> default: Compiled Resource:
=> default: ------------------
=> default: # Declared in /tmp/vagrant-chef-3/chef-solo-1/cookbooks/mysql/recipes/server.rb:218:in `from_file'
=> default:
=> default: service("mysql") do
=> default:   service_name "mysql"
=> default:   retry_delay 2
=> default:   retries 0
=> default:   recipe_name "server"
=> default:   pattern "mysql"
=> default:   action [:start]
=> default:   cookbook_name :mysql
=> default:   startup_type :automatic
=> default:   supports {:status=>true, :restart=>true, :reload=>true}
=> default:   provider Chef::Provider::Service::Upstart
=> default: end
=> default:
=> default: [2014-06-19T12:28:59+00:00] ERROR: Running exception handlers
=> default: [2014-06-19T12:28:59+00:00] ERROR: Exception handlers complete
=> default: [2014-06-19T12:28:59+00:00] FATAL: Stacktrace dumped to /var/chef/cache/chef-stacktrace.out
=> default: [2014-06-19T12:28:59+00:00] FATAL: Chef::Exceptions::Exec: service[mysql] (mysql::server line 218) had an e
ror: Chef::Exceptions::Exec: /sbin/restart mysql returned 1, expected 0

these are the settings I have changed 这些是我更改的设置

innodb_thread_concurrency = 2 * [numberofCPUs] + 2 
innodb_flush_log_at_trx_commit = 2 
thread_concurrency = [number of CPUs] * 3 
thread_cache_size = 32 
table_cache = 1024 
query_cache_size = 64M 
query_cache_limit = 2M 
join_buffer_size = 8M 
tmp_table_size = 256M 
key_buffer = 32M 
innodb_autoextend_increment=512 
max_allowed_packet = 16M 
max_heap_table_size = 256M 
read_buffer_size = 2M 
read_rnd_buffer_size = 16M 
bulk_insert_buffer_size = 64M 
myisam_sort_buffer_size = 128M 
myisam_max_sort_file_size = 10G 
myisam_max_extra_sort_file_size = 10G 
myisam_repair_threads = 1

for ssh access, use the command: 要进行ssh访问,请使用以下命令:

vagrant ssh

http://docs.vagrantup.com/v2/cli/ssh.html http://docs.vagrantup.com/v2/cli/ssh.html

overwrite attributes of cookbook is the best option,add this to vagrantfile 覆盖Cookbook的属性是最好的选择,请将其添加到vagrantfile

>   config.vm.provision: chef_solo do | chef |
>      chef.cookbooks_path = "cookbooks"
>      chef.data_bags_path = "data_bags"
>      chef.json = {
>         "mysql" => {
>            "tunable" => {
>              "myisam_sort_buffer_size" => "32M"
>           }
>         },
          "php" => {
           "more attributes" => "value"
          }
>      }
>      # List of recipes to run
>      chef.add_recipe "vagrant_main"
>      chef.add_recipe "vagrant_main :: wordpress"
>      chef.add_recipe "vagrant_main :: drupal"
>      chef.add_recipe "vagrant_main :: magento"
>      chef.add_recipe "vagrant_main :: nodejs"    end
>         end end

Read the doc of cookbook (README.md) to determine the attributes to overwrite 阅读食谱文档(README.md),以确定要覆盖的属性

vagrant doc: 流浪文档:

http://docs.vagrantup.com/v2/provisioning/chef_solo.html http://docs.vagrantup.com/v2/provisioning/chef_solo.html

sorry for my English 对不起我的英语不好

Best regards 最好的祝福

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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