With nearly two decades of experience working in the IT industry in various roles as Enterprise technology consultant, Java Architect, project leader, Engineer, Designer and Developer, Mr. Knutson has gained a wide variety of experience in disciplines including JavaEE, Web Services, Mobile Computing and Enterprise Integration Solutions. Over the course of his career, Mr. Knutson has enjoyed long lasting partnerships with many of the most recognizable names in the Health Care, Financial, Banking, Insurance, Manufacturing, Telecommunications, Utilities, Product Distribution, Industrial and Electronics industries employing industry standard full software life cycle methodologies including the Rational Unified Process (RUP), Agile, SCRUM, and Extreme Programming (XP). Mr. Knutson has also undertaken speaking engagements, training seminars, white paper and book publishing engagements world-wide. As an active Blogger and tweeter, Mr. Knutson has also been inducted in the prestigious DZone.com Most Valuable Blogger (MVB) group and can be followed at http://www.dzone.com/page/mvbs and twitter at http://twitter.com/mickknutson. Able to quickly and effectively adapt to any phase of an existing project from Business Modeling to Production Support, Mr. Knutson’s wide array of technical expertise in OOA / OOD / OOP, Java, J2EE, Internet, Oracle, Enterprise Integration and Message Oriented Middleware allow him to seamlessly integrate into your Information Systems project at any phase and provide immediate productivity. Mr. Knutson is exceptional at team building and motivating either at a peer-to-peer level, or in a leadership role with excellent communications skills and the ability to adapt to all environments and cultures with ease. Mick is a DZone MVB and is not an employee of DZone and has posted 18 posts at DZone. You can read more from them at their website. View Full User Profile

CentOS 5.5 horizontal scaling

  • submit to reddit

I have been running CentOS 5.4 for a while now, and my website http://www.blincmagazine.com has gotten to the point where I need to scale for additional traffic. So I decided instead of scaling vertically by adding more ram to my LAMP server, I would rather scale horizontally to ensure I have options later with additional traffic as well.

Add the server

I started with adding a server to my Rackspace Cloud Server starting with a 256mb image just to work on the configuration. This was very simple, and only took a few minutes to build.

There are easy instructions on the Rackspace site http://cloudservers.rackspacecloud.com/index.php/Creating_a_Cloud_Server and they where simple to follow.

The first thing I had to do, was wait for the server to be built, then I was able to login with the password given on the create server screen. I immediately logged in and changed it as I would never have remembered that password.

Usage: passwd [OPTION...] <accountName>

Update CentOS 5.5

The next thing I did was

sudo yum -y update

There where a few installs and upgrades

Transaction Summary
Install 6 Package(s)
Upgrade 39 Package(s)

This was easy, and I always liked YUM.

Install MySql

Once the updates have finished we will be ready to install the MySQL server. Type the following command to install the MySQL server:

sudo yum -y install mysql-server

The install should look like this

Transaction Summary
Install 4 Package(s)
Upgrade 0 Package(s)

Total download size: 15 M
Downloading Packages:
(1/4): perl-DBD-MySQL-3.0007-2.el5.x86_64.rpm | 148 kB 00:00
(2/4): perl-DBI-1.52-2.el5.x86_64.rpm | 600 kB 00:00
(3/4): mysql-5.0.77-4.el5_5.3.x86_64.rpm | 4.8 MB 00:01
(4/4): mysql-server-5.0.77-4.el5_5.3.x86_64.rpm | 9.8 MB 00:01
Total 5.2 MB/s | 15 MB 00:02
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : perl-DBI 1/4
Installing : mysql 2/4
Installing : perl-DBD-MySQL 3/4
Installing : mysql-server 4/4

mysql-server.x86_64 0:5.0.77-4.el5_5.3

Dependency Installed:
mysql.x86_64 0:5.0.77-4.el5_5.3 perl-DBD-MySQL.x86_64 0:3.0007-2.el5 perl-DBI.x86_64 0:1.52-2.el5


Once the updates have finished we will be ready to install the MySQL server. Type the following command to install the MySQL server:

sudo /etc/init.d/mysqld start

You should see MySql startup like this

Initializing MySQL database:  Installing MySQL system tables...
Filling help tables...

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h xxx password 'new-password'

Alternatively you can run:

which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.

See the manual for more instructions.

You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at


Support MySQL by buying support/licenses at http://shop.mysql.com
[ OK ]
Starting MySQL: [ OK ]</pre>
Now that we have the MySQL server running we need to secure our installation. Type the following command below to start the secure setup script:

[code language="bash"] sudo /usr/bin/mysql_secure_installation

Current Root Password

You will be asked for your current root password. Because this is a new installation it is set to none. Press enter.


In order to log into MySQL to secure it, we'll need the current
password for the root user. If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):

Remember, just hit [ENTER] here.

Set Root Password

If the above step worked correctly you should be prompted with a question asking you if you would like to set your root password. Please press Y and press Enter.

You will be asked for your root password twice. If it works you will see Success!.

Removing Anonymous Users

You will be prompted to remove the MySQL anonymous users. For security reasons we want to do this. The text above the question explains this topic in more detail. Press Y and then Enter.

Disallow Root Login

You will be asked if you would like to disallow remote login for the root user and only allow connections from the server itself. To keep our server secure you want to say Y and press Enter.

Delete test Database

MySQL ships with a default database called test. This is not needed and can be deleted. Press Y and then Enter to delete the test database and it's associated users.

Reload Privilege Tables

This step will reload the user settings (called privilege tables) so all user changes will take effect. Press Y and then Enter to continue.


Your MySQL installation is now finished. Keep in mind that this will only support local connections and does not allow you to connect remotely.

Reload privilege tables now? [Y/n] y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MySQL
installation should now be secure.

Thanks for using MySQL!

Not too hard. The next step will be


All-in-all, creating cloud servers is super easy. The next part will be to move my data to this MySql instance and start re-configuring my applications to use the new server. I also plan to setup DNS to alias server.baselogic.com to make everything easier, and to shield me if I change IP addresses.

Published at DZone with permission of Mick Knutson, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)



Manuel Jordan replied on Fri, 2010/11/26 - 12:48pm

Hello Mick, just curious, according with your experience and with your opinion, what is for you the best OS Linux for server environment/production and why, could be Debian RedHat CentOS? 

Kristian Rink replied on Fri, 2010/11/26 - 3:17pm

Enjoyed reading through this article; we use CentOS 5.x next to Ubuntu LTS as server operating system and so far have had a good time doing so. However, I am looking forward to reading future posts related to this topic: The way I see things, "scaling vertically" by simply adding more RAM, CPU, ... to the machine should be pretty straightforward inasmuch as that it doesn't really require too much tweaking of the applications in question. Scaling across several machines, I am curious to see your approaches on, in example, keeping databases in sync across the nodes, or taking care of load balancing between the different hosts. Overally, though I enjoy the idea of scaling up by adding more worker nodes, looking at our very applications we almost all the time ended up with adding more RAM or moving to a new machine again simply because the applications in question aren't up for being scaled across multiple nodes (yet).

Mick Knutson replied on Tue, 2011/01/04 - 12:04pm in response to: Manuel Jordan

Honestly, I am just an old school Red Hat user, so CENTOS was just a natural progression. I have found it quite easy, especially the vast YUM network, and industry support when you are interested in getting additional help.

Mick Knutson replied on Tue, 2011/01/04 - 12:08pm in response to: Kristian Rink

My issue was having MySql as a bottle neck, and just throwing more RAM at the server was costing too much for a single server. I.e the jump from 2GB was 4GB. I could not just add 512mb on a single server. So now, I not only am not fighting for CPU cycles on a single machine. Mysql is the only thing running on my data server, and my webserver just has Apache and PHP, nothing else.

Now, I have much more flexibility on the RAM for each server. 512mb for one and 2GB for the other.

Manuel Jordan replied on Tue, 2011/01/04 - 6:59pm in response to: Mick Knutson

Thanks for the reply Mick, about your Red Hat, some special version of your preference?

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.