Matthew Macdonald-Wallace
2010-Jul-27 21:27 UTC
[Puppet Users] Help with setting facts for MySQL replication
Hi all, I''m trying to work on a solution to setting up mysql in a semi-automated fashion using facts to populate a puppet template. I''m using Cobbler as my build system and I was hoping to pass the values needed for replicate_do_db and server_id as ksmeta information, however it''s looking increasingly unlikely that will work. Can anyone share how they configure MySQL for this kind of thing using puppet given that multiple servers may be replicating different databases and all servers require a unique ID? Thanks in advance, Matt -- Matthew Macdonald-Wallace lists@truthisfreedom.org.uk http://www.threedrunkensysadsonthe.net/ -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Tore
2010-Jul-28 12:49 UTC
[Puppet Users] Re: Help with setting facts for MySQL replication
I use cobbler and I push certain information to the kickstarting system via ksmeta, e.g.: cobbler system add --name=rhel-32bit --mac=XX:XX:XX:XX:XX:XX [...] -- ksmeta="swap=256 puppet=true" This example allows us to define the swap size and if puppet should be installed and configured. We use the last part alot to allow people to deploy a test node which have a lifespan of <7 days. Is this helpful? On 27 Jul, 23:27, Matthew Macdonald-Wallace <li...@truthisfreedom.org.uk> wrote:> Hi all, > > I''m trying to work on a solution to setting up mysql in a semi-automated > fashion using facts to populate a puppet template. > > I''m using Cobbler as my build system and I was hoping to pass the values > needed for replicate_do_db and server_id as ksmeta information, however > it''s looking increasingly unlikely that will work. > > Can anyone share how they configure MySQL for this kind of thing using > puppet given that multiple servers may be replicating different > databases and all servers require a unique ID? > > Thanks in advance, > > Matt > -- > Matthew Macdonald-Wallace > li...@truthisfreedom.org.ukhttp://www.threedrunkensysadsonthe.net/-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Disconnect
2010-Jul-28 15:42 UTC
Re: [Puppet Users] Re: Help with setting facts for MySQL replication
I use a custom fact in modules/mysql/lib/facter/server_id.rb: # Converts ip address to long for mysql id def get_mysql_id mysql_id = nil; mysql_id = Facter.ipaddress.split(''.'').inject(0) {|total,value| (total << 8 ) + value.to_i} end Facter.add("mysql_server_id") do setcode do get_mysql_id end end Then the mysql_id is used by the template as the node id. On Wed, Jul 28, 2010 at 8:49 AM, Tore <tore.lonoy@gmail.com> wrote:> I use cobbler and I push certain information to the kickstarting > system via ksmeta, e.g.: > > cobbler system add --name=rhel-32bit --mac=XX:XX:XX:XX:XX:XX [...] -- > ksmeta="swap=256 puppet=true" > > This example allows us to define the swap size and if puppet should be > installed and configured. We use the last part alot to allow people to > deploy a test node which have a lifespan of <7 days. > > Is this helpful? > > On 27 Jul, 23:27, Matthew Macdonald-Wallace > <li...@truthisfreedom.org.uk> wrote: > > Hi all, > > > > I''m trying to work on a solution to setting up mysql in a semi-automated > > fashion using facts to populate a puppet template. > > > > I''m using Cobbler as my build system and I was hoping to pass the values > > needed for replicate_do_db and server_id as ksmeta information, however > > it''s looking increasingly unlikely that will work. > > > > Can anyone share how they configure MySQL for this kind of thing using > > puppet given that multiple servers may be replicating different > > databases and all servers require a unique ID? > > > > Thanks in advance, > > > > Matt > > -- > > Matthew Macdonald-Wallace > > li...@truthisfreedom.org.ukhttp://www.threedrunkensysadsonthe.net/ > > -- > You received this message because you are subscribed to the Google Groups > "Puppet Users" group. > To post to this group, send email to puppet-users@googlegroups.com. > To unsubscribe from this group, send email to > puppet-users+unsubscribe@googlegroups.com<puppet-users%2Bunsubscribe@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/puppet-users?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Marc Fournier
2010-Jul-28 15:48 UTC
Re: [Puppet Users] Help with setting facts for MySQL replication
Hello,> Can anyone share how they configure MySQL for this kind of thing using > puppet given that multiple servers may be replicating different > databases and all servers require a unique ID?This all boils down to each host having different options in it''s my.cnf file. There is an official augeas lens for editing mysql''s my.cnf file since a couple of days (not in any release yet). If this can be of any help, I used this code for a basic "1 master-1 slave" setup on a few projects: class mysql::master inherits mysql::server { augeas { "my.cnf/replication": context => "/files/etc/my.cnf/mysqld/", changes => [ "set log-bin mysql-bin", "set server-id ${mysql_serverid}", "set expire_logs_days 7", "set max_binlog_size 100M" ], } } class mysql::slave inherits mysql::master { augeas { "my.cnf/slave-replication": context => "/files/etc/my.cnf/mysqld/", changes => [ "set relay-log /var/lib/mysql/mysql-relay-bin", "set relay-log-index /var/lib/mysql/mysql-relay-bin.index", "set relay-log-info-file /var/lib/mysql/relay-log.info", "set relay_log_space_limit 2048M", "set max_relay_log_size 100M", "set master-host ${mysql_masterhost}", "set master-user ${mysql_masteruser}", "set master-password ${mysql_masterpw}", "set report-host ${hostname}" ], } } I used a home-brew augeas lens though. I''m not sure the paths are exactly the same with the official one. Cheers, Marc -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Charlotte McLaughlin
2013-May-14 16:28 UTC
Re: [Puppet Users] Re: Help with setting facts for MySQL replication
I put server_id.rb in /etc/puppetlabs/puppet/environments/qa/ecm-puppet/ecm/lib/facter/server_id.rb on puppet server how do you build upon this to create a master-slave relationship through puppet. I have a mysql db on db01.xxx.xxx and a slave on db02.xxx.xxx Thanks Mac On Wednesday, July 28, 2010 8:42:49 AM UTC-7, Disconnect wrote:> > I use a custom fact in modules/mysql/lib/facter/server_id.rb: > # Converts ip address to long for mysql id > def get_mysql_id > mysql_id = nil; > mysql_id = Facter.ipaddress.split(''.'').inject(0) {|total,value| (total > << 8 ) + value.to_i} > end > > Facter.add("mysql_server_id") do > setcode do > get_mysql_id > end > end > > Then the mysql_id is used by the template as the node id. > > On Wed, Jul 28, 2010 at 8:49 AM, Tore <tore....@gmail.com <javascript:>>wrote: > >> I use cobbler and I push certain information to the kickstarting >> system via ksmeta, e.g.: >> >> cobbler system add --name=rhel-32bit --mac=XX:XX:XX:XX:XX:XX [...] -- >> ksmeta="swap=256 puppet=true" >> >> This example allows us to define the swap size and if puppet should be >> installed and configured. We use the last part alot to allow people to >> deploy a test node which have a lifespan of <7 days. >> >> Is this helpful? >> >> On 27 Jul, 23:27, Matthew Macdonald-Wallace >> <li...@truthisfreedom.org.uk> wrote: >> > Hi all, >> > >> > I''m trying to work on a solution to setting up mysql in a semi-automated >> > fashion using facts to populate a puppet template. >> > >> > I''m using Cobbler as my build system and I was hoping to pass the values >> > needed for replicate_do_db and server_id as ksmeta information, however >> > it''s looking increasingly unlikely that will work. >> > >> > Can anyone share how they configure MySQL for this kind of thing using >> > puppet given that multiple servers may be replicating different >> > databases and all servers require a unique ID? >> > >> > Thanks in advance, >> > >> > Matt >> > -- >> > Matthew Macdonald-Wallace >> > li...@truthisfreedom.org.ukhttp://www.threedrunkensysadsonthe.net/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> puppet-users...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
Charlotte McLaughlin
2013-May-14 16:31 UTC
Re: [Puppet Users] Re: Help with setting facts for MySQL replication
I put server_id.rb at /etc/puppetlabs/puppet/environments/qa/ecm-puppet/ecm/lib/facter/server_id.rb how do i build on this to create a master-slave replication db01.xxx.xxx(master) db02.xxx.xxx(slave). Thanks Mac On Wednesday, July 28, 2010 8:42:49 AM UTC-7, Disconnect wrote:> > I use a custom fact in modules/mysql/lib/facter/server_id.rb: > # Converts ip address to long for mysql id > def get_mysql_id > mysql_id = nil; > mysql_id = Facter.ipaddress.split(''.'').inject(0) {|total,value| (total > << 8 ) + value.to_i} > end > > Facter.add("mysql_server_id") do > setcode do > get_mysql_id > end > end > > Then the mysql_id is used by the template as the node id. > > On Wed, Jul 28, 2010 at 8:49 AM, Tore <tore....@gmail.com <javascript:>>wrote: > >> I use cobbler and I push certain information to the kickstarting >> system via ksmeta, e.g.: >> >> cobbler system add --name=rhel-32bit --mac=XX:XX:XX:XX:XX:XX [...] -- >> ksmeta="swap=256 puppet=true" >> >> This example allows us to define the swap size and if puppet should be >> installed and configured. We use the last part alot to allow people to >> deploy a test node which have a lifespan of <7 days. >> >> Is this helpful? >> >> On 27 Jul, 23:27, Matthew Macdonald-Wallace >> <li...@truthisfreedom.org.uk> wrote: >> > Hi all, >> > >> > I''m trying to work on a solution to setting up mysql in a semi-automated >> > fashion using facts to populate a puppet template. >> > >> > I''m using Cobbler as my build system and I was hoping to pass the values >> > needed for replicate_do_db and server_id as ksmeta information, however >> > it''s looking increasingly unlikely that will work. >> > >> > Can anyone share how they configure MySQL for this kind of thing using >> > puppet given that multiple servers may be replicating different >> > databases and all servers require a unique ID? >> > >> > Thanks in advance, >> > >> > Matt >> > -- >> > Matthew Macdonald-Wallace >> > li...@truthisfreedom.org.ukhttp://www.threedrunkensysadsonthe.net/ >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Puppet Users" group. >> To post to this group, send email to puppet...@googlegroups.com<javascript:> >> . >> To unsubscribe from this group, send email to >> puppet-users...@googlegroups.com <javascript:>. >> For more options, visit this group at >> http://groups.google.com/group/puppet-users?hl=en. >> >> >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscribe@googlegroups.com. To post to this group, send email to puppet-users@googlegroups.com. Visit this group at http://groups.google.com/group/puppet-users?hl=en. For more options, visit https://groups.google.com/groups/opt_out.