MySQL Forums
Forum List  »  Synchronization

Synchronizing mobile databases with MySQL in Amazon cloud (AWS EC2 & RDS)
Posted by: Alice Qiao
Date: May 20, 2013 01:30AM

Following is a tutorial for setting up Pervasync server in the Amazon cloud so that you can sync your mobile devices with Oracle, MySQL or SQL Server databases hosted in Amazon cloud.

Preparing the AWS Env

1. Create an AWS account at http://aws.amazon.com/ec2/

2. Create a Beanstalk env to have a running Tomcat instance and a RDS database instance: http://aws.amazon.com/elasticbeanstalk/.
Setup the DB security group so that the DB instance can be accessed from the EC2 instance where Tomcat is hosted.

3. Create your app database, schema and tables. For MS SQL Server, connect to the DB server and create a database for your application’s DB schemas and tables. The DB name will be used as value of pervasync.server.db.database.name during Pervasync setup. For Oracle you supply the DB name during DB instance creation. The DB name will be the Oracle SID to be used in DB JDBC URL. For MySQL the RDS DB name is really the schema name.

4. For MySQL, create a DB Parameter Group and set the value of parameterlog_bin_trust_function_creators to 1. Modify the MySQL instance and set its parameter group to the one with log_bin_trust_function_creators set to 1. Reboot the DB instance.

Alternately to Beanstalk, you could also directly create an EC2 instance and RDS instance. To install Java & Tomcat on your EC2 instance, see
http://www.excelsior-usa.com/articles/tomcat-amazon-ec2-basic.html

Installing Pervasync in the AWS Env

Note: You need to substitute the host name, password etc. with yours in the following.

1. Download pervasync_server-5.0.3.zip from
https://www.dropbox.com/s/4uwhvo99j7ra2xc/pervasync_server-5.0.3.zip

2. Copy the zip file to your Amazon EC2 instance home folder:
scp -i keypair1.pem pervasync_server-5.0.3.zip ec2-user@ec2-54-214-122-102.us-west-2.compute.amazonaws.com:/home/ec2-user

3. Log on to your Amazon EC2 instance
ssh -i keypair1.pem ec2-user@ec2-54-214-122-102.us-west-2.compute.amazonaws.com

4. From now on act as root user. Un-package the zip in /usr/share/:
sudo su root
cd /usr/share/
unzip /home/ec2-user/pervasync_server-5.0.3.zip

5. Go to non-GUI install folder for your DB type, for example for SQL Server:
cd pervasync_server-5.0.3/util/mssql/
Edit pervasync_server_mssql.ini to supply your DB connection info:

#=========================================================================
#== Pervasync server for MS SQL Server ==
#== ini file for setup/uninstall ==
#== ==
#== Property values are needed and only needed when you run ==
#== the setup/uninstall scripts. After you are done with ==
#== setup/uninstall, you can erase sensitive info from this file. ==
#=========================================================================
# The JDBC URL to the Pervasync server repository database.
# Replace "localhost" with the DB host name or IP if DB is not on the same host
# For AWS RDS, replace "localhost" with the DB Endpoint

pervasync.server.db.url=jdbc:sqlserver://db1.cinuuz0ecpzz.us-west-2.rds.amazonaws.com:1433

# The database name. Replace "master" with the database name you created for your app

pervasync.server.db.database.name=myappdb

# Name and password of a DB user with root privileges.
# This user/account should be pre-existent.
# For AWS RDS, use the master user
pervasync.server.db.system.user=master
pervasync.server.db.system.password=welcome1234!

# PervaSync server admin user name and password. You would need to use this
# user/password pair to login to the web-based Pervasync admin console.
# If not already exist, a database user/schema with this name will be created
# in Pervasync server DB repository at setup time. At un-install time, the user/schema
# will be dropped.
pervasync.server.admin.user=pvsadmin
pervasync.server.admin.password=welcome1234!

6. Run the setup
./pervasync_server_mssql_setup.sh

7. Install Pervasync server web app to Tomcat
chown -R tomcat:tomcat /usr/share/pervasync_server-5.0.3
cp /usr/share/pervasync_server-5.0.3/config/Catalina/localhost/pervasync.xml /usr/share/tomcat7/conf/Catalina/localhost/
vi /usr/share/tomcat7/conf/Catalina/localhost/pervasync.xml

<?xml version="1.0" encoding="UTF-8"?>
<Context docBase="/usr/share/pervasync_server-5.0.3/web/pervasync/" path="/pervasync">
<Logger className="org.apache.catalina.logger.FileLogger" prefix="pervasync." suffix=".log" timestamp="true"/>
</Context>
`
8. Log on to Pervasync web admin console

http://default-environment-ddffdffd.elasticbeanstalk.com/pervasync
If not working, check Tomcat log:

vi /usr/share/tomcat7/logs/catalina.out
Check Pervasync log:

vi /usr/share/pervasync_server-5.0.3/log/pervasync_server_mssql.log



Edited 1 time(s). Last edit at 05/20/2013 01:39AM by Alice Qiao.

Options: ReplyQuote


Subject
Views
Written By
Posted
Synchronizing mobile databases with MySQL in Amazon cloud (AWS EC2 & RDS)
5239
May 20, 2013 01:30AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.