NOTE: Aspera Console must be disabled in order to migrate your Aspera Shares database to RDS.
An Aspera Shares On Demand (SHOD) instance runs its MySQL database on localhost. However, you can run the MySQL database on a remote host such as an RDS instance. This article provides instructions on how to migrate your current Shares databases to an AWS RDS instance.
This article assumes the following:
- You have purchased and booted up Aspera Shares On Demand v.3.5.4 or higher.
- You can SSH as root to your Aspera On Demand Instance.
- You have user permissions to create RDS instances and security groups.
- You are familiar with creating RDS instances.
1) Create RDS instance
Make sure that security group(s) are setup to allow your SHOD instance to connect to your RDS instance. Please note the following:
- The default port for MySQL in RDS is set to TCP/3306 (you will need this later).
- You need to create a security group such that your Shares server can access the RDS instance
2) Use mysqldump to create backups of the shares and stats_collector databases
SSH into your SHOD instance and perform the following:
# /opt/aspera/shares/bin/run mysqldump shares > shares.sql
# /opt/aspera/shares/bin/run mysqldump stats_collector > stats_collector.sql
3) Migrate Shares databases to RDS
Access your RDS database from your SHOD instance and create the shares and stats_collector databases:
# /opt/aspera/common/mysql/bin/mysql -h [RDS Endpoint] -P [port number] -u [user] -p[password]
# mysql> create database shares;
# mysql> create database stats_collector;
From your SHOD instance migrate your shares and stats_collector databases into your RDS instance:
# /opt/aspera/common/mysql/bin/mysql -h [RDS Endpoint] -P [port number] -u [user] -p[password] shares < /full/path/to/shares.sql
# /opt/aspera/common/mysql/bin/mysql -h [RDS Endpoint] -P [port number] -u [user] -p[password] stats_collector < /full/path/to/stats_collector.sql
# /opt/aspera/common/mysql/bin/mysql -h 184.108.40.206 -P 3306 -u root -ptopsecret shares < /tmp/shares.sql
# /opt/aspera/common/mysql/bin/mysql -h 220.127.116.11 -P 3306 -u root -ptopsecret stats_collector < /tmp/stats_collector.sql
Ensure that databases have successfully migrated into RDS:
# /opt/aspera/common/mysql/bin/mysql -h 18.104.22.168 -P 3306 -u root -ptopsecret
mysql> show databases;
mysql> select * from stats_collector.fasp_transfers;
mysql> select * from shares.nodes;
4) Stop shares service, disable Aspera Console, and disable MySQL
NOTE: This will completely disable Aspera Console
# service aspera-shares stop
# asctl console:disable
# asctl mysql:disable
5) Configure Shares to use your RDS database
Edit the following files to reflect the information of your RDS instance
a) Update user, password, host, and port in the following three files:
b) Update the Shares application config file located at /opt/aspera/shares/u/shares/config/database.yml:
Replace the bolded example variables with your RDS instance's information. production: database: shares username: "root" password: "topsecret" host: "22.214.171.124" port: 3306 encoding: utf8 reconnect: false pool: 5 production_stats_collector: database: stats_collector username: "root" password: "topsecret" host: "126.96.36.199" port: 3306 encoding: utf8 reconnect: false pool: 5
c) Update the stats collector configuration file located at /opt/aspera/shares/u/stats-collector/etc/persistence.xml
Replace the bolded example variables with your RDS instance's information. <!-- connection URL: jdbc:mysql://HOST:PORT/DATABASE --> <property name="hibernate.connection.url" value="jdbc:mysql://188.8.131.52:3306/stats_collector"/> <property name="hibernate.connection.username" value="root"/> <property name="hibernate.connection.password" value="topsecret"/>
7) Delete <database> section of /opt/aspera/etc/aspera.conf:
# Delete this section:
6) Start Shares service
# service aspera-shares start