加速Vagrant上主机和guest虚拟机之间的同步延迟(NFS同步文件夹) [英] Speed up sync latency between host and guest on Vagrant (NFS sync folders)
问题描述
我使用vagrant在本地机器上运行wordpress开发环境,并将nfs设置为默认文件共享机制(我在Mac上)。除了一件事情之外,整体性能还是非常不错的:同步延迟。
我已经在guest上设置了grunt watchers来重新编译css / javascript,并且每次都重新生成页面文件更改。但是,当我在主机上保存一个文件时:在同步客户机之前需要1到10秒。
我希望能够保存主机,并立即查看客户反映的变化,然后触发咕噜咕噜的观察者去做所有我需要的事情。
有没有办法做到这一点?黑客强制同步一些文件与咕噜也许?
我尝试过rsync,它看起来更加迟钝。
谢谢
在这里找到答案 https://github.com/mitchellh/vagrant/问题/ 4204#issuecomment-49856008
只需在Vagrantfile的nfs共享中添加安装选项,这将使nfs在每次保存时几乎立即共享同步信息(<
config.vm.synced_folderwww /,/ srv / www /,:type => ; nfs,mount_options:['nolock,vers = 3,udp,noatime,actimeo = 1']
I'm using vagrant to run a wordpress dev environment on my local machine, have setup nfs as the default file-sharing mechanism (I'm on a mac). Overall performance is really good except for one thing: sync latency.
I have set up grunt watchers on the guest to recompile css / javascript as well as livereload the page on every file change. However when I save a file on the host: it takes between 1 and 10 second before syncing on the guest.
I'd like to be able to hit save on the host, and see changes being reflected on the guest immediately, which would then trigger the grunt watcher to do all the things I need it to do.
Is there a way to achieve this? Hack to force sync some files with grunt maybe? I've tried rsync and it seemed even worse latency wise.
Thanks
Found the answer here https://github.com/mitchellh/vagrant/issues/4204#issuecomment-49856008
Just add mount options to the nfs share in Vagrantfile, this will make nfs sharing sync almost instantly on every save (<500ms).
config.vm.synced_folder "www/", "/srv/www/", :type => "nfs", mount_options:['nolock,vers=3,udp,noatime,actimeo=1']
这篇关于加速Vagrant上主机和guest虚拟机之间的同步延迟(NFS同步文件夹)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!