• vagrant多节点配置


    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

  • 相关阅读:
    python之变量与常量
    Python之历史
    关于图像重采样插值算法
    常用的日期的方法
    数组常用的方法
    判断鼠标进入容器方向
    用JS实现一个时钟的效果
    搞定flex布局
    整理 45 道 CSS 基础面试题(附答案)
    CSS实战3
  • 原文地址:https://www.cnblogs.com/xinjie10001/p/6813070.html
Copyright © 2020-2023  润新知