diff options
-rw-r--r-- | files/machine_types.rb | 81 |
1 files changed, 81 insertions, 0 deletions
diff --git a/files/machine_types.rb b/files/machine_types.rb index 799ed81..57b2904 100644 --- a/files/machine_types.rb +++ b/files/machine_types.rb @@ -39,6 +39,47 @@ # set_desc "The machine to send syslog output to" # end + +# The facts that start with mysql are used by the MySQL configuration variations. Each fact has an associated description +# and you can look at the facts for each machine type to get a better understanding of the machine configurations. +newfact("mysql_grade") do + set_desc "The MySQL grade that you want installed. The valid values for this fact are 'community' and 'fedora'. The difference\n" + + "between community and fedora is that community installs a package called MySQL-*-community and is the latest from MySQL labs\n" + + "the 'fedora' grade installs the latest mysql package from the fedora distro" + set_default "community" +end + +newfact("mysql_type") do + set_desc "The type of Mysql server: standalone, primary-master, secondary-master or slave\n" + + "standalone - A Standalone MySQL server is one that does not require binnary logging\n" + + "\t\tand has no replication configuration.\n" + + "primary-master - A Primary Master Mysql server is one that has master to master\n" + + "\t\treplication configured. NOTE: you want to add new schemas to the\n" + + "\t\tprimary master and replicationed to the secondary master. Be sure\n" + + "\t\tthe master to master configuration is working.\n" + + "\t\tsecondary-master - A Secondary Master Mysql server is one that has master to master\n" + + "\t\treplication configured. A Secondary Master for our purpose is a\n" + + "\t\tread only copy of the Primary Master. All updates will be per-\n" + + "\t\tformed on the Primary Master and passed to the Secondary Master.\n" + + "Slave - A Slave Mysql server is one that is connected to a Primary Master server and\n" + + "\t\tis used for recovery or read-only.\n" + + "Options: standalone, primiary-master, secondary-master and slave" + set_default "standalone" +end + +newfact("mysql_server_id") do + set_desc "Server ID for MySQL Replication. The default is fine if " + + "you are using a standalone mysql type. If you are creating " + + "master or slave server the mysql_server_id must be unique. " + set_default "1" +end + +newfact("mysql_master_ip_address") do + set_desc "MySQL Replication requires the IP address of the Master " + + "to establish communication between either the Master " + + "to Slave configuration or a Master to Master configuration." +end + ############################################################################## # Machines definitions go here. It is important that this happens after the # # fact declarations. Aside from that, order does not matter. # @@ -50,6 +91,10 @@ # class in your custom machine. classes_on_all_machine_types "genomerepo::client" +MYSQL_BASE_FACTS = %w{ mysql_server_id mysql_grade} +MYSQL_REPLICATION_FACTS = %w{ mysql_master_ip_address } +MYSQL_REPLICATION_DS_FACTS = %w{ mysql_type } + # newmachine("jboss-dev") do # include_facts "logserver" # set_classes "jboss::dev", "java", "jboss::server::web", @@ -60,3 +105,39 @@ classes_on_all_machine_types "genomerepo::client" newmachine("django-example") do set_classes "django::server" end + +newmachine("mysql-standalone") do + include_facts(*MYSQL_BASE_FACTS) + set_classes "mysql::standalone" +end + +# This machine is the master mysql node in a master-to-slave configuration. You should set this machine before you set up the slave. +newmachine("mysql-m2s") do + include_facts(*MYSQL_BASE_FACTS) + set_classes "mysql::m2s" +end + +# This machine is the slave mysql node in a master-to-slave configuration. You should set this machine after you set up the master. +newmachine("mysql-slave") do + include_facts(*MYSQL_BASE_FACTS + MYSQL_REPLICATION_FACTS) + set_classes "mysql::slave" +end + +# This is the machine configuration for *both* sides of a master-to-master configuration. During bootstrap time, you will be asked +# for appropriate configuration options to setup each of the masters. When setting up a master to master configuration, you have a bit +# of a "chicken and the egg" situation where you don't yet know the ip address of the machines, and each of the masters need to know +# the ip address of one another. So, you'll have to update your puppet configuration with the correct ipaddresses *after* these machines +# are provisioned, then run puppet --test on each of the machines in the following sequence: +# +# 1) bootstrap the primary master, expect to see a puppet error due to replication failure (the secondary master doesn't exist yet) +# 2) boostrap the secondary master, you should have entered the correct ip address for the primary so you should not see any puppet errors. +# 3) change the mysql_master_ip_address server parameter for the primary master machine configuration, then run puppetd --test +# on the primary master and you should see replication succeed (no errors). +# To verify replication is working from each node do the following: +# 1) connect to mysql as the replication users : msyql -u replication -p (this is setup in your password puppet manifest) +# 2) execute the following: show master status; show slave status \G +newmachine("mysql-m2m") do + include_facts(*MYSQL_BASE_FACTS + MYSQL_REPLICATION_FACTS) + set_classes "mysql::m2m" +end + |