Every time I need to install or reconfigure a new workstation, I
review the set of tools I use. It's an opportunity to
refresh the list, reconsider the usefulness of old tools
and review new ones. During my first week at Open Market I got
one of these opportunities. Here is my short list of free (as in
'beer') OSS tools and why they have a place in my tool
chest.
Testing Environments
Virtual Box
Of all the Virtual Machines out there, I consider Virtual Box to be
the easiest to use. Since I first looking into it while I was
still working at Sun/MySQL, this package has been improved
constantly. It's a must have to stage High Availability scenarios
or run tools that are not available in your OS of choice.
MySQL SandboxDid you compile MySQL from source and want to test
it without affecting your current …
Kontrollkit has been updated and has a new script for optimizing your database schemas. Some of the cnf files have been updated, some of the other files have had link corrections. Overall, a nice update. You can find the download here: http://kontrollsoft.com/software-downloads
Some time back, when a client wanted us to setup MySQL Enterprise
Monitor, we were surprised to find out that disk monitoring was
not available! We worked hard to come up with a solution.
Eventually, we decided to setup a custom agent to monitor the
disk. Below is the result of that.
While this script may not work as-is for everyone, it should at
least provide a basis for such a script. This script has been
modified to send an email instead of plug directly into the MySQL
Enterprise Monitor. But, it hopefully will get our creative
juices flowing...
#!/bin/bash # # This script does a very simple test for checking disk space. # # Valcora: http://www.valcora.com # CHECKDISK=`df -h | awk '{print $5}' | grep % | grep -v Use | sort -n | tail -1 | cut -d "%" -f1 -` ALERT_VALUE="80" MAIL_USER="root@localhost.com" MAIL_SUBJECT="Daily Disk Check" if [ "$CHECKDISK" -ge "$ALERT_VALUE" ]; then echo "At least one of my disks is …[Read more]
Last night I was asked by a client to export all of the tables
into CSV format. I thought no problem. Then I saw the long list
of table names! They wanted every one of them in CSV format! At
that point, I started thinking about making a backup and then
importing them all as CSV storage engine and then I realized CSV
was disabled on the sandbox server! So, I thought well, I could
try MySQL Query Browser, but then I figured I would still have to
do it on a table-by-table basis. That is when I decided to go the
Bash script route!
This lead to the formation of the brief script you see below. It
simply connects to a given database, shows the list of tables,
and then dumps out the contents in CSV format to individual files
named tablename.csv in the current directory. After just
a few minutes of scripting, it was all over and I had a handy
little script for the next time they or another client ask for
the same thing!
…
Have you ever been asked to convert all of the tables in a given
database or on a server to a new storage engine? Well, we have!
Sometimes, if it is only a few tables, firing off a few "ALTER
TABLE ... ENGINE=InnoDB;" is fine. Other times, it is a nightmare
if there are lots of tables and/or databases.
To make our life easier in such times, we created the following
Bash script. Save the file as something like "convert_tables.sh"
and make sure to make it executable. You can do this in Linux by
executing "chmod a+x ./convert_tables.sh." Take a look at the
code and we will give you an example of how to run it!
#!/bin/bash # Crawl through all of the tables in a database or databases and convert all tables to a given storage engine. # # Valcora: http://www.valcora.com # #### Begin Configuration #### DBNAMES="mydb1 mydb2" # Separate list of Databases by spaces NEW_ENGINE_TYPE="InnoDB" # Storage engine to …[Read more]
Below is a small Bash script to crawl through all the tables in a
MySQL database and look for any and all MyISAM tables. We
developed this script when we realized that a team of developers
were ignoring our requests to create all tables as InnoDB. We set
the default storage engine to be InnoDB, however, the team would
declare the Storage Enginge to be MyISAM which caused MySQL to
ignore our default declaration.
Yes, we could run a "SHOW TABLE STATUS," but that would require
staring at a lot of table entries in some databases. Naturally,
we could also query the Information Schema database as well. All
of those methods are fine. For our purposes, we wanted a fairly
simple script that would do the scanning for us lazy types and
yet work on pretty well all versions of MySQL.
To solve the problem, we developed this simple script to find any
and all tables that were MyISAM format. With that in mind, all of
the values are …
Over the years the DBA's have created simple Bash and PHP scripts
to make their life easier. We feel that sharing these with the
MySQL community may help our fellow database administrators and
make their life a little easier from time to time!
With that in mind, we will periodically post a new script that we
hope will be of some value. Some of the scripts are meant to
perform regular maintenance activity, routine tasks, and/or query
the database schema for certain table types, and such.
Some of the scripts may work as-is, while others may need to be
modified to suit your needs. Either way, it should provide a
starting point for accomplishing your work.
Naturally, we can make no guarantees as to the effectiveness of
these scripts. It should go without saying that you need to
always test them on a non-critical server before you attempt to
run them in a critical production environment. While, we believe
our …
The Monolith Toolkit of scripts for DBA routines. 0.4.3 has been released. You can download it here: http://code.google.com/p/monolith-toolkit/
Some information on the toolkit and what it contains:
- mt-backup-parallel -> runs mysql backups in parallel super fast, has lots of reporting features
- mt-check-replication -> script to report on replication status for slave servers
- mt-rhcluster-check-filesystems -> reports on redhat cluster filesystems (for mysql active/passive clustering)
- mt-rhcluster-script-wrapper -> wrapper script for running any of these scripts on a redhat cluster, chooses the active node to run the script on
- mt-connections-log -> logs connections to mysql to disk, reports on threshold overages
- mt-flush-tables-sequence -> runs through schema.tables to flush in …
Updated the release, sure it’s only been a matter of hours but I added the standard cnf files for 2,4,8 and 16GB server installations. Also added the rhcluster-wrapper script that can be used to run just about anything on the active database node when using mysql in an active/passive setup.
Download here: http://code.google.com/p/monolith-toolkit/
Today I decided to package all of my various scripts together into a useful toolkit. Some are perl, some are shell script. These scripts are, in general, one off scripts that I wrote in order to get things done that weren’t available at the time. Now they’re nicely organized and will receive updates at the google code repo.
So far the toolkit includes the following scripts:
- mt-backup-parallel -> the parallel backup script I wrote about in my last post
- mt-check-replication -> script to report on replication status for slave servers
- mt-check-rhcluster-filesystems -> reports on redhat cluster filesystems (for mysql active/passive clustering)
- mt-connections-log -> logs connections to mysql to disk, reports on threshold overages
- mt-flush-tables-sequence -> runs through schema.tables to …