25 Oct 2016
The problem of IT in today that we have to faced is more and more access pressure, for solving this, cluster is the best way. So that’s why we need multiple vms, as metioned above, sometimes we need a web cluster to test.
configure like this in Vagrantfile
Vagrant.configure("2") do |config| config.vm.box = "d:\IMAGE-ISO\mycentos6.8.box" config.vm.define "node01" do |node01| node01.vm.hostname = "node01" node01.vm.network "private_network", ip: "192.168.33.101" end config.vm.define "node02" do |node02| node02.vm.hostname = "node02" node02.vm.network "private_network", ip: "192.168.33.102" end end
# get all vms up vagrant up # only get one vm up vagrant up hostname # how to ssh vms vagrant ssh hostname
Vagrant.configure("2") do |config| # The most common configuration options are documented and commented below. # For a complete reference, please see the online documentation at # https://docs.vagrantup.com. # Every Vagrant development environment requires a box. You can search for # boxes at https://vagrantcloud.com/search. config.vm.box = "centos/7" config.vm.define "node02" do |node02| node02.vm.hostname = "node02" node02.vm.network "private_network", ip: "192.168.33.62" end config.vm.define "node03" do |node03| node03.vm.hostname = "node03" node03.vm.network "private_network", ip: "192.168.33.63" config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine # vb.gui = true # Customize the amount of memory on the VM: vb.memory = "2048" end end config.vm.provider "virtualbox" do |vb| # Display the VirtualBox GUI when booting the machine # vb.gui = true # Customize the amount of memory on the VM: vb.memory = "1024" end end
可以直接在vm里面增加子级配置