Previous Topic: N-tier Application with Multi-node Master-Master Replication (Suitable for Load Balancing)Next Topic: PGSQL64 - PostgreSQL Database Appliance


N-tier Application Running on Different Facilities (Suitable for Load Balancing and Failover)

The following diagram shows a typical usage of the MYSQLR64 appliance in a web application running in more than one facility. With this setup you can have two or more identical applications running in different facilities with the database being replicated to all applications in master-master setup. This is useful in two cases:

Master application

N-tier application running on different facilities (suitable for doing load balancing and failover)

Slave application

Slave application

Appliances in use:

Client request arrive on the user gateway. The gateway forwards the requests to the web_lb load balancer, which directs the request to one of the web servers web1 and web2. The web servers access the master database. The master appliance connects to the remote (slave) application, the only difference being the server_id of slave and the network setup) to replicate the database. The remote application connects to the master appliance through the vpn gateway which is configured to allow connection only from the vpn gateway of the remote application. The master and slave appliances in the two applications are running in master-master setup so they always have identical data.

Example property configuration (properties that are not listed should be left to their default values):

Web access to master and slave is available via admin gateway on port 8080.

master

Property name

Value

Notes

auto_create

1

Create the database if the volumes are empty.

error_log_filename

master-db.error

Name of error log file that is to be stored on the logs data volume.

error_log_level

error

Error logging level

server_id

1

Master server (not mandatory to be 1, should be different from server_id on the slave)

rpl_mode

master

Write binary logs to have replication

master vpn

Property name

Value

Notes

mode

server

Operate as a server.

tunnel

certificates

Using SSL certificates.

tcp_ports

3306,22

Allow ports needed by MYSQLR64.

ip_addr

master_vpn_ip

IP address of the VPN in the master application.

remote_host

slave_vpn_ip

IP address of the VPN in the slave application.

slave

Property name

Value

Notes

auto_create

1

Create the database if the volumes are empty.

error_log_filename

slave-db.error

Name of error log file that is to be stored on the logs data volume.

error_log_level

error

Error logging level

server_id

2

Slave server (not mandatory to be 2, should be different from server_id on the master)

rpl_mode

slave

Connect to master

slave vpn

Property name

Value

Notes

mode

client

Operate as a client.

tunnel

certificates

Using SSL certificates.

auth_path

"client1"

Path to the SSL certificate file.

ip_addr

slave_vpn_ip

IP address of the VPN in the slave application.

remote_host

master_vpn_ip

IP address of the VPN in the master application.

The remote application is an exact copy, the only difference is the network setup of the user, admin, and vpn appliances, connection(s) between the vpn appliance and master=/=slave, and the server_id of the master=/=slave appliance (it should be unique).

Migrating From MYSQLR to MYSQLR64 (and vice versa)

If you need to migrate from MYSQLR to MYSQLR64 (and vice versa), you should not only use the volumes from the 32-bit appliance on a 64-bit one (or vice versa) as this could cause data corruption. The recommended way to do this is by dumping the database on the old appliance, transferring the dumped file to the new appliance, and then import the database into the new appliance.

The same procedure can be used to migrate a database from an older database appliance (MYSQL, MYSQL5, MYSQL64) or a mysql database not running on a CA AppLogic® appliance.

To migrate the database:

Notes

Be aware of the following:

Important! When creating users for the database, verify all users are created with no restrictions on the host they connect from. For example:

mysql> GRANT ALL PRIVILEGES ON *.* TO 'monty'@'%'
    ->     IDENTIFIED BY 'some_pass' WITH GRANT OPTION;

MYSQLR Troubleshooting

MYSQLR Appliance Freezes Upon Restart

Starting with MYSQLR 1.6.2, you can set/change a password for the root database account. However, the MSYQLR appliance has a few root accounts with different hostnames. When setting/changing a password, you should always use the root@% account. The root@% account is the account that appliances connected to the in terminal of MYSQLR will authenticate against. The other root accounts are used only from local users and a password should never be set for them as doing so will cause the MYSQLR appliance to fail to start.

Note: If you leave the root@localhost account without a password, it is not a security issue because this account can only be used by local users on the appliance and anyone who has access to the appliance can change the password.

Recover a MYSQLR appliance that fails to start after changing the root database password

To recover an appliance that fails to start due to changing the database root password, perform the following steps:

  1. Start the appliance or application in debug mode.
    Appliance Start Command
    comp start main.MYSQLR --debug 
    
    Application Start Command
    app start --debug 
    

    You should be able to login to the appliance a few seconds after you start the appliance. It is not necessary to wait for the appliance to time out.

  2. Login over SSH to the appliance and perform the following commands:
    mysql -p -e "update mysql.user set Password='' where User='root'" 
    mysqladmin -p flush-privileges 
    mysql -e 'update mysql.user set password=PASSWORD("NEWPASSWORD") where User="root" and Host="%"' 
    mysqladmin flush-privileges
    
  3. Restart the appliance to verify that it boots, and that mysql connections on the 'in' terminal for user root require a password.