mark's blog

Non-Drupal URIs and Lighttpd drupal.lua Script

I have a few other URLs that don't belong to Drupal. If these URLs are received on port 80, they get redirected to port 443 using mod_rewrite. The problem is drupal.lua script will cause non-Drupal URLs to simply get into a redirection loop. So, for example:

http://blog.example.org/nondrupalurl will send constant 301s back to the browser until it times out. What I had to do at the top of drupal.lua was this:

if lighty.env['uri.path']:match('nondrupalurl') then
--  print('URI Path Match ' .. lighty.env['uri.path'])
  return
end

So far, this solution works but it's not very elegant, especially if there are a bunch of non-Drupal URLs. My site only has two, so it's not that big of a deal to hard code this into drupal.lua.

The other thing I'd like to know is how do you do your Lua dev?

Review: MySQL Admin Cookbook

MySQL Admin CookbookMySQL Admin Cookbook from Packt Publishing, authored by Daniel Schneller & Udo Schwedt, is a new addition to the MySQL literary genre with 99 great recipes for mastering MySQL configuration and administration. Announcing quick answers to common problems, these 99 recipes cover a broad spectrum of managing MySQL, and are appropriate for new MySQL administrators as well as more experienced administrators. MySQL Admin Cookbook is available in dead tree and PDF formats. The book's website is: https://www.packtpub.com/mysql-admin-cookbook/book with errata found at http://www/packtpub.com/support.


Subjects Covered

  • Replication
  • Indexing Tools
  • Backing Up & Restoring MySQL Data
  • Managing Data
  • Monitoring & Analyzing MySQL Installation
  • Configuring MySQL
  • MySQL User Management
  • Managing Schemas
  • Good to Know

All in that order.

Recipe Format

All recipes follow a common format:

  1. Introduction of what this recipe will accomplish and why you'd want to use it.
  2. Getting Ready – This section outlines the requirements for the recipe, user privileges, programming language familiarity, additional software required, and where to find additional information.
  3. How to do it – Step-by-step instructions and expected output from these steps. All the reader has to do is follow the steps.
  4. How it works – The details on how the recipe works. If you're unsure what happens during the How to do it section, be sure to spend all the time needed to understand how the recipe works. Don't implement any recipe unless you fully understand what it's doing and how it works.
  5. There's more – Following on from the How it works section, this part will give the reader additional information to expand the functionality of the recipe, or provide other tools that provide the same, or nearly the same functionality. If there are additional concerns to look out for, it'll be included here as well.

MySQL Admin Cookbook Review


MySQL Admin Cookbook really is not designed to be read cover-to-cover as I did for this review, but it left me with a clunkiness about chapter order. There were a few of the recipes I thought were too basic – creating a basic user, creating indexes and tables. Those DBA functions should be automatic before diving into a book with this level of technical content. After those little bits of personal opinion, overall, I really liked the book. I put a few of the recipes into action with the servers I'm responsible for – Using a custom prompt, I would rely on the tab within terminal to see which server I was on, but that tab is missing when I SSH into a server from my phone. I quickly used Display query results page by page and Default pager as well since it makes it much easier to use the MySQL command-line client on smaller screens. Sometimes, it's the small things that make a large impact.

I work mostly from the command-line, but I like the way MySQL Admin Cookbook used both command-line tools and MySQL GUI tools to demonstrate the recipes. The authors acknowledge that the MySQL GUI tools are end of life, but they are still useful tools, so don't discount them. One of the things I thought was left out was using phpMyAdmin as one of the “GUI” tools. If you've never heard of phpMyAdmin, it is a very popular web-based MySQL interface used by many web hosting companies. One of the reviewers is heavily involved with phpMyAdmin development as well, so I would think at least one recipe in Chapter 3: Tools should have used phpMyAdmin.

One of the most popular command-line tools outside of MySQL command-line is Maatkit, which is mentioned several times throughout the book. On this subject, Maatkit could really use its own book ( hint, hint Baron! ), but I digress – hopefully in a positive direction.

At the time of this review, the was no errata on the Pakt website, and I couldn't add anything to the errata anyway. I've not tried all the recipes for accuracy, but I couldn't find any tpyos or mispelings.

If you'd like to see another DBA's perspective on MySQL server management or gain additional MySQL technical expertise, pick up a copy of MySQL Admin Cookbook.

 


If you'd like your MySQL, Drupal, or other F/OSS book reviewed on this site, please contact reviews@thetajoin.com.


Configuring JW FLV Player 5.x in Drupal to Stream Videos Using Amazon S3 & Cloudfront (Part III)

Part III will show how to configure Drupal content with an embedded JW FLV Player 5.x media player. Get started by downloading the player and unzipping. We'll use Amazon Cloudfront to distribute the player instead of using our own webserver. After all, that's what a Content Delivery Network is for!

The media player is comprised of a few javascript files, so they need to be stored in an S3 bucket that's configured for downloading instead of streaming:


AWS Manager

ThetaJoin uses an Amazon Cloudfront distribution based on an Amazon S3 bucket named: cf.thetajoin.com. Using the DNS masking trick, DNS was configured as a CNAME so cf.thetajoin.com pointed to the Amazon Cloudfront of http://d3hezglo7u107t.cloudfront.net. We now have one Amazon Cloudfront distribution based on an Amazon S3 bucket that contains the video files to stream and have a download distribution based on another Amazon S3 bucket that contains the media player. The delivery method for an Amazon Cloudfront distribution can only be one of streaming or download, it can't be both at the same time. That's why we have two Amazon Cloudfront distributions.

Upload the folder that contains the JW FLV Player, by default that's mediaplayer-viral, to your Amazon S3 bucket that's the source for your download Amazon Cloudfront distribution. When that's finished, change the ACL to that folder so everyone has read only access (make sure the apply to subfolders is checked):


Amazon S3 ACLs

The media player is now ready for distribution using Amazon Cloudfront. The next step is to embed the HTML required to display the player, configure it, and finally play the video from the Amazon Cloudfront distribution that's configured for streaming. There are two ways to add this content to a node, the first way is via HTML object, the second way is using a WYSIWYG editor that's able to embed the video for you.

 

Manual Way

The manual way to include your media player within Drupal content is to add the <object></object> tags directly as HTML, especially if you're comfortable with editing HTML. This approach doesn't require any Drupal modules to be installed and actually should work on just about any other content management system as well. The full <object></object> tags for the iPod repair video:

<object id="iPod" style="width: 640px; height: 480px; display: block; margin-left: auto; margin-right: auto;" width="640" height="480" data="http://cf.thetajoin.com/mediaplayer-viral/player-viral.swf" type="application/x-shockwave-flash">
<param name="data" value="http://cf.thetajoin.com/mediaplayer-viral/player-viral.swf" />
<param name="quality" value="autohigh" />
<param name="wmode" value="transparent" />
<param name="flashvars" value="file=iPodVideo5GRepair.flv&amp;streamer=rtmp://streams.thetajoin.com/cfx/st" />
<param name="name" value="iPod" />
<param name="src" value="http://cf.thetajoin.com/mediaplayer-viral/player-viral.swf" />
<param name="bgcolor" value="undefined" /></object>

The values where you see the cf.thetajoin.com domain need to be replaced with your own Amazon Cloud Front distribution URL that's configured for downloading. Width/height values can be set to the size of player you'd like displayed. Look for the flashvars param, replace file=iPodVideo5GRepair.flv, with the name of your FLV file, and adjust the streamer= to point to your Amazon Cloud Front distribution that's configured for streaming. Don't forget to add the /cfx/st without the trailing slash. The second to last param "src" also needs to be changed to point to your Amazon Cloud Front distribution that's configured for downloading.


WYSIWYG Editor Method

Most popular WYSWYG editors have an toolbar button to assist with the embedding of streaming content. This example will use TinyMCE to embed the JW FLV Flash player into Drupal content so you don't have to edit HTML.

 

TinyMCE Editor Toolbar

Clicking on that toolbar button presents the following screen:

TinyMCE Editor Embed Video

Type dropdown is set to Flash, File/URL textbox contains the Amazon Cloudfront URL to the JW FLV Player. Dimensions of your player can be set as well. Click on the Advanced tab next:

TinyMCE Editor Embed Video Advanced TabGive an Id & Name to your embedded object. The key textbox in the Advanced tab is the Flashvars textbox. Take a look at the flashvars param in the manual way, copy and paste after value= into this textbox. Be sure to click the Update button to save your configuration. Once this is done, your video will be displayed within your newly embedded video player like below.

 

The quality of the video isn't the best after the conversion from OGV to FLV format, so it's not any problem with Amazon Cloudfront streaming this video, it's the videographer! Laughing This is a 44 minute video demonstrating how to replace the screen and headphone jack of an iPod Video 5th Generation. If you try to repair your iPod using this video, you do so at your own risk!

I'm working on Part IV, stay tuned!!

-- Mark

Preparing Amazon S3 & CloudFront for Streaming Flash Videos from Your Drupal Site (Part II)

This is Part II of an unknown number of posts about using Amazon S3 & CloudFront to host your Drupal site's streaming media. Part I covered a very basic approach using an Ogg Vorbis Video formatted file delivered over HTTP. Although this will work over HTTP with limited support from embedded media players, this isn't the internet standard for delivering streaming videos. One standard protocol to use is the real time messaging protocol or rtmp, developed by Adobe Systems. From the Amazon CloudFront manual:

"CloudFront uses Adobe Flash Media Server 3.5 to stream on-demand content with Adobe's
Real-Time Messaging Protocol (RTMP). CloudFront accepts RTMP requests over port 1935 and
port 80."

This means flash videos can be streamed from Amazon CloudFront. This post will show how to convert that Ogg Vorbis Video file to flash video format on Ubunta 9.10 and then configure Amazon CloudFront to support streaming the flash video.

 

1. Converting Ogg Vorbis to Flash Video


In order to convert the ogv file to flv format, ffmpeg needs to be installed. On Ubuntu 9.10:

sudo apt-get install ffmpeg

 

2. Convert the ogv file to flv format:

ffmpeg -i iPodVideo5GRepair.ogv -s 800x600 iPodVideo5GRepair.flv

The -s ffmpeg option resizes the video to 800x600. The original video file was recorded at 1600x1000. This reduced the file size from 440MB to 124MB. Still 44 minutes in length though.

3. Create Amazon S3 Bucket

Amazon CloudFront needs an Amazon S3 bucket to store the flv file. CloudFront uses Amazon S3 as the source for the flv file to stream. Amazon CloudFront only supports the distribution of content, not the storage. Using your favorite Amazon S3 client, create a bucket that's named like your internet domain name. In the case of ThetaJoin, a bucket was created named streams.thetajoin.com.

Amazon S3 Bucket

4. Configure Bucket for Streaming Content

CloudFront supports content distribution using two different methods - download and streaming. The download method is used for static content such as PDFs, JPG, or PNG files. The other method is the streaming method that's used to stream either audio or video files. A CloudFront distribution can only support one of these methods at a time, hence the creation of the streams.thetajoin.com bucket to support the CloudFront distribution that will stream the flash video file. Log in to the Amazon Web Services (AWS) Manager to access CloudFront: https://console.aws.amazon.com/cloudfront/home . Once there, the streams.thetajoin.com bucket can be configured to support CloudFront streaming. Click on the Create Distribution button:

Creating Streaming Cloud Front

Choose Streaming for the Delivery Method, select the Amazon S3 bucket, give it a CNAME the same as the Amazon S3 bucket name, and make sure it's enabled. Creating the CloudFront streaming distribution can take some time. AWS Manager will show that the distribution was created:

AWS Manager - CloudFront

The streams.thetajoin.com bucket has the following attributes:

  • Delivery Method: Streaming
  • Domain Name: s9vf9f1gnogon.cloudfront.net
  • Origin Bucket: streams.thetajoin.com.s3.amazonaws.com
  • State: Deployed
  • Status: Enabled

The streams.thetajoin.com bucket is ready to support streaming of any streamable content stored there.

5. Configure DNS

The URL to the CloudFront distribution is s9vf9f1gnogon.cloudfront.net, which is on the ugly side and doesn't maintain your site domain name. It would be great for your site branding to use a portion of the origin bucket URL, streams.thetajoin.com only. To do this, you'll need to configure your DNS server with a CNAME value that's the name of your Amazon S3 bucket, that points to the Domain Name of your CloudFront distribution. In ThetaJoin's case streams.thetajoin.com points to s9vf9f1gnogon.cloudfront.net. Now, when a URL with the domain streams.thetajoin.com is requested from the media player, the DNS server will "redirect" the URL to s9vf9f1gnogon.cloudfront.net. From the end user, it'll look like your streaming content is being delivered from your own private content delivery network.

 

Amazon S3 and CloudFront are configured to support streaming the flash video that was converted in step 1. Part III of this series will show how to add streaming content to your site.


Drupal Integration with Amazon Cloud Front Streaming Video Demo

During SandCAMP 2010, I held a session on Drupal Integration with Amazon S3 & Cloudfront, you can download the session slides too. As I was preparing for this session, Amazon had announced that Cloud Front was able to support streaming video and audio, but I didn't have enough time to put a demo together until now.


I created a Cloud Front demo video repairing my son's 5th Generation iPod Video, replacing the screen and headphone jack. This video was created using a Logitech® Webcam Pro 9000 into a Dell Inspiron 1525 laptop running Ubuntu 9.10 Karmic Koala. Cheese recording software was used to record this 44 minute, 441MB video. The video is 1600x1000 OGG video at 5 frames per second using the Theora codec. The audio is in mono with the Vorbis codec sampled at 44100hz with a bitrate of 80kbps.

The demo video was tested under Firefox 3.5.8 on the same laptop that was used for the recording, and it worked just fine. Same with Opera 10. IE wanted to download the video, so there maybe some other codecs that need to be installed in order to view the OGG video format streamed. Should work fine under Mac OSX too, but I have no way to test. Doesn't work on iTouch using Safari though.

What makes integrating Drupal with Cloud Front is that you can have your own private, unlimited video and audio content delivery network. This allows ultimate flexibility, no limits on the size or length of your video, choose your own video format, zero alteration of your video like what happens with the major video websites. With pay as you go, Cloud Front can really make your Drupal site shine.

The video was created simply as a demo of Cloud Front. If you decide to try to repair your own iPod - you do so entirely at your own risk! Please don't email me if you blow things up!!

I'm very interested in Cloud Front performance, please leave a comment on your experience with Cloud Front streaming.

-- Mark

Fun With Information Schema - How Big is My Drupal Database??

Lately, I've had a few people ask me "How much data is in our database?". Sure, you can look at the file sizes of MyISAM tables and indexes and get a ballpark figure, but what if you need exact results, or are running InnoDB storage engine? That proves to be more challenging! In playing around with the information_schema, I've put together some queries to help:


Calculate Index Sizes

mysql> SELECT CONCAT(ROUND(SUM(index_length)/(1024*1024*1024), 2), ' GB') AS 'Total Index Size'
FROM information_schema.TABLES 
WHERE table_schema LIKE 'database'; 
+------------------+
|Total Index Size  |
+------------------+
|1.70 GB           |
+------------------+

1 row in set (1.60 sec) 

Calculate the Total Size of Stored Data

mysql> SELECT CONCAT(ROUND(SUM(data_length)/(1024*1024*1024), 2), ' GB') AS 'Total Data Size' 
FROM information_schema.TABLES 
WHERE table_schema LIKE 'database';
+-----------------+
| Total Data Size |
+-----------------+
|3.01 GB |
+-----------------+

1 row in set (1.35 sec) 

Per Table Sizes

SELECT CONCAT(table_schema,'.',table_name) AS 'Table Name', CONCAT(ROUND(table_rows/1000000,2),'M') AS 'Number of Rows', 
CONCAT(ROUND(data_length/(1024*1024*1024),2),'G') AS 'Data Size', 
CONCAT(ROUND(index_length/(1024*1024*1024),2),'G') AS 'Index Size' ,
CONCAT(ROUND((data_length+index_length)/(1024*1024*1024),2),'G') AS'Total'
FROM information_schema.TABLES 
WHERE table_schema LIKE 'database'; 

 

Just replace database with the partial name of your database you need to analyze. Yes, I know, those wonderful Maatkit tools contains mk-find which can do the same thing, but then you won't learn about the information_schema database!! It's important to also know that running the above commands on a server that's very busy can result in slowing it down even more. The information schema tables are 'virtual tables' they don't exist like regular database tables. Just be aware, and if you need to collect this information on a busy database, make a backup copy of your Drupal database and move it to a development server.

Review: MySQL Administrator's Bible

MySQL Administrator's Bible

On the front cover of MySQL Administrator’s Bible is a sentence that reads:

“The book you need to succeed!”

I must say, I do agree. Authored by two very experienced DBAs, Sheeri Cabral and Keith Murphy,
they’ve combined their talents to cover what you really need to know to
succeed. This book is very versatile. If you’re new to MySQL, or
experienced in another database and have to start administrating MySQL,
you need this book. I can honestly say, even if you have years of MySQL
experience, you will learn something new. I did. Divided into four
parts, MySQL Administrator’s Bible covers your First Steps with MySQL,
Developing with MySQL, Core MySQL Administration and Extending Your
Skills.

First Steps with MySQL starts with a gentle introduction
to MySQL with company information, which seems to be changing annually,
and most importantly, the MySQL community itself. What makes MySQL so
fantastic is the community. After that, you’ll be lead into installing
and configuring MySQL on various platforms including Linux, Windows and
Solaris while touching on post installation configuration too. Basic
security is covered as well as some tips on troubleshooting and
accessing your new MySQL installation using tools included with MySQL
or using third party software.

Developing with MySQL covers the
MySQL Language Structure and if you’re coming from another RDBMS, it
covers how MySQL deviates from the SQL standard by extending that
standard to make MySQL the number one open source database used on the
Internet. After that, this section covers the same type of topics
covering just about any other mainstream databases such as using stored
procedures, cursors, events, views and transactions.

The Core
MySQL Administration is the heart of this book. It covers MySQL server
tuning, covering all major storage engines including MyISAM, InnoDB,
Falcon, PBXT, and NDB engines including the first time I’ve seen in
print, the Maria storage engine. An entire chapter is devoted to
implementing cache tables and using the query cache. Memcached is also
mentioned, and mentioned again in the final section. Continuing on with
what I consider the most important job of a DBA, backup and recovery.
Databases are very central to running a business, any data loss could
put a company out of business. Be prepared.

This section gives a
solid introduction to the topic of dealing with users, and how they are
managed within MySQL. Count on covering GRANT/REVOKE, using SHOW GRANTS
and mk-show-grants MaatKit tool. Partitioning, logging and replication
and measuring performance rounds out this section.

If you have
experience with another RDBMS, plan on spending a significant amount of
time in this section. Not that the other sections aren’t important,
they are, but this is the bread and butter of what a MySQL DBA does on
a daily basis.

Extending You Skills section can be considered
getting your Masters in Database Administration. Just about every DBA
will have to tackle improving queries and the tuning of indexes. The
second most important job of a DBA is monitoring performance of your
MySQL server. Don’t let your users be your first line of monitoring! Be
proactive, there are plenty of open source monitoring tools available.
The most popular are discussed, as well as MySQL Enterprise and third
party companies too. MySQL Data Dictionary is covered in in detail over
58 pages. This is the most I’ve read in any book about the data
dictionary. 

Last but not least, most high performance MySQL
systems involve scaling up or out. It covers the usual suspects of
replication, MySQL Cluster, and memcached. MySQL Proxy is initially
covered and has an appendix to expand on that information. MySQL Proxy
itself is worthy of its own book. (hint, hint :) ) Two more appendices
cover MySQL Functions and Operators, and additional resources.

Even
though this book targets MySQL 5.1/6.0, there is plenty of information
that will apply to 5.0. If you’re still on 5.0, don’t hesitate to pick
up a copy. This will be a book that can stay with you as your upgrade
to 5.1 and beyond. The companion website –
http://www.wiley.com/go/mysqladminbible contains all the code from the
book too, rounding out this fine tome.

What didn’t I like about
the book? There are only a couple of things, all personal I’m sure.
First, I really don’t care too much for tables of options from the
various tools. Most open source tools are developed rather quickly and
options change. This could render portions of the book out of date
quickly.

The other thing I noticed that wasn’t mentioned in the
book was the community versions of MySQL supported by Open Query and
Percona. The latter has their own storage engine, XtraDB and backup
solution, XtraBackup.

All in all, this is a very solid book on
administering MySQL. This book digs deeper, the experience of the
authors really show. Well done Sheeri and Keith!

Drush for Multisite Cron

When running multiple Drupal sites on the same server, it can be challenging to run cron.php for each installed site. Drush can be used to solve this problem nicely.

First thing is to download drush:

http://drupal.org/project/drush

untar the tarball

tar xvzf drush-All-Versions-2.1.tar.gz

As root, copy all of the files and subdirectories in the drush directory:

cp -rp * /usr/local/bin

By placing all the drush related files and directories into /usr/local/bin, this will allow cron to execute drush. Test drush out from the commandline first like this:

drush --root=/path/to/drupal --uri=http://www.thetajoin.com cron

It should return OK ofter running. Verify in your Drupal logs that cron ran sucessfully.

After testing, start edit cron to run the above command:

crontab -e

*/17 * * * * /usr/local/bin/drush --root=/path/to/drupal --uri=http://blog.thetajoin.com cron
*/19 * * * * /usr/local/bin/drush --root=/path/to/drupal --uri=http://www.thetajoin.com cron

To make sure each site on the server wasn't updated at the exact same time, pick a time that's a prime number. I would like my Drupal sites updated roughly every 15 to 20 mins, so 19 minutes and 17 minutes will work just fine.

 

There you have it! Multisite cron using drush!

 

-- Mark

Portable Maatkit

What do you do when you're in a situation where you REALLY need your
favorite Maatkit tools, but are not allowed to load software on the
server running MySQL, AND you're not allowed to install software on the
provided workstation, especially a workstation that's running software
from a large corporation in Redmond? Portable Maatkit to the rescue!

DISCLAIMER:
I've only tested a few maatkit tools, namely mk-find and
mk-query-digest, but not completely. Some features and some tools may
not function, such as mk-audit. Use your best judgment. I'm not
responsible if your workstation or server looses all your data, your
USB key bursts into flames, or your significant other leaves you. YMMV,
use at YOUR OWN RISK!

Strawberry Perl
has been out for some time now, and recently, a portable version of
Strawberry Perl has been available. Download the the latest 5.10
version of Portable Strawberry Perl and unzip it onto your USB key. Also download and unzip to your USB key the latest copy of Maatkit. After unzipping everything, your USB key should look something like:

E:\>dir
 Volume in drive E has no label.
 Volume Serial Number is BEEF-FEED

 Directory of E:\

01/29/2009  11:13 PM               116 Strawberry Perl Website.url
01/29/2009  11:13 PM                50 Win32 Perl Wiki.url
01/29/2009  11:14 PM    <DIR>          cpan
01/29/2009  10:29 PM    <DIR>          licenses
01/29/2009  11:14 PM    <DIR>          perl
01/29/2009  11:09 PM    <DIR>          ppm
07/23/2009  01:20 PM    <DIR>          maatkit-4047
01/29/2009  11:13 PM                51 CPAN Search.url
01/29/2009  11:13 PM                52 Perl 5.10.0 Documentation.url
10/16/2008  09:01 PM             1,861 portable.perl
12/24/2007  03:44 PM             1,406 Strawberry Perl Website.ico
01/29/2009  11:14 PM    <DIR>          c
               8 File(s)         55,836 bytes
               6 Dir(s)   1,848,025,088 bytes free

The
portable version ships with DBI installed, but not DBD::mysql. To
install DBD::mysql, use the Perl Package Manager (PPM) that comes with
Strawberry Perl.

E:\> cd perl\bin
E:\perl\bin> ppm
PPM interactive shell (0.01_01) - type 'help' for available commands.
PPM> help
Commands:
    exit              - leave the program.
    help [command]    - prints this screen, or help on 'command'.
    install PACKAGES  - installs specified PACKAGES.
    quit              - leave the program.
    query [options]   - query information about installed packages.
    remove PACKAGES   - removes the specified PACKAGES from the system.
    search [options]  - search information about available packages.
    set [options]     - set/display current options.
    verify [options]  - verifies current install is up to date.
    version           - displays PPM version number


PPM> search mysql
Packages available from http://cpan.uwinnipeg.ca/PPMPackages/10xx:
DBD-mysql [4.005] A MySQL driver for the Perl5 Database Interface (DBI)
Packages available from http://ppm.activestate.com/PPMPackages/5.10-windows:
ApacheMysql                  [0.3 ] Initiate a persistent database connection
                                    to Mysql
DBIx-Mysql-InformationSchema [0.04] Perl module to access the mysql
                                    INFORMATION_SCHEMA view, which contains
                                    database metadata.

Install it:

PPM> install DBD-mysql
Install package 'DBD-mysql?' (y/N): y
Installing package 'DBD-mysql'...
Bytes transferred: 1018351
Files found in blib\arch: installing files in blib\lib into architecture depende
nt library tree
Installing E:\perl\site\lib\auto\DBD\mysql\mysql.bs
Installing E:\perl\site\lib\auto\DBD\mysql\mysql.dll
Installing E:\perl\site\lib\auto\DBD\mysql\mysql.exp
Installing E:\perl\site\lib\auto\DBD\mysql\mysql.lib
Installing E:\perl\site\lib\auto\DBD\mysql\mysql.pdb
Installing E:\perl\site\lib\Bundle\DBD\mysql.pm
Installing E:\perl\site\lib\DBD\mysql.pm
Installing E:\perl\site\lib\DBD\mysql\GetInfo.pm
Installing E:\perl\site\lib\DBD\mysql\INSTALL.pod
PPM>

Change to the maatkit directory on your USB key, and prepare it for installation:

E:\maatkit-4047> e:\perl\bin\perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for maatkit
E:\maatkit-4047>

I
know this really didn't do much, but it's a good check to make sure all
dependancies have been met. Don't install maatkit at this point! You
don't need to.

Now, take your USB key to the workstation and
plug it in. Once it has been recognized, open a command prompt by going
to the start button, click run, then enter cmd into the dropdown box.
Navigate to the your maatkit\bin directory.

I really needed mk-find for my task. Here's how to run mk-find with portable Strawberry Perl:


F:\maatkit-4047\bin> f:\perl\bin\perl mk-find --help
mk-find searches for MySQL tables and executes actions, like GNU find.  The
default action is to print the database and table name.  For more details,
please use the --help option, or try 'perldoc mk-find' for complete
documentation.

Usage: mk-find [option]... [database...]

Options:

  --ask-pass          Prompt for a password when connecting to MySQL
  --case-insensitive  Specifies that all regular expression searches are
                      case-insensitive
  --charset       -A  Default character set
  --config            Read this comma-separated list of config files; if
                      specified, this must be the first option on the command
                      line
  --day-start         Measure times (for --mmin, etc) from the beginning of
                      today rather than from the current time
  --defaults-file -F  Only read mysql options from the given file
  --help              Show help and exit
  --host          -h  Connect to host
  --or                Combine tests with OR, not AND
  --password      -p  Password to use when connecting
  --port          -P  Port number to use for connection
  --[no]quote         Quotes MySQL identifier names with MySQL's standard
                      backtick character (default yes)
  --set-vars          Set these MySQL variables (default wait_timeout=10000)
  --socket        -S  Socket file to use for connection
  --user          -u  User for login if not current user
  --version           Show version and exit

F:\maatkit-4047\bin>

Nice, no errors! Since Maatkit isn't installed.

Lets try an example:

F:\maatkit-4047\bin> f:\perl\bin\perl mk-find -hmysqlserver -u user --ask-pass --print
Enter password:
`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`func`
`mysql`.`help_category`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_topic`
`mysql`.`host`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`tables_priv`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`mysql`.`user`

Another example:

F:\maatkit-4047\bin&gt;f:\perl\bin\perl mk-find -hmysqlserver \ 
-u user --ask-pass --ctime +1 --engine MyISAM
Enter password:

`mysql`.`columns_priv`
`mysql`.`db`
`mysql`.`func`
`mysql`.`help_category`
`mysql`.`help_keyword`
`mysql`.`help_relation`
`mysql`.`help_topic`
`mysql`.`host`
`mysql`.`proc`
`mysql`.`procs_priv`
`mysql`.`tables_priv`
`mysql`.`time_zone`
`mysql`.`time_zone_leap_second`
`mysql`.`time_zone_name`
`mysql`.`time_zone_transition`
`mysql`.`time_zone_transition_type`
`mysql`.`user`

F:\maatkit-4047\bin>


Yet another example:

F:\maatkit-4047\bin> f:\perl\bin\perl mk-find -hmysqlserver \ 
-u user --ask-pass --printf "%T\t%D.%N\n"
Enter password:

1024    `mysql`.`columns_priv`
4972    `mysql`.`db`
1024    `mysql`.`func`
23988   `mysql`.`help_category`
90417   `mysql`.`help_keyword`
19909   `mysql`.`help_relation`
281940  `mysql`.`help_topic`
1024    `mysql`.`host`
4628    `mysql`.`proc`
1024    `mysql`.`procs_priv`
1024    `mysql`.`tables_priv`
1024    `mysql`.`time_zone`
1024    `mysql`.`time_zone_leap_second`
1024    `mysql`.`time_zone_name`
1024    `mysql`.`time_zone_transition`
1024    `mysql`.`time_zone_transition_type`
2472    `mysql`.`user`


I
can also report that mk-query-digest also worked without an error. I
can't show you the output to demonstrate, I just analyzed using
mk-query-digest using default settings to process the slow log of a
server. I'm sure most options will work, with the exception of daemon
mode since this is a windows workstation.

It's incredible the
flexibility Open Source tools gives a person. Portable Strawberry Perl
and now Portable Maatkit will be in my toolbox. Much thanks to the
Strawberry Perl and Maatkit teams!

Working with TinyMCE & Syntax Highlighting

Welcome to ThetaJoin's Blog. It's under construction, but making great progress. The goal of this blog is to publish tips and techniques to improve Drupal performance. This will require the posting of SQL statements, PHP code, BASH scripts, CSS, and even possibly Javascript source code, of which having excellent looking code is a top priority.

During the development of this blog site, I ran into a few stumbling blocks getting TinyMCE to work with the SyntaxHighlighting library. At first, I couldn't get the TinyMCE editor to display in Firefox 3.0.17 on Ubuntu 8.04. It was visible with Opera 10.10, so I knew I had it all configured properly. The solution for Firefox was to disable Firebug. Seems they don't like each other.

The other issue I ran into, simply because I was playing around with drush and installed the TinyMCE module AND the wysiwyg module at the same time! Now, this really brought some very interesting conflicts!! If I disabled the TinyMCE module, the full, configured TinyMCE editor would still appear! Uninstalling the TinyMCE module from Drupal and leaving the wysiwyg module to handle it all, solved the problem.

When configuring your input type for syntax highlighting, don't forget to select SyntaxHighlighter!

Plenty more to work on!!

-- Mark

Creative Commons License
This work by Mark Schoonover is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License.
Based on a work at blog.thetajoin.com. All comments copyright their respective owners.

Syndicate content
Drupal SEO