RSS

Tag Archives: Linux

ec2ssh – ssh utility Amazon forgot to include

Last week I wrote a bash script that makes connecting to AWS instances ridiculously easy. It’s called ec2ssh.

Let me show you how easy it is to use. You type ec2ssh in your shell, and a menu displays with a list of running instances. Each of your servers is numbered and grouped by security group, so it’s easy to find your instances. You can do several things here. You can type the number of the server you wish to connect to, or define a list or range of servers you wish to ssh to in a sequence.

Additionally, you can run ec2ssh with parameter, a filter, to narrow down your list of servers. Say, you run a typical environment with web, database, application servers. If your instances were tagged by meaningful names like:
– Live MySQL server A
– Live MySQL server B
– Live MySQL server C
– Live Web server A
– Live Web server B

– Live Web server XYZ

you can limit the list by specifying a meaningful parameter such as:
ec2ssh live – would list all production servers
ec2ssh mysql – would list MySQL servers in dev, staging and production
ec2ssh i-2asf3234dd – would list information for given server instance
ec2ssh sg-adf23df2d – would list all servers in a given security group

Parameters are case insensitive. To use a script, download it from the ec2ssh github page. If you’re a github user please fork the project and submit any new features or fixes.

Thanks and enjoy! Your comments are very welcome.
Advertisements
 
Leave a comment

Posted by on February 1, 2012 in Linux, Mac OS, Uncategorized

 

Tags: , , , , ,

How to fix /tmp 100% usage problems

This was happening a lot on my main server (RHEL Linux with cPanel). Ever since I chose a cPanel installation, the /tmp directory was often spiking to 100%. The mistery was that I couldn’t list the files to see the cause of those spikes in /tmp usage. Regular ‘ls’ command was showing files, but nothing alarmingly big, and nowhere close to 1G that I had allocated to /tmp.

I first changed a temporary directory for my Web applications. Instead of /tmp I used /tmp-sc, and fixed my applications accordingly. When /tmp goes to 100% at least my applications were able to use a disk cache.

Next, I decided to have MySQL use /tmp-mysql. Created a new directory with proper permissions and added a tmpdir option to mysqld section of /etc/my.cnf

[mysqld]
tmpdir = /tmp-mysql

I restarted MySQL and voila, all my troubles were gone.

The server with 2GB of ram and 2 cores now serves over 1 million PHP pages + many many more static images and the best part is that the load on the server rarely goes above 1.

If you find this tip helpful, let me know.

 
1 Comment

Posted by on July 23, 2008 in Linux

 

Tags: , ,

 
%d bloggers like this: