Multiple nodes on Vagrant

Recently I started working with Vagrant. A vagrant is a good tool that you can use for development. From this post, I’m going to explain how to create multiple nodes on the Vagrant project.

$ mkdir testProject
$ cd testProject
$ vagrant init

If you run above commands, it will create a Vagrant project for you. Now we have to do changes to the vagrant file. Your initial vagrant file will look like below.

You have to edit Vagrantfile add content like below.

Above sample vagrant file will create three nodes. Now run below command to start Vagrant virtual machines.

$ vagrant up

If you followed the instruction properly, you will get an output like below.

If you want to connect to the master node, run below command.

$ vagrant ssh master

If you want to connect to slave1 node, run below command.

$ vagrant ssh slave1

Whatever the machine you want to connect you just have to type vagrant ssh. Hope this will help you!

· vagrant