Monday, November 29, 2010

analyze this

my favorite log analyze tool

cat /var/log/apache2/access.log.1 |grep '" 200' | awk '{print $7}' |sort| uniq -c |sort -rn |more

Tuesday, October 19, 2010

my ip from command line

wget -q -O - checkip.dyndns.org|sed -e 's/.*Current IP Address: //' -e 's/<.*$//'

Friday, September 17, 2010

enable sun-java in google chrome

1. cd /opt
2. Go to http://java.sun.com/javase/downloads/index.jsp and download Java JDK 6
3. sudo sh jdk-6u21-linux-i586.bin
4. ln -sf /opt/jdk1.6.0_21/jre/lib/i386/libnpjp2.so /opt/google/chrome/plugins/
5. restart your google chrome
6. go to chrome://plugins/ webpage and check "Java(TM) Plug-in 1.6.0_21"

Friday, May 21, 2010

nginx core dump backtrace

add strings to nginx.conf

worker_rlimit_core 500m;
working_directory /path/to/corefiles;


restart nginx.

Follow to /path/to/corefiles and wait for segfault :)

then gdb /path/to/nginx /path/to/core
inside gdb input bt

Thursday, March 18, 2010

ext4 disable journal

At one high loaded web project I needed a very fast file system. I decided to use Ext4 with disabled journal (As a google:))).

# Create ext4 fs on /dev/sda10 disk
mkfs.ext4 /dev/sda10

# Enable writeback mode. This mode will typically provide the best ext4 performance.
tune2fs -o journal_data_writeback /dev/sda10

# Delete has_journal option
tune2fs -O ^has_journal /dev/sda10

# Required fsck
e2fsck -f /dev/sda10

# Check fs options
dumpe2fs /dev/sda10 |more

For more performance add fstab opions: data=writeback,noatime,nodiratime
i.e:
/dev/sda10 /opt ext4 defaults,data=writeback,noatime,nodiratime 0 0

Tested at non-boot partition ;)

Friday, March 5, 2010

Key-Value Storages

memcached - distributed memory object caching system ( http://memcached.org/ )
memcachedb - distributed key-value storage ( http://memcachedb.org/ )
redis - A persistent key-value database with built-in net interface written in ANSI-C for Posix systems ( http://code.google.com/p/redis/ )
MongoDB - scalable, high-performance, open source, schema-free, document-oriented database. Written in C++ ( http://www.mongodb.org )
CouchDB - doc. oriented, written in Erlang ( http://couchdb.apache.org/ )
Riak - NoSQL, decentralized ( http://riak.basho.com/ )
RINGO - distributed key-value storage for immutable data, written in Erlang ( http://github.com/tuulos/ringo )
Dynamo - Amazon’s Highly Available Key-value Store ( http://www.allthingsdistributed.com/2007/10/amazons_dynamo.html )
Cassandra - highly scalable, eventually consistent, distributed, structured key-value store. "Dynamo 2.0" ( http://incubator.apache.org/cassandra/ )
Scalaris - scalable, transactional, distributed key-value store ( http://code.google.com/p/scalaris/ )