Friday, December 16, 2011

Finding the largest sized directory


One of our servers keeps running out of disk space. To address this, we needed to find out which folders had the largest size.

On ubuntu server 10.04LTS, this is how we found the directories with the greatest size:

du -m /var/log | sort -n -r | head -n 10


I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Wednesday, December 14, 2011

Creating a Latin1 PostgreSQL database in Ubuntu 10.04LTS

I've encountered this problem several times already and I've finally stumbled upon a solution.
The Problem:
We were tasked to move a postgresql database from an centos based server to a new ubuntu based server. The database was in latin1 encoding.

On the new ubuntu based server, creating a database with latin1 encoding results in an error.
Command: createdb -E LATIN1 --template template0 trial
Result:
createdb: database creation failed: ERROR:  encoding LATIN1 does not match locale en_PH.utf8
DETAIL: The chosen LC_CTYPE setting requires encoding UTF8
The Fix:
First we needed to modify /var/lib/locales/supported.d/local and add the line:
en_PH.ISO-8859-1 ISO-8859-1

Next we had to regenerate the locale files with:
sudo dpkg-reconfigure locales

Afterwards we were able to create a latin1 database with:
createdb -E LATIN1 --template template0 --locale en_PH.ISO-8859-1 trial

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Thursday, November 17, 2011

Changing hostname on Ubuntu Server 10.04LTS

I found out the hard way that it's changing the name of an Ubuntu Server 10.04LTS was not as straight forward as I initially thought. To save you and me the trouble and for future reference, I document how I did it here.
hostname NEW_NAME
echo NEW_NAME > /etc/hostname
cat /etc/hosts | sed s/OLD_NAME/NEW_NAME/g > /etc/hosts.new
mv /etc/hosts /etc/hosts.old
mv /etc/hosts.new /etc/hosts
I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Wednesday, November 02, 2011

Monitoring Tomcat6 with VisualVM on Ubuntu

One of our applications running on Tomcat6 was encountering an issue which was drastically affecting the delivery of services to our clients. To diagnose this, we needed to monitor the state of the virtual machine running Tomcat6. This is what I had to do:

Assumptions:
- tomcat6 installed on an ubuntu server instance
- firewall on the server instance is enabled
- server has non public ip address: 10.0.0.1
- client machine installed with java6 which includes visualvm

1) download catalina-jmx-remote.jar and copy it into the tomcat6 lib folder. At the time of this writing, I found it here: http://apache.opensourceresources.org/tomcat/tomcat-6/v6.0.33/bin/extras/

2) modify /etc/defaults/tomcat6, add the following line to JAVA_OPTS

-Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false -Djava.rmi.server.hostname=10.0.0.1

3) modify /etc/tomcat6/server.xml, add the following line inside the server block near the other listeners:
<Listener className="org.apache.catalina.mbeans.JmxRemoteLifecycleListener"
rmiRegistryPortPlatform="8086" rmiServerPortPlatform="8086" />

4) enable access to port 8086

ufw allow 8086

5) restart tomcat6
service tomcat6 restart

6) start visualvm on the client machine and add a jmx connection: 10.0.0.1:8086

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.

Sunday, September 18, 2011

Installing Oracle 10g XE on Ubuntu 10.10

Found myself needing to install oracle 10g xe on Ubuntu 10.10.

add-apt-repository "deb http://oss.oracle.com/debian unstable main non-free"
wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle  -O- | sudo apt-key add -
apt-get install oracle-xe-universal
/etc/init.d/oracle-xe configure
/etc/init.d/oracle-xe enable

I hope you found the post useful. You can subscribe via email or subscribe via a feed reader to get relevant updates from this blog. Have a nice day.