可以看到,与创建单个虚拟机比拟,这里多了财揭捉?环,而变量 i 可以用于设置节点的名称与IP,应用#{i}取值:
- (0..10).each do |i|
- end
plugin
根据网友KiwenLau的文┞仿里提到了一个缺点
VirtualBox 设置共享目次时须要在虚拟机中安装VirtualBox Guest Additions,这个 Vagrant会主动安装。然则,VirtualBox Guest Additions是内核模块,当虚拟机的内核进级之后,VirtualBox Guest Additions会掉效,导致共享目次挂载掉败,掉足信息如下:
- Failed to mount folders in Linux guest. This is usually because
- the “vboxsf” file system is not available. Please verify that
- the guest additions are properly installed in the guest and
- can work properly. The command attempted was:
- mount -t vboxsf -o uid=id -u vagrant,gid=getent group vagrant | cut -d: -f3 vagrant /vagrant
- mount -t vboxsf -o uid=id -u vagrant,gid=id -g vagrant vagrant /vagrant
- The error output from the last command was:
- stdin: is not a tty
- /sbin/mount.vboxsf: mounting failed with the error: No such device
安装 Vagrant 插件vagrant-vbguest可以解决这个问题,因为该插件会在虚拟机内核进级之后从新安装VirtualBox Guest Additions。
- $ vagrant plugin install vagrant-vbguest
【编辑推荐】
- 软件定义存储在VMware虚拟化情况中的应用
- 容量治理在虚拟化情况中至关重要
- 若何安装并设置Vagrant?
- 在Windows上应用Vagrant碰到的坑
- vagrant 做测试情况的一点总结(上)
这里的设置和前面我们单机设置设备类似,只是我们应用了:web以及:db分別做了两个VM的设置,并且给每个VM设置了不合的hostname和IP,设置好之后再应用vagrant up将虚拟机跑起来:
推荐阅读
沙龙晃荡 | 3月31日 京东、微博、华为拭魅战专家与你合营商量容器技巧实践! 比来有微博网友爆料称,某观光网站预订酒店办事有“杀熟欺生”的嫌疑:当碰到当机不断的新用户或花费>>>详细阅读
地址:http://www.17bianji.com/lsqh/40999.html
1/2 1