วันศุกร์ที่ 20 กุมภาพันธ์ พ.ศ. 2558

Migrating memcache to another host


Data in memcached have a big impact on database server. If you flush everything in the memcached and let the program fill the cached again, this might effect server performance for a while. To migrate memcached server there are memcached-tool and nc command to help you


$ memcached-tool server1:11211dump |nc server2 11211

This command will dump everything from server1 to server2. However, if your data didn't set expiration, the data might be lost during migration. As always, test what you are going to do before go to production.

awk print error from Apache error logs



Apache log can contain several line of error. Counting the occurrence of each error is a good way to start.

Apache log separate field with "[ ]". Using sort for sorting error and uniq with -c option to count the number of occurrence.

Here to list all in error regardless of warning or error :
awk -F'[\[\]]+' '{print $7}' error.log | sort | uniq -c | sort -nr

To filter for error add the logic to awk :

awk -F'[\[\]]+' '$4 == "error"{print $7}' error.log | sort | uniq -c | sort -nr

From http://sudarmuthu.com/blog/how-to-print-unique-errorswith-count-from-apache-error-logs/

วันจันทร์ที่ 5 มกราคม พ.ศ. 2558

dmidecode : finding server serial number command

dmidecode is a tool for dumping a computer's DMI (some say SMBIOS) table contents in a human-readable format. This table contains a description of the system's hardware components, as well as other useful pieces of information such as serial numbers and BIOS revision. Thanks to this table, you can retrieve this information without having to probe for the actual hardware

dmidecode --type 1  system information : server model, serial
dmidecode --type 4  CPU
dmidecode --type 17 memory device & slot 


Reference : howtoforge.com