News Flash 1 2 3 Next
2009-01-06 10:50:15 -- For anyone trying to install MySQL PDO support for PHP there is one little gotcha to lookout for. If the PECL install fails or restarting apache errors out due to an undefined symbol error, you will have to recompile PHP without PDO support. If you have already been trying to compile with PDO support do a make clean and make install. Once you have successfully compiled PHP go ahead and install PDO and PDO_MySQL with the PECL installer. The version of PHP that I ran into this bug with was the 5.2.5 release.
2007-06-06 14:05:22 -- Oracle Enterprise Manager. A great addition to the Oracle 10g database and full of some great tools. But like any new piece of software there are always little problems. Two common ones for EM that I have recently found answers to are:
1. After changing the port for the database listener from the standard 1521 to another port, the Enterprise Manager console will no longer be able to connect to the database past the initial login / status screen. This problem is fixed using the "emca" tool. This tool is the command line version of the Enterprise Manager Configuration Assistant. The easiest way to get around the problem with the port is to drop and recreate the repository for EM. This is done by first issuing the "emca -deconfig dbcontrol db -repos drop" command. The next thing is to recreate the repository with the "emca dbcontrol db -repos create" command. You can use the "emca dbcontrol db -PORT
2. The next problem is minor but still a pain in the ass. It deals with securing the EM console so that it is only accessible over SSL. This is done by using the "emctl secure dbconsole" command. The thing to watch for here is that you do not issue this command while the EM console is already running. If you do, you will continually receive an error message after logging into EM saying that the connection to the database has been reset. Be sure to stop the dbconsole with "emctl stop dbconsole" first.
One of my favorite tools in the EM console is the performance graphing and Top SQL statements listing. This gives you the ability to see real-time graphs of the most executed SQL statements as well as the top user sessions and other useful metrics. This can be helpful in diagnosing performance problems that can arise from queries that have not been tuned such as queries that require full table scans etc.
Another thing I have been playing with in Oracle is watching the SQL statements by selecting from the v$sql view. This view allows you to watch currently running SQL statements and filter by time, user, etc. Pretty handy for watching SQL statements that are generated from objects such as from Hibernate.
2007-05-08 14:26:18 -- So what did I learn today? Traps in bash scripts. I have this ssh script that I wrote to control a large number of servers without actually having to login and execute commands on each one. With VMWare becoming so popular and the number of servers at most companies growing, it makes taking care of them a lot easier.
The script uses ssh-agent to hold the passphrase for the duration of the script run. The script has all the usual good features like error handling, logging, mail alert, and now it will catch a SIGINT or SIGTERM and stop the script. This helps because before if I stopped the script it would just leave a zombie ssh-agent process. Below is an example of the trap command. Pretty simple really, you have to know what signal you are trying to catch.
# Trap stop signals
trap stop SIGINT SIGTERM
# Cut the script off and stop ssh-agent from leaving a zombie
stop(){
echo -e "\nCaught stop signal...stopping script."
echo;ssh-add -D 2>&1|tee -a $LOG
eval `ssh-agent -k`|tee -a $LOG
err_exit "User stopped script. Goodbye!\n"
}
# Error out
err_exit(){
echo -e "\nError: "$1|tee -a $LOG
echo -e "Script ran with the following parameters.\n"|tee -a $LOG
echo -e "$PARAMS\n"|tee -a $LOG
cat $LOG|mail -s "JOB HALTED: Job initiated by $ID on `date`." $EMAIL
rm $LOG
exit 1
}
Someone was asking me about the $IFS variable in bash so I will show a little about that as well. $IFS is the internal field seperator in bash. The default value is space, tab, newline. You can change this to break up delimited text. The snippet below is overkill but it shows how to use $IFS and is a good way to strictly check the IPs of the servers for production environments that are more secure and cannot afford any errors. Just remember to save the original $IFS value.
# Function to validate IPs and set variables based on the IP octects
check_ip(){
OCTET=1
IFS=.
IP=( $1 )
if [ ${#IP[@]} == 4 ]; then
for i in ${IP[*]}; do
match=`echo $i|egrep -e '^[0-9]{1,3}$'`
if [ $? -ne 0 ]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
if [[ $i -gt 253 ]]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
if [[ $OCTET -eq 1 ]]; then
if [[ $i -ne 10 ]]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
fi
if [[ $OCTET -eq 2 ]]; then
if [[ $i -ne 164 ]]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
fi
if [[ $OCTET -eq 3 ]]; then
if [[ $i -ne 2 ]]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
fi
if [[ $OCTET -eq 4 ]]; then
if [[ $i -gt 200 ]]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
if [[ $i -lt 191 ]]; then
err_exit "IP Octet #$OCTET for server $IPNUM not valid - $i.\n\n"
fi
fi
OCTET=$(( $OCTET +1 ))
done
IFS=$ORIGIFS
success "IP Address $IPNUM Validated - ${IP[0]}.${IP[1]}.${IP[2]}.${IP[3]}."
else
err_exit "Invalid IP Address.\n\n"
IFS=$ORIGIFS
fi
}
2007-05-07 14:10:31 -- Just got mod_security up and running on my new box. Couple of little issues along the way but nothing too bad. While compiling I was getting an error that the Makefile could not find special.mk. This was fixed by installing httpd-devel.x86_64. Then I was getting an error that I didn't have the pcre libraries installed. Fixed that by installing pcre.x86_64 and pcre-devel.x86_64. Then I getting an unknown symbol error (xmlFree) as the server was loading the module. That was fixed by installing the latest version of libxml2-devel.x86_64.
2007-05-07 10:17:28 -- Alright, as a follow up to the last post about Sun Messaging, I have something everyone needs to watch out for in the configuration files for your application that is going to be using Sun messaging. The Sun Open MQ server will not create any queues that have a period in the queue name. Our previous naming convention for the queues was component.response.track or something like that so I changed it componentResponseTrack and it seems to be working just fine.
Blogidy News Blog 1 2 3 Next
More ...stuff, here soon. All in good time.

Copyright 2005 Kevin O'Brien

Show Menu
Hide Menu