forked from jayjanssen/vagrant-percona-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Vagrantfile.pxc-big.rb
93 lines (79 loc) · 2.8 KB
/
Vagrantfile.pxc-big.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Assumes a box from https://github.com/grypyrg/packer-percona
# This sets up 3 nodes with a common PXC, but you need to run bootstrap.sh to connect them.
require File.dirname(__FILE__) + '/lib/vagrant-common.rb'
pxc_version = "56"
# Node group counts and aws security groups (if using aws provider)
pxc_nodes = 3
pxc_node_name_prefix = "node"
# AWS configuration
aws_region = "us-west-1"
aws_ips='private' # Use 'public' for cross-region AWS. 'private' otherwise (or commented out)
pxc_security_groups = ['sg-b4438ad3']
cluster_address = 'gcomm://' + Array.new( pxc_nodes ){ |i| pxc_node_name_prefix + (i+1).to_s }.join(',')
Vagrant.configure("2") do |config|
config.vm.box = "grypyrg/centos-x86_64"
config.ssh.username = "vagrant"
# Create the PXC nodes
(1..pxc_nodes).each do |i|
name = pxc_node_name_prefix + i.to_s
config.vm.define name do |node_config|
node_config.vm.hostname = name
node_config.vm.network :private_network, type: "dhcp"
node_config.vm.provision :hostmanager
# Provisioners
provision_puppet( node_config, "pxc_server.pp" ) { |puppet|
puppet.facter = {
# PXC setup
"percona_server_version" => pxc_version,
'innodb_buffer_pool_size' => '12G',
'innodb_log_file_size' => '1G',
'innodb_flush_log_at_trx_commit' => '0',
'pxc_bootstrap_node' => (i == 1 ? true : false ),
'wsrep_cluster_address' => cluster_address,
'wsrep_provider_options' => 'gcache.size=128M; gcs.fc_limit=1024; evs.user_send_window=512; evs.send_window=512',
'wsrep_slave_threads' => 8,
# Sysbench setup on node 1
'sysbench_load' => (i == 1 ? true : false ),
'tables' => 20,
'rows' => 1000000,
'threads' => 8
}
}
# Providers
provider_virtualbox( nil, node_config, 18432 ) { |vb, override|
provision_puppet( override, "pxc_server.pp" ) { |puppet|
puppet.facter = {
'default_interface' => 'eth1',
'datadir_dev' => 'dm-2',
}
}
}
provider_vmware( name, node_config, 18432 ) { |vb, override|
provision_puppet( override, "pxc_server.pp" ) { |puppet|
puppet.facter = {
'default_interface' => 'eth1',
'datadir_dev' => 'dm-2',
}
}
}
provider_aws( "PXC #{name}", node_config, 'm3.xlarge', aws_region, pxc_security_groups, aws_ips) { |aws, override|
aws.block_device_mapping = [
{ 'DeviceName' => "/dev/sdb", 'VirtualName' => "ephemeral0" },
{ 'DeviceName' => "/dev/sdc", 'VirtualName' => "ephemeral1" }
]
provision_puppet( override, "pxc_server.pp" ) { |puppet|
puppet.facter = {
'softraid' => true,
'softraid_dev' => '/dev/md0',
'softraid_level' => 'stripe',
'softraid_devices' => '2',
'softraid_dev_str' => '/dev/xvdb /dev/xvdc',
'datadir_dev' => 'md0'
}
}
}
end
end
end