目前,我正在使用Vagrant 1.4.3与运行Unix(Centos)的VirtualBox一起用于我的开发服务器(使用MariaDB)。
我自己没有设置盒子(因此我对此设置的了解有限)我基本上想做以下事情(如果可能的话)......
请注意我可以理解,执行此操作的完整说明可能超出了StackOverflow的范围。
基本上我想:
例如,假设“数据库1”具有端口3306并且将是主设备,而“数据库2”具有端口4406将是从设备。我希望对数据库1所做的任何更改都自动“推送”到数据库2。
我以前从未这样做过。
对此问题的任何建议都会受到赞赏,我认为我不是唯一一个在使用mysql-replication时苦苦挣扎的人:)
如果有帮助 - 我目前的流浪文件如下所示:
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Config Github Settings
github_username = "ACMEINC"
github_repo = "vagrant"
github_tag = "0.11"
github_path = "https://raw.github.com/#{github_username}/#{github_repo}/#{github_tag}/"
# Server Configuration
# Set a local private network IP address.
# See http://en.wikipedia.org/wiki/Private_network for explanation
# You can use the following IP ranges:
# 10.0.0.1 - 10.255.255.254
# 172.16.0.1 - 172.31.255.254
# 192.168.0.1 - 192.168.255.254
server_ip = "192.168.30.10"
server_memory = "4096" # MB
server_timezone = "UTC"
server_cpuexecutioncap = "90"
server_cpus = 4
nginx_port = "80"
varnish_port = "5580"
nodejs_version = "latest" # By default "latest" will equal the latest stable version
nodejs_packages = [] # List any global NodeJS packages that you want to install
ruby_version = "2.1.1"
# Lets do this
Vagrant.configure(2) do |config|
# Which box are we using?
config.vm.box = "centos-65-x64-virtualbox-nocm"
config.vm.box_url = "http://puppet-vagrant-boxes.puppetlabs.com/centos-65-x64-virtualbox-nocm.box"
# Network settings
config.vm.hostname = "vagrant"
config.vm.network "private_network", ip: server_ip
# Port forwarding
config.vm.network "forwarded_port", guest: 35729, host: 35729 #LiveReload
config.vm.network "forwarded_port", guest: 80, host: 8081 #HTTP
# Folder sharing
config.vm.synced_folder ".", "/vagrant"
# id: "core",
# type: "nfs",
# :mount_options => ['nolock,vers=3,udp,noatime']
# Virtualbox settings
config.vm.provider "virtualbox" do |vb|
# Set memory
vb.customize ["modifyvm", :id, "--memory", server_memory]
# Trying to speed things up a bit http://www.adrikodde.nl/blog/2013/tips-debug-slow-vagrant-box/
vb.customize ["modifyvm", :id, "--cpuexecutioncap", server_cpuexecutioncap]
vb.customize ["modifyvm", :id, "--cpus", server_cpus]
# Set the timesync threshold to 10 seconds, instead of the default 20 minutes.
# If the clock gets more than 15 minutes out of sync (due to your laptop going
# to sleep for instance, then some 3rd party services will reject requests.
vb.customize ["guestproperty", "set", :id, "/VirtualBox/GuestAdd/VBoxService/--timesync-set-threshold", 10000]
# Prevent VMs running on Ubuntu to lose internet connection
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
vb.customize ["modifyvm", :id, "--natdnsproxy1", "on"]
end
# Configure cached packages to be shared between instances of the same base box.
# More info on http://fgrehm.viewdocs.io/vagrant-cachier/usage
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.scope = :box
end
# Provision Base Packages
config.vm.provision "shell", path: "#{github_path}scripts/base.sh"
# Provision PHP 5.4
config.vm.provision "shell", path: "#{github_path}scripts/php54.sh"
# Install Nodejs
config.vm.provision "shell", path: "#{github_path}scripts/nodejs.sh", privileged: false, args: nodejs_packages.unshift(nodejs_version)
# Install rbenv
config.vm.provision "shell", path: "#{github_path}scripts/rbenv.sh", privileged: false, args: ruby_version
# Provision Nginx
config.vm.provision "shell", path: "#{github_path}scripts/nginx.sh", args: [server_ip, nginx_port]
# Provision MariaDB
config.vm.provision "shell", path: "#{github_path}scripts/mariadb55.sh"
# Install AMQP
config.vm.provision "shell", path: "#{github_path}scripts/amqp.sh"
# Install APC
config.vm.provision "shell", path: "#{github_path}scripts/apc.sh"
# Install RabbitMQ
config.vm.provision "shell", path: "#{github_path}scripts/rabbitmq.sh"
# Install Supervisord
config.vm.provision "shell", path: "#{github_path}scripts/supervisord.sh"
# Install Phantomjs
config.vm.provision "shell", path: "#{github_path}scripts/phantomjs.sh"
# Install Varnish
config.vm.provision "shell", path: "#{github_path}scripts/varnish.sh", args: [server_ip, nginx_port, varnish_port]
# Install fonts
config.vm.provision "shell", path: "#{github_path}scripts/fonts.sh"
# Finalise install
config.vm.provision "shell", path: "#{github_path}scripts/finalise.sh", privileged: false
end