Archive for the 'Configurations' Category

…and other MySQL Oddities.

If your MySQL binary log files are a “Growing” problem… there are a few simple steps you can use to curtail their growth and save your disk space from these huge files.

They probably look like:

mysql-bin.000001
mysql-bin.000002
mysql-bin.000003
mysql-bin.000004
mysql-bin.000005

And around 1 gig in size each.

These files are generated when you have log-bin=mysql-bin or other log-bin= line in your /etc/my.cnf configuration file.

There are two ways to fix this problem:

The first is to stop the MySQL server from creating these binary files. The only reason you would need the binary log files is if you are doing mysql replication from a master to a slave. In this case, these files are necessary, at least until the slave(s) has caught up with the master. To stop this from logging, comment out (using #) the line containing ‘log-bin’.

The second is to continue logging - this is necessary as stated above if you are performing SQL replication.

You can add a line to your /etc/my.cnf file which will only keep these files around as long as necessary. The line is:

expire_logs_days = X

Where X is the number of days you’d like to keep them around. I would recommend 10, but this depends on how busy your MySQL server is and how fast these log files grow. Just make sure it is longer than the slowest slave takes to replicate the data from your master.

Just a side note: You know that you should do this anyway, but make sure you back up your mysql database. The binary log can be used to recover the database in certain situations; so having a backup ensures that if your database server does crash, you will be able to recover the data.

If you are a Google user - meaning Gmail, Google Docs, Google Calendar, Google Reader, etc - then you should know that by default, once you log in your sessions are typically not encrypted between your browser and the Google servers.

For some more technical information on this, check out dmiessler’s post on the subject.

He mentions using bookmarks to make force your browser to use Google’s secure connections - however I’ve noticed that occasionally depending on how you arrive to your Google services that you will switch to an unencrypted session without warning.

For that reason, If you are using Firefox and greasemonkey, I highly recommend installing the “Google Secure Pro” userscript. It automatically switches you from using http:// to https:// to ensure your data is encrypted to Google’s servers. This will increase your security greatly from using the unencrypted connections, which is good if you transfer confidential data over e-mail - like most normal people do!

The situation is: you have an web application or URL that you would like to force your users (or yourself) to use the secure https protocol rather than the unencrypted http protocol. This is easy to do with Apache and .htaccess.

Create or add to the .htaccess file in the root of the web directory you would like to force redirect for. Add the following lines:

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

This says that if https is off, reload the page at the same location using HTTPS instead.

Technorati Tags: , , ,

Windows Mobile 5 did not seem to have an easy way to have YouTube mobile videos (3gp files streaming over rtsp protocol) play to your phone.

However with Windows Mobile 6 Professional and HTC’s “StreamingPlayer” software - playing YouTube Mobile videos, at least through PIE (Pocket Internet Explorer) is easy.

If you don’t have HTC’s StreamingPlayer - check here. After installing the software, you may also need to modify your registry in order to allow rtsp streams to be opened by the player. Here is a link to the registry entries you need to make - again courtesy of XDA-Developer’s forum.

Save the above text to a .reg file, and import to your device (for example, using RegEdit for WM6)

Hopefully if all went well - when you visit http://m.youtube.com, and click play video, the HTC player will launch and play the video. After the video is done the player will automatically close and bring you back to the browser.

Note that for the above to work, you need to either have wifi access or an unlimited data plan for your wireless account - because streaming video WILL take up a lot of data!

Update 8/8/2007:

Screenshots!


Windows Mobile and YouTube main screen
Main Youtube Mobile Screen on WM6

YouTube Mobile and Video Page
Video Page on WM6

YouTube Video playing on StreamingPlayer
Video Playing

Widescreen Youtube video
In Landscape mode - you can see the quality of the video is not that great even over WiFi

For another great article on getting this working, check here.

When you generate a key pair in SecureCRT, it generates it in this format:

—- BEGIN SSH2 PUBLIC KEY —-
Subject: dave
Comment: “something”
ModBitSize: 1024
AAAAB3NzaC1yc2EAAAADAQABAAAAgQDQNXZosE8eAu6t9dsznpimQAXdaqkSmgKAgZ4+
gP9tW/j+wKtsEOBGasp4/AQu89Avscku+zp6lEuy9PCtBt03IdaQwls9GBl67EUzrKM
3NLNscuCt/LAsdjHfjvBL4q0Oh+MsHu0c6G6ltICqYmvAHYNAYBoPJv+0RMvxPdoNQ==
—- END SSH2 PUBLIC KEY —-

This key if fine, but if you run a linux server such as CentOS, RedHat, Fedora, or many others which use OpenSSH for it’s sshd; then this key does not work in ~/.ssh/authorized_keys. In order to convert this key to the one liner necessary for openssh, first upload it to the server. Either cutting and pasting into your text editor of choice, or uploading the file directly will work.

Then run the following command to add this key file to your authorized keys:

ssh-keygen -i -f /tmp/identity2.pub >> ~/.ssh/authorized_keys

You can then log in using your private key.

Here is the switch we are using:

-i Convert IETF SECSH to OpenSSH key file.

Technorati Tags: , , , , ,
  • Welcome to systemBash, a technology and system administration blog by David Drager. If you enjoy this sort of content, can can subscribe to the RSS using the link to the right.