Wednesday, October 2, 2013

Force Stop server using Script

You have scripts to stop / start servers and sometimes due to memory leak or other reasons the server just doesn't shutdown .  Script doesn't work because of this.

Work around ? , is to kill the process .  

for tomcat

ps xu | grep 'tomcat' | grep -v grep | awk '{ print $2 }' | xargs kill -9

for jboss , you can use 'Standalone' keyword if you are using jboss7 or try to find the unique name from the process description

ps xu | grep 'Standalone' | grep -v grep | awk '{ print $2 }' | xargs kill -9

Memcached debugging using telnet


Telnet for Memcached

You can use telnet for doing some debugging for Memcache . 

Connect using telnet , port is usually 11211

telnet {memcachehost}  11211

commands

general  purpose to find version , memory etc
stats

Remove everything 
flush_all

Keys - there is no way to list all the keys 
get the stats items using 

stats items

request cache dump of each slab id with limit

stats cachedump 3 10

3 refers to the slab id
10  limit 

exit 
quit

Tuesday, September 24, 2013

Delete/Clear Solr

Here is the simple shell script I use for clearning everything from Solr .
!/bin/sh
URL="http://user:password@host:portnum/solr.master/core/update"
DATA="<delete><query>*:*</query></delete>"
echo Posting "\"$DATA\"" to "\"$URL\"" with commit=true
curl $URL?commit=true -H "Content-Type: text/xml" --data-binary $DATA
echo Complete