This project aims to develop an elastic distributed database using mysql replication to guarantee high availability and dynamic scalability and use it to serve as the backend for a multi-tier web application running TPC-W benchmark.

Configuration on single ec2
Config on AWS and install necessary tools on ec2(master node). password for mysql is : TigerBit!2016(default)
sudo apt-get update
sudo apt-get install -y openjdk-7-jdk ant gcc links git make
sudo apt-get install mysql-server
sudo apt-get install tomcat7

on slave nodes and candidate node, only mysql and java needs to be installed.

Clone repository
git clone
git clone
Initialize Database
mysql -uroot -p < /home/ubuntu/elasticDB/tpcw/mysql.sql
cd java-tpcw
patch -p1 < /home/ubuntu/elasticDB/tpcw/tpcw.patch // apply patch
ant dist
sudo rm -rf /var/lib/tomcat7/webapps/tpcw* // not necessary for the first time
sudo cp /home/ubuntu/java-tpcw/dist/tpcw.war /var/lib/tomcat7/webapps
ant gendb // populate database
sudo ant genimg // presentation tier
Log in the web page
Configuration on multiple ec2

Use our own laptop as client emulator, which is respond for sending different request.

Set root password to: 0307
sudo su
Change config to allow access from outside
vi /etc/ssh/sshd_config

change PermitRootLogin to yes and PasswordAuthentication to yes

service ssh restart
Copy key-pairs
sudo su
cd ~
ssh-keygen -t rsa
ssh-copy-id [email protected]

my computer copy to 4 ec2 instances, master copy to 4 ec2 instances(including itself), slaves should copy to the other 3 ec2 instances. Copying key of a to c means that c grants access to a

Clone repo
git clone

change the corresponding ip address in and run to test communications

MySQL Replication

Run and then log in to master node and run mysql

mysql -uroot -p
#pwd: TigerBit!2016

inside mysql enter the following commands:

mysql> use canvasjs_db;
mysql> select * from datapoints;

download related dependency for this project:

mvn dependency:resolve
mvn eclipse:eclipse

and then change ipaddress in in our project:

writeQueue =
readQueue = ,,
candidateQueur =


主题: 数据MySQLSQL数据库
tags: tpcw,mysql,copy,install,apt,ec2,home,get,elasticDB
本文标题:ElasticDistributedDatabase 数据库 数据库学习 数据库知识 ElasticDistributedDataba ...

技术大类 技术大类 | 数据库(综合) | 评论(0) | 阅读(115)