Install Membase 1.6.5.3 on Amazon EC2 and configure it on EBS

Posted on May 15, 2011

As your application grows (like ours did) you will need more space to store your cache.

In our case, we needed to move from memcached to membase and make use of both memory and disk space. The decision was made and we decided to go with a 2 server solution, each server has 16G of memory and 100G of EBS volume attached to it. Also, both will have membase latest stable version installed and perform as a cluster in case one falls or anything happens, a fail safe if you will.

In this post, I will walk you though what was done to perform this and how exactly it was done on the amazon cloud.

First things first, select an AMI from your list and click on “Launch instance”.

Launch an instance from an AMI

You will see a dialog popup where you need to select the instance type.

Select instance type on Amazon

I selected the 16G memory server, I launched 2 instances from this type. Like I said before, I wanted those to perform in a cluster so I will have a fail safe option.

Now, you have 2 servers up and running. Because those servers are serving as a membase solution to production servers, I also configured an elastic IP to them.

Now, let’s create our volumes.

Creating EBS volumes and attaching to your instance

Go to the EBS section and click on create volume (top right in this image).

Create an EBS volume

You will see this dialog:

Select the size of your new EBS volume

Just select how many Gigs you want, availability zone (make sure it’s the same as the server availability zone or you will have performance issues).

Once the EBS volumes (I needed 2) are ready, all you need is to attach those to your servers.

You right click on the volume and select “attach”, you will see very detailed information about what you need to do there (very simple)

OK, so now we have our servers and volumes attached to them (instances don’t “know” the EBS’s yet).

SSH into your instance.

Mounting your EBS volume to the instance

After you ssh into your instance run these commands to have your volume installed on the instance (You can mount in another folder and not the one I selected here).

[shell]

yes | mkfs -t ext3 /dev/sdf

mkdir /mnt/data-store

mount /dev/sdf /mnt/data-store

[/shell]

This will mount the EBS to the /mnt/data-store folder, which we will use in a few minutes to have membase work on this folder and not steal space from the server main disk (which will result in a crash).

Downloading and installing membase on your new instance

First, a cleanup…

I had the instances created from an AMI that already had a previous version of membase (1.6.4) installed on it. So first, you will need to clean those up like so:

[shell]

rpm -e membase-server-

[/shell]

I ran this:

[shell]

rpm -e membase-server-1.6.4

[/shell]

Now, go to membase.com, register for the download and you will be able to download the package you need, you can select from a variety of versions.

Couchbase website, select your download

Copy the download link and go back to your server.

Put this in your shell and click ‘Enter’.

[shell]

wget your_download_link

[/shell]

I have a server with RPM but it’s all the same with another package manager.

After you have the file downloaded to the server, run this command:

[shell]

rpm –install your_rpm_file.rpm

[/shell]

Now you have membase installed on the server. Congrats!

All should be running now.

Configuring the membase server after installation

From here, you can read the getting started in the membase wiki, it’s very good from here on:

http://techzone.couchbase.com/wiki/display/membase/Getting+Started