How to use this box with Vagrant:

Vagrant.configure("2") do |config|
  config.vm.box = "zjj/centos7-docker"
end
vagrant init zjj/centos7-docker
vagrant up

This version was created 12 months ago.

centos7-docker 解决一些1.0.0中存在的问题,请使用新版本

1.简介

内置:centos7+docker(elasticsearch,kibana,nacos,rabbitmq,redis,mysql)

2.单机搭建

Vagrantfile配置文件内容:

Vagrant.configure("2") do |config|

  config.vm.box = "zjj/centos7-docker"
  config.vm.box_version = "1.0.1"
  # 屏蔽默认映射的2222端口防止报错
  config.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: "true"
  # 使用自定义端口映射(这里取2001-2100)需要手动修改
  config.vm.network "forwarded_port", guest: 22, host: 2000

  # 手动固定内网ip(这里取101-200)需要手动修改
  config.vm.network "private_network", ip: "192.168.56.100"

  # 设置主机与虚拟机的共享目录,屏蔽掉,不然会报错
  config.vm.synced_folder ".", "/vagrant", disabled: true

  config.vm.hostname = "node-single"
  # VirtaulBox相关配置
  config.vm.provider "virtualbox" do |v|
    # 设置虚拟机的名称
    v.name = "node-single"
    # 设置虚拟机的内存大小
    v.memory = 4096
    # 设置虚拟机的CPU个数
    v.cpus = 3
  end

  # 设置主机与虚拟机的共享目录,屏蔽掉,不然会报错
  config.vm.synced_folder ".", "/vagrant", disabled: true

 # 配置账号密码,vagrant ssh登录时会使用此账号密码
  config.ssh.username = "vagrant"
  config.ssh.password = "vagrant"

end

3. 集群搭建

Vagrantfile配置文件内容:

Vagrant.configure("2") do |config|
  (1..3).each do |i|
       config.vm.define "test#{i}" do |node|

           # 设置虚拟机的Box
           node.vm.box = "zjj/centos7-docker"
           node.vm.box_version = "1.0.1"

           # 设置虚拟机的主机名
           node.vm.hostname="test#{i}"

          # 屏蔽默认映射的2222端口防止报错
          node.vm.network "forwarded_port", guest: 22, host: 2222, id: "ssh", disabled: "true"
          # 使用自定义端口映射(这里取2001-2100)需要手动修改
          node.vm.network "forwarded_port", guest: 22, host: "#{2000+i}"

           # 设置虚拟机的IP
           node.vm.network "private_network", ip: "192.168.56.#{200+i}"

          #  config.ssh.host = "192.168.56.#{200+i}"
           config.ssh.username = "vagrant"
           config.ssh.password = "vagrant"

          # 设置主机与虚拟机的共享目录,屏蔽掉,不然会报错
          config.vm.synced_folder ".", "/vagrant", disabled: true

           # VirtaulBox相关配置
           node.vm.provider "virtualbox" do |v|
               # 设置虚拟机的名称
               v.name = "test#{i}"
               # 设置虚拟机的内存大小
               v.memory = 1024
               # 设置虚拟机的CPU个数
               v.cpus = 1
           end
       end
  end
end

4. docker映射地址

docker中所有服务的映射文件夹都在cd /mydata中进行映射,可自行调整

5.kibana配置

docker中kibana配置的elasticsearch地址需要手动修改

vim /mydata/kibana/config/kibana.yml

修改elasticsearch.hosts: [ "http://192.168.56.100:9200" ]成当前虚拟机的ip

1 provider for this version.
  • virtualbox
    unknown Hosted by Vagrant Cloud (2.33 GB)

This version was created 12 months ago.

【已过时,请下载最新版本】 centos7+ docker安装镜像:es kibana mysql redis

1 provider for this version.
  • virtualbox
    unknown Hosted by Vagrant Cloud (2.77 GB)