Category: sysadmin

  • Tips for beginners with Puppet (server automation)

    Since Puppet is written in Ruby, some of its syntax are Ruby-specific (I would not know for sure since I have not learned about Ruby yet). I’ll try to update this post so beginners to Puppet and strangers to Ruby can get pass the unwanted headache. Case-sensitivity Case-changing is one of the source of confusions.…

  • DIsplay return code of a shell command

    If you need to determine the return code for shell scripting, you can use “$?” # ifconfig | grep eth0 >/dev/null 2>&1 # echo $? 0 => good/found # ifconfig | grep eth1111 >/dev/null 2>&1 # echo $? 1 => bad/not found

  • haproxy and stunnel

    This quick reference to install haproxy, stunnel to support SSL forwarding (with IP forwarding patch) wget http://haproxy.1wt.eu/download/1.3/src/haproxy-1.3.22.tar.gz tar -zxf haproxy-1.3.22.tar.gz cd haproxy-1.3.22 make TARGET=linux26 cp haproxy /usr/sbin/haproxy vi /etc/haproxy.cfg … vi /etc/init.d/haproxy … chmod +x /etc/init.d/haproxy useradd haproxy mkdir -p /var/chroot/haproxy chown haproxy:haproxy /var/chroot/haproxy chmod 700 /var/chroot/haproxy service haproxy start chkconfig –add haproxy vi /etc/sysconfig/syslog…

  • Install APC automatically via script

    If you try to install APC via scripting, you might experience the interactive prompt asking about “apxs”. How to by pass that? Use expect (“yum install expect”). This script will solve your problem: #!/usr/bin/expect spawn pecl install apc expect “Use apxs to set compile flag” send “yes\r” expect “install ok” expect eof

  • Hadoop vs. MySQL

    I just play with Hadoop, HBase, Hive, Pig via Cloudera’s guide (thanks to Cloudera for bringing these packages to CentOS) for a couple days. Cloudera is going in the right direction, targeting the enterprises. Hadoop is definitely on the watch list as it matures. But right now, it’s very technical and would not be suitable…

  • Hive troubleshooting

    I am playing with Hadoop and Hive via Cloudera RPMs. The development status is very active, meaning it could be hard to track down the errors or find help with a specific one. Permission of /tmp in HDFS FAILED: Unknown exception : org.apache.hadoop.fs.permission.AccessControlException: Permission denied: user=mathie, access=WRITE, inode=”tmp”:hadoop:supergroup:rwxrwxr-x Solution: You need to turn on full…

  • haproxy vs. LVS (layer 7 vs layer 4 load balancing)

    We just deployed our first haproxy load balancer and still running several LVS-TUN load balancers. Even when advertised as a fast and lightweight, it’s comparing with other layer-7 LB, not with layer-4 LB like LVS. Load Average / CPU Usage haproxy still requires much more resource. On the same really basic server (Pentium 3/4 or…

  • Monitor LSI MegaRAID under CentOS

    Not very user friendly with documentation but I guess at least it runs! $ wget http://www.lsi.com/DistributionSystem/AssetDocument/support/downloads/megaraid/miscellaneous/linux/1.01.39_Linux_Cli.zip $ unzip 1.01.39_Linux_Cli.zip $ rpm -Uvh MegaCli-1.01.39-0.i386.rpm $ /opt/MegaRAID/MegaCli/MegaCli64 -AdpAllInfo -a0 Basic Monitor Script #!/bin/sh CONT=”a0″ STATUS=0 MEGACLI=/opt/MegaRAID/MegaCli/MegaCli64 echo -n “Checking RAID status on ” hostname for a in $CONT do NAME=`$MEGACLI -AdpAllInfo -$a |grep “Product Name” | cut…

  • init.d script for gearmand

    #!/bin/bash # # gearmand Startup script for the Gearman server # # chkconfig: – 85 15 # description: Gearman is a distributed job system. # processname: gearmand # config: /etc/sysconfig/gearmand # pidfile: /var/run/gearmand/gearmand.pid # ### BEGIN INIT INFO # Provides: gearmand # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: # Default-Stop: # Short-Description:…

  • init.d script for stunnel on CentOS

    You might need to modify some settings to suite your installation. I installed from source. whereis stunnel (might need to ln -s /usr/local/bin/stunnel /usr/sbin/stunnel) vi /etc/init.d/stunnel #!/bin/bash # # stunnel This shell script takes care of starting and stopping # stunnel # # chkconfig: 345 80 30 # description: Secure tunnel # processname: stunnel #…