PostgreSQL get back storage occupied by deleted tuples or records

Posted on in Categories Howto last updated September 30, 2006

PostgreSQL is a free object-relational database server/database management system, released under a flexible BSD-style license. It has features such as Functions, Indexes, Triggers, MVCC and much more.

With vacuum you can reclaim storage occupied by deleted tuples. In normal PostgreSQL operation, tuples that are deleted or obsolete by an update are not physically removed from their table; they remain present until a VACUUM is done. Therefore, it is necessary to do VACUUM periodically, especially on frequently updated tables.

vacuumdb is a utility for cleaning a PostgreSQL database. vacuumdb will also generate internal statistics used by the PostgreSQL query optimizer.

For example type the following command:
$ vacuumdb -v -z -a
OR
$ vacuumdb -v -z -a -U USERNAME -W

Where,

  • -v: Verbose output
  • -z: Calculate statistics for use by the optimizer
  • -a: Vacuum all databases
  • -U USERNAME: Use USERNAME name to connect as
  • -W: Prompt for password

How to tune MySQL server for performance

Posted on in Categories MySQL, Tips, Tuning last updated September 29, 2006

MySQL Performance site, published tips about tuning your MySQL server Performance.

From the article:
My favorite question during Interview for people to work as MySQL DBAs or be involved with MySQL Performance in some way is to ask them what should be tuned in MySQL Server straight after installation, assuming it was installed with default settings.

I’m surprised how many people fail to provide any reasonable answer to this question, and how many servers are where in wild which are running with default settings.

Even though you can tune quite a lot of variables in MySQL Servers only few of them are really important for most common workload. After you get these settings right other changes will most commonly offer only incremental performance improvements.

Read more at mysqlperformanceblog

How to PF Firewall Ruleset Optimization

Posted on in Categories Howto, OpenBSD last updated September 28, 2006

OpenBSD journal has published excellent PF Firewall Ruleset Optimization tutorial.

From the article:
“This is the first installment in a series of three articles about PF. I originally wrote them as chapters for a book, but then publication was cancelled. Luckily, the rights could be salvaged, and now you get to enjoy them as undeadly.org exclusives.”

Firewall Ruleset Optimization topics:

  • Goals
  • The significance of packet rate
  • When pf is the bottleneck
  • Filter statefully
  • The downside of stateful filtering
  • Ruleset evaluation
  • Ordering rulesets to maximize skip steps
  • Use tables for address lists
  • Use quick to abort ruleset evaluation when rules match
  • Anchors with conditional evaluation
  • Let pfctl do the work for you
  • Testing Your Firewall (read)
  • Firewall Management (upcoming)

Read more at OpenBSD journal

Inside a compact embedded Linux – Hacking MediaMVP

Posted on in Categories Beyond nixCraft, Linux, News last updated September 28, 2006

The Hauppauge MediaMVP is a network media player. It consists of a hardware unit with remote control, along with software for a Windows PC. Out of the box, it is capable of playing video and audio, displaying pictures, and “tuning in” to Internet radio stations. Alternative software is also available to extend its capabilities. It can be used as a front end for various PVR projects.

The MediaMVP is popular with some PVR enthusiasts because it’s inexpensive and relatively easy to modify.

As an MP3 and MPEG player, the Hauppauge MediaMVP lets you play digital media through your television set. As a tightly purposed embedded device, it is an excellent example of a compact Linux implementation on minimal hardware.

The MediaMVP is similar in some ways to the TiVo: it’s intended to be a pure appliance, performing only specified functions. Unlike the TiVo, it doesn’t make a significant effort to prevent users from loading their own software, and sure enough, users have done just that.

This article looks at the “standard” install provided by Hauppage and also looks at the MediaMVP Media Center (MVPMC) project, which is developing a custom user environment for the system.

Linux mail server: How to fight image spam

Posted on in Categories Howto, Linux, Security, UNIX last updated September 28, 2006

This is getting out of control these days.

There is an interesting article at LWN about Fighting image spam.

From the article:
A number of spammers have been evading filters like SpamAssassin (SA) recently by encoding their messages as images. SA already has a set of rules that are meant to combat image spam, but the more recent messages (typically for stock scams or pharmacy products) have been crafted to avoid them. This would indicate, once again, that spammers are using SA to pre-test their messages and are modifying them to get through. SA developers, however, are up to the challenge and two specific countermeasures have been released.

How to MySQL backup and data recovery with mysql-zrm

Posted on in Categories Backup, Data recovery, Howto, MySQL last updated September 28, 2006

This guide describes how to back up and recover your MySQL databases with mysql-zrm on a Debian Sarge system. mysql-zrm is short for Zmanda Recovery Manager for MySQL, it is a new tool that lets you create full logical or raw backups of your databases (regardless of your storage engine and MySQL configuration), generate reports about the backups, verify the integrity of the backups, and recover your databases. It can also send email notifcations about the backup status, and you can implement multiple backup policies (based on your applications and based on time (e.g. daily, weekly, etc.)).

Linux add ethtool duplex settings to a network card permanently

Posted on in Categories Linux, Networking, Tips, Ubuntu Linux last updated September 28, 2006

I have already written about how to find and change your network interface speed (NIC), duplex or auto negotiate settings on Linux using ehttool command line options.

However, these settings are not permanent. If you reboot the system or if you just
need to upgrade/downgrade your port speed, run the ehtool command once your port change by network administrator. (If you want to read about how to make Windows 2000/2003 server port speed change, read my previous article.)

Changing your Network Interface Speed, Duplex or Auto Negotiate settings on Red Hat Linux

To set the interface speed, duplex or auto negotiation on Linux system boot up (make settings permanent), you need edit /etc/sysconfig/network-scripts/ifcfg-eth0 file for eth0 interface. This file used by Red Hat enterprise Linux, Fedora core, Cent Os etc.

Open the file:
# vi /etc/sysconfig/network-scripts/ifcfg-eth0

Append following line:
ETHTOOL_OPTS="speed 100 duplex full autoneg off"

Save and close the system. It will set the eth0 device to 100Mbs, full duplex, with the auto negotiation off at boot time. You can simply restart the networking (it will disconnect all ssh or ftp session) or restart the server. Depend upon traffic and load it may take upto 1 minute to setup a new port speed:
# /etc/init.d/network restart

If you want 1000Mbs set line as follows:
ETHTOOL_OPTS="speed 1000 duplex full autoneg off"Update: if above command failed to work for 1000Mbps use following command (see below in comment sections for discussion) :ETHTOOL_OPTS="speed 1000 duplex full autoneg on"

Debian or Ubuntu Linux permanent settings

Under Debian or Ubuntu Linux just create a script as follows:
# vi /etc/init.d/100Mbs
OR
$ sudo vi /etc/init.d/100Mbs
Append following lines:
#!/bin/sh
ETHTOOL="/usr/sbin/ethtool"
DEV="eth0"
SPEED="100 duplex full"
case "$1" in
start)
echo -n "Setting eth0 speed 100 duplex full...";
$ETHTOOL -s $DEV speed $SPEED;
echo " done.";;
stop)
;;
esac
exit 0
Save and close the file. Setup executable permission:
# chmod +x /etc/init.d/100MbsOR$ sudo chmod +x /etc/init.d/100Mbs

Now run script when Debian or Ubuntu Linux boots up. Use update-rc.d command install System-V style init script links:# update-rc.d 100Mbs defaultsOR# sudo update-rc.d 100Mbs defaultsOutput:

 Adding system startup for /etc/init.d/100Mbs ...
   /etc/rc0.d/K20100Mbs -> ../init.d/100Mbs
   /etc/rc1.d/K20100Mbs -> ../init.d/100Mbs
   /etc/rc6.d/K20100Mbs -> ../init.d/100Mbs
   /etc/rc2.d/S20100Mbs -> ../init.d/100Mbs
   /etc/rc3.d/S20100Mbs -> ../init.d/100Mbs
   /etc/rc4.d/S20100Mbs -> ../init.d/100Mbs
   /etc/rc5.d/S20100Mbs -> ../init.d/100Mbs

Reboot the system to take effect or just type scrit name:
# /etc/init.d/100Mbs startOR$ sudo /etc/init.d/100Mbs start

See also:

Test your Samba server for configuration errors

Posted on in Categories Linux, Shell scripting, Tips, Troubleshooting, UNIX last updated September 28, 2006

You can easily test your Samba server for configuration errors. It check an smb.conf configuration file for internal correctness.

If this program reports no problems, you can use the configuration file with confidence that smbd will successfully load the configuration file.

Open a shell prompt. And type the following command:
# testparmOR# testparm /etc/samba/smb.conf

The program will issue a message saying whether the configuration file loaded OK or not. This message may be preceded by errors and warnings if the file did not load. If the file was loaded OK, the program then dumps all known service details to screen.

If testparm finds an error in the smb.conf file it returns an exit code of 1 to the calling program, else it returns an exit code of 0. This allows shell scripts to test the output from testparm.

For example:
testparm
if [ $? -eq 0 ]; then
echo "Syntax OK"
else
echo "Syntax Error"
fi

Build your positive self-image or brand with Google

Posted on in Categories Beyond nixCraft last updated September 27, 2006

This informal experiment shows why it’s important to manage your online presence (blog or website) in a positive manner :D.

Self-Googling — searching for your own name on the popular Google search engine — may seem like an innocuous act of vanity, but a University at Buffalo communications professor recommends it as a shrewd form of “personal brand management” in the digital age.

From the article:
“The best way of controlling your message is by creating it yourself,” Halavais says. “Promote your work actively on the Web to help to bolster your online reputation.

“Starting your own Weblog or Web site can help you to shape your public image, and make sure that it accurately reflects your abilities and interests,” he concludes.

Read more: Self-Googling” Isn’t Just Vanity; It’s a Shrewd Form of Personal ” Brand Management

So if you are writing online (via blog or forums or website); make sure you always build a positive self-image/brand 🙂

Mandriva Linux 2007 to be released in a couple of days

Posted on in Categories Linux desktop, News last updated September 27, 2006
Mandriva Linux 2007 to be released in a couple of days

Mandriva is a merger of Mandrakesoft, Lycoris, and Conectiva, which is a French software company, and creator of Mandriva Linux.

Mandriva Linux is well known for its Mandriva Control Center for administration (drakxtools).

Mandriva Linux 2007 is now available. It is more easy to use, more user-friendly and more powerful. It is ideal for the needs of all users, from the beginner to the SOHO user. Look no further for the best in Linux.

Following are key features:
Transgaming Cedega integrated to play your favorite games
LinDVD DVD player
Kaspersky anti-virus solution
New 3D desktop support and drak3D to configure it (also in the Mandriva One 2007)
New rpmDrake with combined installation / removal interface
New ‘Ia Ora’ Mandriva theme
drakVPN : New VPN configuration tool
Invictus Firewall : a redundant firewall !
Kernel 2.6.17
KDE 3.5.4
GNOME 2.16

Mandriva Linux 2007 will be released in a couple of days. You can download it once released.

(via Linux OS blog)