How to configure an external MySQL database for Shares on Windows

Description

After installing Shares on your Windows system, you can choose to use a MySQL database on a remote system rather than the default local MySQL database.

Ensure you have the MySQL credentials, port and the hostname/IP address of the remote machine.

Instructions

1. Dump the Shares and stats collector databases.

You can do this with the following commands:

# mysqldump -u username -p web_production > sharesdb.sql
# mysqldump -u username -p stats_collector > statscollectordb.sql

2. Move the MySQL dumps to your remote system and import them into that MySQL.

First log in to the MySQL command-line client and create the two needed databases if they do not exist:

mysql> create database web_production;
mysql> create database stats_collector;

Exit the MySQL client then import the dumps. You can do this with commands like the following:

# mysql -u username -p web_production < sharesdb.sql
# mysql -u username -p stats_collector < statscollectordb.sql

3. Back on the system with Shares, update the Shares application configuration file, which can be found at the following:

C:\Shares\www\config\database.yml

Add in the remote_host, remote_username, remote_password and port for your remote MySQL in the production and production_stats_collector sections:

production:
database: web_production   
username: "remote_user"   
password: "remote_password"   
host: remote_host   
port: remote_port   
encoding: utf8   
reconnect: false   
pool: 5                

production_stats_collector:   
database: stats_collector   
username: "remote_user"   
password: "remote_password"
host: remote_host   
port: remote_port
encoding: utf8   
reconnect: false   
pool: 5

4. Update the stats collector configuration file, which can be found at the following:

C:\Shares\statscollector\etc\persistence.xml

Add in the remote_host, remote_username and remote_password for the remote MySQL server under connection URL as in the following:

<!-- connection URL: jdbc:mysql://HOST:PORT/DATABASE -->    
<property name="hibernate.connection.url" value="jdbc:mysql://remote_host/stats_collector"/>   
<property name="hibernate.connection.username" value="remote_user"/>   
<property name="hibernate.connection.password" value="remote_password"/>

5. Restart Shares services.

Navigate to Control Panel > System and Security > Administrative Tools > Services.

Right click the following services and select Restart:

  • Aspera Nginx Service
  • Aspera Delayed Job Service
  • Aspera Web Services
  • Aspera Stats Collector

6. Additional step for multiple Shares instances
If you are running multiple Shares web servers connected to the same MySQL database, you must ensure that certain files are the same on every machine.

The following files must be the same on each machine running a Shares web server:

C:\Shares\statscollector\etc\keystore.jks
C:\Shares\statscollector\etc\persistence.xml
C:\Shares\www\config\aspera\secret.rb
C:\Shares\www\config\database.yml
C:\Shares\www\config\initializers\secret_token.rb

 

Have more questions? Submit a request

0 Comments

Article is closed for comments.
Powered by Zendesk