Archive

Archive for the ‘Database’ Category

How to deploy a neo4j instance in Amazon EC2 in 10 minutes

December 27th, 2011 negarnil 4 comments

Neo4j is a high-performance, NOSQL graph database with all the features of a mature and robust database. In this post I will explain how to deploy a neo4j instance in Amazon EC2 web service.

For this tutorial to take you no more than 10 minutes you should be able to execute properly some bash commands like mv, tar, ssh and scp (secure copy). I also assume that you have an account in Amazon Web Services and you are familiar to the process of launching instances. If not, I strongly recommend you to follow this starting guide and complete it till you manage to connect to your instance with ssh.

Start downloading the latest stable version of neo4j. Which you can find here. The “Community Edition” fits well for development purposes. Do not forget to select the Unix version of the server. This will download a tar.gz file which you will copy to your EC2 instance later.

While you download the neo4j server open the AWS Management Console and launch a Basic 32-bit Amazon Linux AMI. If you want to launch an Ubuntu AMI please notice that it doesn’t ship with Java, which is required for running neo4j.

If you are not familiar with key pairs, pem files or security groups I insist you to follow the EC2 starting guide I mentioned above. You can either create a new security group or use the default, but you will need to configure a new security rule for the neo4j server port.

After launching the instance, create a TCP rule on port 7474 with source 0.0.0.0/0. Here you are opening port 7474 for anyone. If you are planning to use the neo4j REST API and remotely call it from another server, for example a Rails application hosted in Heroku, for security reasons, you may want to change the source field to the address of your Heroku server.

Do not forget to open port 22 (SSH), this is typically the first rule normal people create after launching an instance.

You are almost done! You should now install neo4j in your instance. Open a terminal in your localhost and navigate to the path where you downloaded neo4j. Copy the file to your Amazon instance by using the scp command:

scp -i your_pem_file.pem neo4j-community-1.6.M01-unix.tar.gz ec2-user@YOUR_PUBLIC_INSTANCE_DNS:/home/ec2-user

Please notice that you will need to change the path to your pem file, typically placed in ~/.ssh, the filename of the neo4j server you just downloaded and the plublic DNS of your instance.

Now connect to your instance with SSH:

ssh -i your_pem_file.pem ec2-user@YOUR_PUBLIC_INSTANCE_DNS

Untar the neo4j server:

tar xvfz neo4j-community-1.6.M01-unix.tar.gz.tar.gz

Move it to /usr/local and rename the folder to neo4j:

sudo mv neo4j-community-1.6.M01 /usr/local/neo4j

Almost done!!! You should now open neo4j-server.properties under the conf directory and add the following line:

org.neo4j.server.webserver.address=0.0.0.0

This lines allows anyone to connect remotely to your neo4j database server.

Now run the start script. From the neo4j server folder.

sudo ./bin/neo4j start

Finally, open a browser and access the webadmin interface of your neo4j database by typing http://YOUR_PUBLIC_INSTANCE_DNS:7474. You should see the Neo4j Monitoring and Management Tool, pretty cool!

If not, ask me :)

You can now try using the REST API and the curl bash command to insert nodes and relationships.

I hope this post helped you, good luck! Follow me on Twitter @negarnil

Share
Categories: Database, Java, neo4j Tags: , ,

Amazon Scales MySQL for Heavy Traffic

November 27th, 2010 negarnil No comments

Amazon Scales MySQL for Heavy Traffic
— Amazon Web Services (AWS) has added Read Replicas to its Relational Database Service (RDS) to make it easier to scale MySQL deployments to meet the performance demands of high-traffic web applications.

Read Replicas lets users create one or more copies of a MySQL Database Instance and an application serve read traffic from the multiple replicas. They can create or delete replicas in minutes using the point-and-click interface of the AWS Management Console.

Amazon says Read Replicas can be made to another Availability Zone as a disaster-ready failover measure under its Multi-AZ deployments program. Once a Read Replica is created, any subsequent updates to the source will automatically be replicated in the Read Replica. And Read Replicas can be elastically added to any RDS database deployment to keep query response times fast, even as request volumes scale.

Amazon figures it now offers advantages in scalability, multi-data center availability, elasticity and administration at a fraction of the cost of operating MySQL servers on-premise.

Sony Computer Entertainment America says it ran benchmarks comparing Amazon RDS to its hand-tuned MySQL instances and found RDS performed significantly better.

Amazon RDS has also lowered prices for High Memory Database Instances. The prices for 68GB Quadruple Extra Large Database Instances and 34GB Double Extra Large Database Instances have dropped ~15%.

See http://aws.amazon.com/rds/.

If you enjoyed this post follow me on twitter or leave a feedback !

Share

Getting the Best MySQL Performance in Your Products: Part 1, The Fundamentals

September 4th, 2010 negarnil No comments

Hi ! I found this must-to-read webcast which explains the basics of MySQL performance, it is quite new ! In my opinion anyone who aims to manage a database application should at least be aware of these topics !

If you use Hibernate to manage the database layer of your web applications you should never be satisfied with the default configuration it provides. Hibernate does provides caching strategies and other tuning features like c3p0 but you can go much further of that configurations to better optimize the database.

I recommend you to launch the webcast and follow it using the slides which you can download as a PDF. Apparently, the MySQL expert who speaks during the webcast had problems to change the slides just before starting explaining the next one, so for some moments it’s kind of messy.

Launch the webcast from here or click the image below.

You can also check this video from Google Talks which explains some other topics about performance tuning in MySQL.

Bye ! Keep around !

If you enjoyed this post follow me on twitter or leave a feedback !

Share