1.vagrantfile的配置
Vagrant.configure("2") do |config|
config.vm.box = "xinjieLinux"
config.vm.define :master do |mfsmaster_config|
mfsmaster_config.vm.network "private_network", ip: "192.168.33.10"
config.vm.provider :virtualbox do |vb|
vb.name = "mfsmaster"
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.cpus = 2
end
config.vm.synced_folder "./share_dir", "/vagrant", create: true, owner: "root", group: "root", mount_options: ["dmode=755","fmode=644"], type: "rsync"
end
config.vm.define :slave1 do |metalogger_config|
metalogger_config.vm.hostname = "metalogger.vagrant.internal"
metalogger_config.vm.network "private_network", ip: "192.168.33.30",auto_config: true
metalogger_config.vm.provider "virtualbox" do |vb|
vb.name = "metalogger"
vb.customize ["modifyvm", :id, "--cpuexecutioncap", "50"]
vb.customize ["modifyvm", :id, "--memory", "1024"]
vb.customize ["modifyvm", :id, "--cpus", "2"]
vb.cpus = 2
end
metalogger_config.vm.synced_folder "./share_dir", "/vagrant", create: true, owner: "root", group: "root", mount_options: ["dmode=755","fmode=644"], type: "rsync"
end
config.vm.define :slave2 do |mfsclient_config|
mfsclient_config.vm.hostname = "mfsclient.vagrant.internal"
mfsclient_config.vm.network "private_network", ip: "192.168.33.40",auto_config: true
mfsclient_config.vm.provider "virtualbox" do |vb|
vb.name = "mfsclient"
end
mfsclient_config.vm.synced_folder "./share_dir", "/vagrant", create: true, owner: "root", group: "root", mount_options: ["dmode=755","fmode=644"], type: "rsync"
end
end
2.配置完三台虚拟机后ip地址其实还是没有生效的,此时要进入虚拟机重启虚拟机网卡
systemctl restart network