处理 vagrant Homestead 响应慢小记

环境

Homestead box:
Homestead: v8.2.0
vagrant: 2.2.4

  1. Homestead中 安装nfs-kernel-server
sudo apt-get install nfs-kernel-server
rpcinfo -p
  1. 编辑 Homestead.yaml 文件,给folders: 节点下的 to:下面新增type: nfs

如:

ip: "192.168.10.10"
memory: 4098
cpus: 1
provider: virtualbox
box: laravel/homestead
authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: D:/workspace/php/laravel
      to: /home/vagrant/code/laravel
      type: nfs
  1. 安装 vagrant vagrant-winnfsd 插件
vagrant plugin install vagrant-winnfsd
  1. 重启vagrant
vagrant provision
vagrant reload

在运行了vagrant reload之后,mount.nfs 连接超时

[NFS] Status: halted
[NFS] Start: started
==> homestead-7: Mounting NFS shared folders...

The following SSH command responded with a non-zero exit status.
Vagrant assumes that this means the command failed!

mount -o vers=3,udp,actimeo=1,nolock,noatime 192.168.10.1:/D/workspace/php/laravel1 /home/vagrant/code/laravel1

Stdout from the command:



Stderr from the command:

mount.nfs: Connection timed out

如果需要挂载的站点访问快,在 Homestead.yamlfolders 下添加type: nfs,但不可以给太多站点加type: nfs,可能会出现mount.nfs: Connection timed out 的提示错误,导致挂载文件夹失败

References
  1. 解决vagrant上使用Homestead很慢(响应速度10s+)
  2. I get this during the mount 发现 Homestead.yaml 文件 中可以添加mongodb: false mariadb: false postgresql: false
  3. mount.nfs: Connection timed out 安装了``
  4. VirtualBox 虚拟机里网络很慢的解决方法 了解到 time可以获取请求时间
posted @ 2019-08-11 15:49  五毛钱的饼  阅读(916)  评论(0编辑  收藏  举报