Vagrant 로 여러 개의 머신을 생성할 때 사용되는 Vagrantfile 예시
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# 첫번째 서버 : master
config.vm.define "master_server" do |cfg|
cfg.vm.box = "centos/7"
cfg.vm.network "private_network", ip: "192.168.1.101"
cfg.vm.network "forwarded_port", guest: 15672, host: 15672
cfg.vm.host_name = "master"
cfg.vm.provider :virtualbox do |vb|
vb.memory = 2048
vb.cpus = 2
end
end
# 두번째 서버 : slave
config.vm.define "slave_server" do |cfg|
cfg.vm.box = "centos/7"
cfg.vm.network "private_network", ip: "192.168.1.102"
cfg.vm.host_name = "slave"
end
# 글로벌 설정
# 따로 cpu 갯수와 memory를 적지 않았다면, 기본으로 설정될 값
config.vm.provider "virtualbox" do |vb|
vb.cpus = 2
vb.memory = 1024
end
end
vagrant up
kabbyui-MacBookPro:vagrant kabby$ vagrant up
Bringing machine 'master_server' up with 'virtualbox' provider...
Bringing machine 'slave_server' up with 'virtualbox' provider...
==> master_server: Importing base box 'centos/7'...
==> master_server: Matching MAC address for NAT networking...
==> master_server: Checking if box 'centos/7' version '2004.01' is up to date...
==> master_server: Setting the name of the VM: vagrant_master_server_1606646208249_78676
==> master_server: Clearing any previously set network interfaces...
==> master_server: Preparing network interfaces based on configuration...
master_server: Adapter 1: nat
master_server: Adapter 2: hostonly
==> master_server: Forwarding ports...
master_server: 15672 (guest) => 15672 (host) (adapter 1)
master_server: 22 (guest) => 2222 (host) (adapter 1)
==> master_server: Running 'pre-boot' VM customizations...
==> master_server: Booting VM...
==> master_server: Waiting for machine to boot. This may take a few minutes...
master_server: SSH address: 127.0.0.1:2222
master_server: SSH username: vagrant
master_server: SSH auth method: private key
master_server:
master_server: Vagrant insecure key detected. Vagrant will automatically replace
master_server: this with a newly generated keypair for better security.
master_server:
master_server: Inserting generated public key within guest...
master_server: Removing insecure key from the guest if it's present...
master_server: Key inserted! Disconnecting and reconnecting using new SSH key...
==> master_server: Machine booted and ready!
==> master_server: Checking for guest additions in VM...
master_server: No guest additions were detected on the base box for this VM! Guest
master_server: additions are required for forwarded ports, shared folders, host only
master_server: networking, and more. If SSH fails on this machine, please install
master_server: the guest additions and repackage the box to continue.
master_server:
master_server: This is not an error message; everything may continue to work properly,
master_server: in which case you may ignore this message.
==> master_server: Setting hostname...
==> master_server: Configuring and enabling network interfaces...
==> master_server: Rsyncing folder: /Users/jeong/Desktop/vagrant/ => /vagrant
==> slave_server: Importing base box 'centos/7'...
==> slave_server: Matching MAC address for NAT networking...
==> slave_server: Checking if box 'centos/7' version '2004.01' is up to date...
==> slave_server: Setting the name of the VM: vagrant_slave_server_1606646237337_62979
==> slave_server: Fixed port collision for 22 => 2222. Now on port 2200.
==> slave_server: Clearing any previously set network interfaces...
==> slave_server: Preparing network interfaces based on configuration...
slave_server: Adapter 1: nat
slave_server: Adapter 2: hostonly
==> slave_server: Forwarding ports...
slave_server: 22 (guest) => 2200 (host) (adapter 1)
==> slave_server: Running 'pre-boot' VM customizations...
==> slave_server: Booting VM...
==> slave_server: Waiting for machine to boot. This may take a few minutes...
slave_server: SSH address: 127.0.0.1:2200
slave_server: SSH username: vagrant
slave_server: SSH auth method: private key
slave_server:
slave_server: Vagrant insecure key detected. Vagrant will automatically replace
slave_server: this with a newly generated keypair for better security.
slave_server:
slave_server: Inserting generated public key within guest...
slave_server: Removing insecure key from the guest if it's present...
slave_server: Key inserted! Disconnecting and reconnecting using new SSH key...
==> slave_server: Machine booted and ready!
==> slave_server: Checking for guest additions in VM...
slave_server: No guest additions were detected on the base box for this VM! Guest
slave_server: additions are required for forwarded ports, shared folders, host only
slave_server: networking, and more. If SSH fails on this machine, please install
slave_server: the guest additions and repackage the box to continue.
slave_server:
slave_server: This is not an error message; everything may continue to work properly,
slave_server: in which case you may ignore this message.
==> slave_server: Setting hostname...
==> slave_server: Configuring and enabling network interfaces...
==> slave_server: Rsyncing folder: /Users/kabby/Desktop/vagrant/ => /vagrant
'IT > Infra' 카테고리의 다른 글
[Centos7] RabbitMQ Cluster 구성 (0) | 2020.11.29 |
---|---|
[Centos7] Rabbitmq 설치 (Feat. yum Repo 설치) (0) | 2020.11.29 |
[Docker] Consul 설치 하기 (Feat.Mac) (0) | 2020.10.24 |
[Mac] Rabbit MQ 설치 (0) | 2020.10.11 |
[Docker] MinIO 객체 스토리지 (0) | 2020.08.05 |