Wednesday 21 November 2012

Setting Hadoop replication




checking the replication factor on files:

hadoop fsck /user/analytics/staging_intellitxt/ -files -blocks

Setting the replication, where R = replication number

hadoop fs -setrep -R 2 /

This takes approx 5 minutes to complete and will give you a saving of about 30% in disk space!



Thursday 1 November 2012

Nagios missing nagios.cmd

So that's missing and you can't run nagios or check_mk??

root@nagios:/var/log/nagios/rw# mknod nagios.cmd p
root@nagios:/var/log/nagios/rw# chown nagios:apache nagios.cmd
root@nagios:/var/log/nagios/rw# chmod 660 nagios.cmd
root@nagios:/var/log/nagios/rw# ls -la
total 8<br />
drwxrwxr-x 2 nagios apache 4096 Oct 30 13:37 .
drwxrwxr-x 5 nagios apache 4096 Oct 30 13:43 ..
prw-rw---- 1 nagios apache 0 Oct 30 13:37 nagios.cmd
root@nagios:/var/log/nagios/rw# /etc/init.d/nagios restart

How to restore a deleted file on git

Well let's see, you had a file in git, and one of the previous commits deleted this file.

You need this back.

Easiest way is to issue this command to list the commits and files affected.

git log --name-status

Once that's done - simply grep

git log --name-status |grep network.rb -A 5 -B 20

commit 98eaede206accb82d5fcb8ec07c1187344e60232
Author: Anthony
Date:   Tue May 15 16:52:26 2012 +0100

    Deprecate get_cluster_config
   
    Change-Id: Id3472f421c77a8ee18f78db8424333484636e813

D    modules/base/lib/facter/network/itxtcluster.rb
D    modules/base/lib/facter/network/itxtrank.rb
D    modules/base/lib/facter/network/network.rb
D    modules/itxt/files/bin/get_cluster_config
M    modules/itxt/manifests/files.pp
M    modules/itxt/templates/40tomcat-itxt.frag.erb
D    modules/pixelling/files/bin/get_cluster_config
M    modules/pixelling/manifests/init.pp

 



Then to restore the file.... find the last commit that affected that file:

 
git rev-list -n 1 HEAD -- <file_path>


check out that version before the commit

git checkout <deleting_commit>^ -- <file_path>