Skip to content

Instantly share code, notes, and snippets.

@xman1980
xman1980 / gist:278c70a89206724fdef5
Created May 19, 2015 17:44
confluent.io init.d zookeeper
DAEMON_PATH=/usr/bin
DAEMON_NAME=zookeeper
# Check that networking is up.
#[ ${NETWORKING} = "no" ] && exit 0
PATH=$PATH:$DAEMON_PATH
# See how we were called.
case "$1" in
start)
@xman1980
xman1980 / gist:6c54ad86fc3150f99862
Created May 20, 2015 10:48
export the Cloudera Manager configuration
curl -u admin:admin http://10.2.14.81:7180/api/v8/cm/deployment > cme-cm-export.json
@xman1980
xman1980 / gist:eeadaf46201c04df46ef
Created May 20, 2015 11:00
backup hadoop namenode fsimage
#!/bin/bash
#Variables
TODAY=$(date +"%Y-%m-%d-%H%M") #date and time
BACKUP_PATH="/home/backup/hadoop/fsimage" #path to store metadata
RT_DAYS="4" #Rentention in days
#Logic
if [ -d ${BACKUP_PATH} ]; then
cd ${BACKUP_PATH}
@xman1980
xman1980 / gist:0274884b545a2e9eff88
Created May 21, 2015 18:41
mysqlcheck+optimize
mysqlcheck -u root -p --auto-repair --check --optimize --all-databases
pip freeze --local | grep -v '^\-e' | cut -d = -f 1 | xargs -n1 pip install -U
hive -e 'set -v;' | cut -c 1-80 | grep mapred
@xman1980
xman1980 / gist:7a9b79d670dcb892e3fc
Created June 22, 2015 19:17
wget_java_download_centos
--------------- For 32-bit Systems ---------------
# cd /opt
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-i586.rpm"
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jre-8u45-linux-i586.rpm"
--------------- For 64-bit Systems ---------------
# cd /opt
# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u45-b14/jdk-8u45-linux-x64.rpm"
@xman1980
xman1980 / gist:cf8f2d88d2185176d81d
Created July 1, 2015 01:36
Fix the under replicated blocks
#!/bin/bash
#
# $Author:$
# $Id:$
#
# Fix the under replicated blocks by setting the replication factor for all of the
# under replicated blocks
#
# Nikhil Mulley
#
@xman1980
xman1980 / gist:201e4b421360c8f58f6c
Created July 1, 2015 01:51
grep missed replicas hdfs
hadoop fsck / | egrep -v '^\.+$' | grep -v eplica
for f in `hadoop fsck / | grep "Replica placement policy is violated"
| head -n3000 | awk -F: '{print $1}'`; do
hadoop fs -setrep 4 $f
hadoop fs -setrep 3 $f
done