forked from jayjanssen/vagrant-percona-deprecated
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Vagrantfile.pxc.rb
106 lines (85 loc) · 3.32 KB
/
Vagrantfile.pxc.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
94
95
96
97
98
99
100
101
102
103
104
105
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Assumes a box from https://github.com/jayjanssen/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-east-1"
aws_ips='private' # Use 'public' for cross-region AWS. 'private' otherwise (or commented out)
pxc_security_groups = []
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 = "perconajayj/centos-x86_64"
config.ssh.username = "root"
# 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' => '128M',
'innodb_log_file_size' => '64M',
'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=128',
# Sysbench setup
'sysbench_load' => (i == 1 ? true : false ),
'tables' => 1,
'rows' => 100000,
'threads' => 8,
# PCT setup
'percona_agent_api_key' => ENV['PERCONA_AGENT_API_KEY']
}
}
# Providers
provider_virtualbox( name, node_config, 1024 ) { |vb, override|
provision_puppet( override, "pxc_server.pp" ) {|puppet|
puppet.facter = {
'default_interface' => 'eth1',
# PXC Setup
'datadir_dev' => 'dm-2',
}
}
}
provider_vmware( name, node_config, 1024 ) { |vb, override|
provision_puppet( override, "pxc_server.pp" ) {|puppet|
puppet.facter = {
'default_interface' => 'eth1',
# PXC Setup
'datadir_dev' => 'dm-2',
}
}
}
provider_aws( name, node_config, 't2.small', aws_region, pxc_security_groups, aws_ips) { |aws, override|
aws.block_device_mapping = [
{
'DeviceName' => "/dev/sdl",
'VirtualName' => "mysql_data",
'Ebs.VolumeSize' => 20,
'Ebs.DeleteOnTermination' => true,
}
]
provision_puppet( override, "pxc_server.pp" ) {|puppet| puppet.facter = { 'datadir_dev' => 'xvdl' }}
}
provider_openstack( name, node_config, 'm1.xlarge', nil, 'cc7e31d8-a4aa-4544-8a74-86dfd06655d7' ) { |os, override|
os.disks = [
{ "name" => "#{name}-data", "size" => 100, "description" => "MySQL Data"}
]
provision_puppet( override, "pxc_server.pp" ) { |puppet|
puppet.facter = {'datadir_dev' => 'vdb'}
}
}
end
end
end