Archive

Archive for the ‘Linux’ Category

Notes on installing pgbouncer

September 15th, 2009 No comments

.. this is me just dumping my brain from the office after installing pgbouncer. FYI it works great, and really does improve the speed for db generated web pages. Don’t take this as THE install method, this is just notes so I can remember how to do it again :P

Get the source from pgfoundry ( I put it in /usr/local )
wget http://pgfoundry.org/frs/download.php/2284/pgbouncer-1.3.1.tgz

Unpack it
gunzip -c pgbouncer-1.3.1.tgz | tar -xv

Get / unpack / make libevent if not already installed
wget http://www.monkey.org/~provos/libevent-1.4.12-stable.tar.gz
gunzip -c libevent-1.4.12-stable.tar.gz | tar -xv
cd libevent-1.4.12-stable
./configure
make
make install

Back to pgbouncer
cd pgbouncer-1.3.1
./configure
make
make install

Move the ini and user files to /etc so I know where they are
mv etc/pgbouncer.ini /etc/
mv userlist.txt /etc/

Edit the userlist.txt to add user
Edit the pgbouncer.ini to point to new locations
auth_file = /etc/userlist.txt
logfile = /var/log/pgbouncer.log
pidfile = /tmp/pgbouncer.pid

Add libevent module ( fixed library not found error )
vi /etc/ld.so.conf.d/libevent-i386.conf

add line
/usr/local/lib

Run ldconfig to take new settings
ldconfig

I added the following to the START of postgresql in /etc/init.d
$SU -l postgres -c "pgbouncer -d /etc/pgbouncer.ini"

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Linux Tags:

ls sort by date

September 7th, 2009 No comments

ls -l|sort -n +4

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Linux Tags:

Blocking the searchme.com bot

July 15th, 2008 No comments

Nice idea for a search engine, however, their bot is a disrespectful bastard, doesn’t obey robots.txt, plus as it’s a visual search engine, processes Javascript tracking which throws your stats off.

Block it using iptables thus

iptables -I INPUT -m iprange --src-range 165.193.254.1-165.193.254.254 -j DROP
iptables -I INPUT -m iprange --src-range 208.111.154.1-208.111.154.254 -j DROP

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Linux Tags:

Why does df and du show different used disk space?

August 19th, 2007 No comments

Simple answer:

Do a

lsof | grep "deleted"

and see what shows up. du shows the usage, df shows free space BUT still counts files that have been deleted but are open by a process. Some examples of these types of files would be Apache access or error logs that have been deleted but the server has not been restarted or something I came across was a duff MYSQL process locking table data file thats had been deleted.

Simple option to get rid of these files is to restart your server, but, if this is not possible look at the PID that has the file locked and see if you are able to kill or restart the process.

I had no clue, but this guy did:

http://www.walkernews.net/2007/07/13/df-and-du-command-show-different-used-disk-space/

so kudus to him.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
Categories: Linux Tags: