How to handle data such as Mysql, web sites sources with Vagrant?

假装没事ソ 提交于 2019-12-07 06:49:14

问题


How to handle data such as Mysql, web sites sources with Vagrant ?

As a programmer, I like being able to easily set up environments for develop. So I created a vagrant box and provisioned it with puppet but I'm asking to myself, what about the data in the box ? What happen if I need to destroy the box and recreate it? All my data will be erased !

I had some problems with a crashed VM and I don't want to redo the same mistake, I want to have the control of my data.

How do you do ? Do you use shared folders to put your live data ? Where do you keep your data, in or out the box ?


回答1:


In the current version of Vagrant (1.0.3), you have two main options:

  1. Use shared folders. You can put your MySQL data directory into a shared folder so that the data comes back onto your host machine. The con of this is that shared folders are actually quite slow compared to the native VM filesystem in VirtualBox, and you can run into weird permission issues as well.
  2. Setup a task (rake, make, etc.) to copy your MySQL data to your shared folder on demand. Then, before you decide to destroy your VM, you can run the task to export your data to your shared folder, then you can reimport the data when you bring your VM back up.


来源:https://stackoverflow.com/questions/10698957/how-to-handle-data-such-as-mysql-web-sites-sources-with-vagrant

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!