MySQL Cookbook


#1

Hello

In attributes/server.rb

There is the use of node[“mysql”][“version”]. But I don’t see where that
gets set. Could someone explain that to me?

Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893


#2

Does no one know how this is supposed to work?

=================================================
Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893

On 2013-03-21 15:23, Steven Barre wrote:

Hello

In attributes/server.rb
https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47

There is the use of node[“mysql”][“version”]. But I don’t see where
that gets set. Could someone explain that to me?


#3

I discovered that I had to set it manually.

On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

Does no one know how this is supposed to work?

==============================**===================
Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.**com steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893
==============================**====================

On 2013-03-21 15:23, Steven Barre wrote:

Hello

In attributes/server.rb
https://github.com/opscode-cookbooks/mysql/blob/
bfabce615dffe144a161bc5979873a**7e9811f172/attributes/server.**rb#L41-47https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47

There is the use of node[“mysql”][“version”]. But I don’t see where that
gets set. Could someone explain that to me?


#4

Same here, i set it in the database server role for our nodes… it seems
undocumented, and i was waiting / hoping whomever added that code would
comment here

On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown aaron@9minutesnooze.comwrote:

I discovered that I had to set it manually.

On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

Does no one know how this is supposed to work?

==============================**===================
Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.**com steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893
==============================**====================

On 2013-03-21 15:23, Steven Barre wrote:

Hello

In attributes/server.rb
https://github.com/opscode-cookbooks/mysql/blob/
bfabce615dffe144a161bc5979873a**7e9811f172/attributes/server.**rb#L41-47https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47

There is the use of node[“mysql”][“version”]. But I don’t see where that
gets set. Could someone explain that to me?


#5

I’ve also been wondering why some attributes are “tuneable” and others
are not. I also noticed the config file seems to just be the stock
ubuntu one with a few modifications.

I’m also trying to understand why mysql is installed, started, and then
the conf file is changed then mysql restarted. Wouldn’t it make more
sense to have the config file set up before the first run of mysql?
Things like pid file and innodb log files don’t handle changing very
well. (as pointed out here http://tickets.opscode.com/browse/COOK-2100)

I’m starting to think this need some rewriting … I’ll volunteer, but
I’m new at this. Some input from others would be appreciated.

=================================================
Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893

On 2013-03-26 14:07, Jesse Campbell wrote:

Same here, i set it in the database server role for our nodes… it
seems undocumented, and i was waiting / hoping whomever added that
code would comment here

On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown <aaron@9minutesnooze.com
mailto:aaron@9minutesnooze.com> wrote:

I discovered that I had to set it manually.


On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre
<steven@realestatewebmasters.com
<mailto:steven@realestatewebmasters.com>> wrote:

    Does no one know how this is supposed to work?

    =================================================
    Steven Barre, RHCE, ZCE, MCP
    steven@realestatewebmasters.com
    <mailto:steven@realestatewebmasters.com>

    Systems Administrator / Programmer
    Real Estate Webmasters - 250-753-9893 <tel:250-753-9893>
    ==================================================

    On 2013-03-21 15:23, Steven Barre wrote:

        Hello

        In attributes/server.rb
        https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47


        There is the use of node["mysql"]["version"]. But I don't
        see where that gets set. Could someone explain that to me?

#6

attributes not only allows us to tune/customize the behavior of an recipe,
without changing it (kinda open close principle applied to recipes) , but
also provides a mechanism for detecting or storing persistent information
beyond a chef run. So even if you dont want to customize a property, but
just want to access it beyond the chef run you might want to model it as an
attribute. iirc the mysql cookbook generates a random root password (using
the openssl cookbook libraries?) and stores it as an attribute, here you
cant change it , but still you can grab it and use for other tooling (like
the lwrps for database and user uses this info), the cookbook also restrict
the root access to localhost.

regarding multiple service start, ubuntu does this as part of the
installation, and also the config changes require service restart/reload
again.
Again these are not the best implementation, but they are getting better. I
recall joshua had posted on the mailing list regarding this specific case,
i.e. mysql root password/mysql cookbook and some tricky use cases.

On Tue, Mar 26, 2013 at 2:57 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

I’ve also been wondering why some attributes are “tuneable” and others
are not. I also noticed the config file seems to just be the stock ubuntu
one with a few modifications.

I’m also trying to understand why mysql is installed, started, and then
the conf file is changed then mysql restarted. Wouldn’t it make more sense
to have the config file set up before the first run of mysql? Things like
pid file and innodb log files don’t handle changing very well. (as pointed
out here http://tickets.opscode.com/browse/COOK-2100)

I’m starting to think this need some rewriting … I’ll volunteer, but
I’m new at this. Some input from others would be appreciated.

=================================================
Steven Barre, RHCE, ZCE, MCPsteven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893

On 2013-03-26 14:07, Jesse Campbell wrote:

Same here, i set it in the database server role for our nodes… it seems
undocumented, and i was waiting / hoping whomever added that code would
comment here

On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown aaron@9minutesnooze.comwrote:

I discovered that I had to set it manually.

On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

Does no one know how this is supposed to work?

=================================================
Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893

On 2013-03-21 15:23, Steven Barre wrote:

Hello

In attributes/server.rb

https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47

There is the use of node[“mysql”][“version”]. But I don’t see where
that gets set. Could someone explain that to me?


#7

i’d like to see a little cleanup of the start / restart / another restart
issues, as it has definitely caused mysql server crashes on a number of our
prod servers…
also, i’d like to see changes to the config file be kept to a minimum, as
with each version bump we take, we find only about 90% of what has changed,
and it isn’t until it goes live with production-level traffic (possibly
after a few days) that we notice that someone’s tweak has broken something
else for us :slight_smile:

my.cnf is touchy…

-jesse

On Tue, Mar 26, 2013 at 6:09 PM, Ranjib Dey dey.ranjib@gmail.com wrote:

attributes not only allows us to tune/customize the behavior of an recipe,
without changing it (kinda open close principle applied to recipes) , but
also provides a mechanism for detecting or storing persistent information
beyond a chef run. So even if you dont want to customize a property, but
just want to access it beyond the chef run you might want to model it as an
attribute. iirc the mysql cookbook generates a random root password (using
the openssl cookbook libraries?) and stores it as an attribute, here you
cant change it , but still you can grab it and use for other tooling (like
the lwrps for database and user uses this info), the cookbook also restrict
the root access to localhost.

regarding multiple service start, ubuntu does this as part of the
installation, and also the config changes require service restart/reload
again.
Again these are not the best implementation, but they are getting better.
I recall joshua had posted on the mailing list regarding this specific
case, i.e. mysql root password/mysql cookbook and some tricky use cases.

On Tue, Mar 26, 2013 at 2:57 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

I’ve also been wondering why some attributes are “tuneable” and others
are not. I also noticed the config file seems to just be the stock ubuntu
one with a few modifications.

I’m also trying to understand why mysql is installed, started, and then
the conf file is changed then mysql restarted. Wouldn’t it make more sense
to have the config file set up before the first run of mysql? Things like
pid file and innodb log files don’t handle changing very well. (as pointed
out here http://tickets.opscode.com/browse/COOK-2100)

I’m starting to think this need some rewriting … I’ll volunteer, but
I’m new at this. Some input from others would be appreciated.

=================================================
Steven Barre, RHCE, ZCE, MCPsteven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893

On 2013-03-26 14:07, Jesse Campbell wrote:

Same here, i set it in the database server role for our nodes… it seems
undocumented, and i was waiting / hoping whomever added that code would
comment here

On Tue, Mar 26, 2013 at 2:51 PM, Aaron Brown aaron@9minutesnooze.comwrote:

I discovered that I had to set it manually.

On Tue, Mar 26, 2013 at 2:24 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

Does no one know how this is supposed to work?

=================================================
Steven Barre, RHCE, ZCE, MCP
steven@realestatewebmasters.com

Systems Administrator / Programmer
Real Estate Webmasters - 250-753-9893

On 2013-03-21 15:23, Steven Barre wrote:

Hello

In attributes/server.rb

https://github.com/opscode-cookbooks/mysql/blob/bfabce615dffe144a161bc5979873a7e9811f172/attributes/server.rb#L41-47

There is the use of node[“mysql”][“version”]. But I don’t see where
that gets set. Could someone explain that to me?


#8

On Tue, Mar 26, 2013 at 5:57 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

I’m also trying to understand why mysql is installed, started, and then
the conf file is changed then mysql restarted. Wouldn’t it make more sense
to have the config file set up before the first run of mysql? Things like
pid file and innodb log files don’t handle changing very well. (as pointed
out here http://tickets.opscode.com/browse/COOK-2100)

I have just finished committing a bunch of changes that move the template
creation to before the package is installed for this very reason, if you
are interested in reviewing:

I will prepare a pull request in the next few days.

Aaron


#9

i thought the reason the template happened after install was because most
packages include a my.cnf which would overwrite the template…

On Tue, Mar 26, 2013 at 6:42 PM, Aaron Brown aaron@9minutesnooze.comwrote:

On Tue, Mar 26, 2013 at 5:57 PM, Steven Barre <
steven@realestatewebmasters.com> wrote:

I’m also trying to understand why mysql is installed, started, and then
the conf file is changed then mysql restarted. Wouldn’t it make more sense
to have the config file set up before the first run of mysql? Things like
pid file and innodb log files don’t handle changing very well. (as pointed
out here http://tickets.opscode.com/browse/COOK-2100)

I have just finished committing a bunch of changes that move the template
creation to before the package is installed for this very reason, if you
are interested in reviewing:
https://github.com/9minutesnooze/mysql/tree/mysql56

I will prepare a pull request in the next few days.

Aaron


#10

Indeed, that is why there is the restart dances / preseed / templates
/ template re-opening at specific stages.

One day I suppose we’ll be able to install mysql or mariadb without
starting the service or shipping potentially broken config; it’s so
hard to reverse the changes once it has started up, nuke data etc.
Yawn.

–AJ

On 27 March 2013 11:58, Jesse Campbell hikeit@gmail.com wrote:

i thought the reason the template happened after install was because most
packages include a my.cnf which would overwrite the template…

On Tue, Mar 26, 2013 at 6:42 PM, Aaron Brown aaron@9minutesnooze.com
wrote:

On Tue, Mar 26, 2013 at 5:57 PM, Steven Barre
steven@realestatewebmasters.com wrote:

I’m also trying to understand why mysql is installed, started, and then
the conf file is changed then mysql restarted. Wouldn’t it make more sense
to have the config file set up before the first run of mysql? Things like
pid file and innodb log files don’t handle changing very well. (as pointed
out here http://tickets.opscode.com/browse/COOK-2100)

I have just finished committing a bunch of changes that move the template
creation to before the package is installed for this very reason, if you are
interested in reviewing:
https://github.com/9minutesnooze/mysql/tree/mysql56

I will prepare a pull request in the next few days.

Aaron


#11

On Tue, Mar 26, 2013 at 6:58 PM, Jesse Campbell hikeit@gmail.com wrote:

i thought the reason the template happened after install was because most
packages include a my.cnf which would overwrite the template…

All modern package managers that I’m aware of will keep an existing config
file and specifically not overwrite it. Are you aware of a specific
package or distribution that errantly overwrites an existing config file?


#12

On Tue, Mar 26, 2013 at 7:10 PM, AJ Christensen aj@junglist.gen.nz wrote:

One day I suppose we’ll be able to install mysql or mariadb without
starting the service or shipping potentially broken config; it’s so
hard to reverse the changes once it has started up, nuke data etc.
Yawn.

On recent Ubuntu releases that use upstart, if you create
"/etc/init/mysql.override" with the word “manual” in it before you
install the package (tested on 12.10 quantal with
mysql-server-5.5=5.5.29-0ubuntu0.12.10.1) then the service will not
start automatically when the package is installed (or on startup).

On Debian, if you create “/usr/sbin/policy-rc.d” with these contents,
it will prevent mysql from starting on installation (tested on 6.0.6
squeeze with mysql-server-5.1=5.1.66-0+squeeze1

=======
#!/bin/sh

if [ “x$1” = “xmysql” ] && [ “x$2” = “xstart” ]; then
echo “Not starting mysql server due to policy” >&2
exit 101
fi

Bryan


#13

Now that is a cool idea… Thanks Bryan :wink:

-AJ
On 28/03/2013 6:15 AM, “Bryan McLellan” btm@loftninjas.org wrote:

On Tue, Mar 26, 2013 at 7:10 PM, AJ Christensen aj@junglist.gen.nz
wrote:

One day I suppose we’ll be able to install mysql or mariadb without
starting the service or shipping potentially broken config; it’s so
hard to reverse the changes once it has started up, nuke data etc.
Yawn.

On recent Ubuntu releases that use upstart, if you create
"/etc/init/mysql.override" with the word “manual” in it before you
install the package (tested on 12.10 quantal with
mysql-server-5.5=5.5.29-0ubuntu0.12.10.1) then the service will not
start automatically when the package is installed (or on startup).

On Debian, if you create “/usr/sbin/policy-rc.d” with these contents,
it will prevent mysql from starting on installation (tested on 6.0.6
squeeze with mysql-server-5.1=5.1.66-0+squeeze1

=======
#!/bin/sh

if [ “x$1” = “xmysql” ] && [ “x$2” = “xstart” ]; then
echo “Not starting mysql server due to policy” >&2
exit 101
fi

Bryan