r9 - 28 Feb 2010 - 20:26:09 - EricTYou are here: Wiki >  AppLogic27 Web > CatDatabaseAppliancesMySQL
ALERT! AppLogic 2.7/2.8 Documentation The latest production release is AppLogic 3.0.30

MYSQL5, MYSQL64: MySQL Database Appliances

mysql.PNG At a Glance
Catalog System
Category Database Appliances
User volumes yes
Min. memory 128 MB
OS Linux
Constraints no
Questions/Comments Ask Forum

Functional Overview

ALERT! MYSQL64 is not available in AppLogic 2.8+; please use MYSQLR64 instead.

MYSQL is a database appliance based on the MySQL database engine (http://www.mysql.org). It provides an easy way to add a database to any application.

MYSQL stores the database on an application-defined volume that can be configured on each MYSQL instance. MYSQL automatically creates an empty database when it starts on an empty volume.

ALERT! See notes on adding database users for the MYSQL appliance.

Name Latest Version OS !MySQL Notes
MYSQL5 1.3.8-1 CentOS 5 5.0.77  
MYSQL64 1.3.5-1 CentOS 5 (64 bit) 5.0.22 This appliance has been deprecated and will be removed in a later version of AppLogic. It is recommended to use MYSQLR64 instead.

Boundary

Resources

Resource Minimum Maximum Default
CPU 0.10 16 0.40
Memory 128 MB 32G 512 MB
Bandwidth 1 Mbps 2 Gbps 250 Mbps

Terminals

Name Dir Protocol Description
in in mysql Receives MySQL database requests
log out cifs Network file system for storing error log. This terminal may be left unconnected if not used.
mon out cce Sends performance and resource usage statistics. This terminal may be left unconnected.

The default interface is enabled. It is intended for diagnostics and troubleshooting (over ssh). Future versions of this appliance may disable ssh access.

User Volumes

Volume Description
data Volume for the database data storage.

The data volume can optionally contain a my.cnf file in its top directory, which includes MYSQL configuration options. See the 'Custom Configuration' section for more details. NEW This feature is available in MYSQL5/64 1.3.3 or later.

ALERT! The data volume must exclusively dedicated to the MYSQL instance (cannot be shared with other appliances).

Properties

Property name Type Description
auto_create Integer Whether to create the database if it doesn't exist. Possible values are 1 to create it and 0 to prevent auto creation (to avoid accidental overwrite in case of corrupted volumes). If set to 0 and a database doesn't exist on the user volume, the appliance starts in maintenance mode (MySQL deamon not started). Default is 1.
error_log_filename String Fully qualified file name for the error log file, relative to the log file system (e.g., /mysql_logs/my.log). If empty, error logging is disabled. Default: (empty).
error_log_level String Error logging level. Possible values are: error logs only errors, warn logs both warnings and errors. This property is not case sensitive. Default: error
timezone String Specifies the time zone used in the appliance. If this property is empty, the timezone is not modified and left as-is. A list of supported time zones is available here. Default: empty

ALERT! As of MYSQL5 1.3.8, the use_old_passwords property is removed. If you need to enable old_passwords, create a custom configuration as described below.

ALERT! The MYSQL appliance will fail to start if the error_log_filename is specified and the log terminal is not connected or the file system cannot be mounted.

Custom Configuration

NEW This feature is available in MYSQLR 1.3.3 or later.

MYSQL5/64 allows the use of a custom MYSQL configuration file which can provide additional configuration options or overwrite existing configuration specified in /etc/my.cnf.

To use a custom configuration, create a file named my.cnf and place it in the top directory of the data volume. The format of the file should follow the MYSQL options file syntax as described here.

For example, the following can be used to tune MYSQL5/64 for better performance when using InnoDB? (the default MYSQL5/64 configuration is optimized for MyISAM). The example is based on using 512M of memory (default for MYSQL5/64).

[mysqld]
# Shrink down MyISAM buffers
key_buffer = 512K
myisam_sort_buffer_size = 512K

# Make InnoDB the default storage engine (optional)
default-storage-engine = INNODB

# Set InnoDB buffer size
innodb_buffer_pool_size=350M
innodb_log_file_size=128M
innodb_log_buffer_size=4M
innodb_thread_concurrency=8

# If you do not have too many tables use this option, so you will not have uncontrolled innodb main tablespace growth which you can’t reclaim.
innodb_file_per_table=1

Custom Counters

The MYSQL appliance reports the following custom counters through the mon terminal.

The following counters belong to the MySql counter group:

Counter name Description
Aborted Clients Number of clients aborted by the server
Aborted Connections Number of connects aborted by the server
Bytes Received Number of received bytes
Bytes Sent Number of sent bytes
Total Connections Number of connections
Questions Total number of questions
Slow Queries Number of slow queries
Threads Created Number of threads created
Threads Connected Number of threads connected
Threads Running Number of threads running
Max Used Connections Number of max connections used
Open Files Number of open files
Admin Commands Number of admin commands
Alter Table Commands Number of alter table commands
Analyze Commands Number of analyze commands
Backup Table Commands Number of backup table commands
Change DB Commands Number of change DB commands
Change Master Commands Number of change master commands
Check Commands Number of check commands
Commit Commands Number of commit commands
Create DB Commands Number of create DB commands
Create Function Commands Number of create function commands
Create Index Commands Number of create index commands
Create Table Commands Number of create table commands
Delete Commands Number of delete commands
Drop DB Commands Number of drop DB commands
Drop Function Commands Number of drop function commands
Drop Index Commands Number of drop index commands
Drop Table Commands Number of drop table commands
Flush Commands Number of flush commands
Grant Commands Number of grant commands
Insert Commands Number of insert commands
Insert Select Commands Number of insert select commands
Kill Commands Number of kill commands
Load Commands Number of load commands
Load Master Table Commands Number of load master table commands
Lock Tables Commands Number of lock tables commands
Optimize Commands Number of optimize commands
Purge Commands Number of purge commands
Rename Table Commands Number of rename table commands
Repair Commands Number of repair commands
Replace Commands Number of replace commands
Replace Select Commands Number of replace select commands
Reset Commands Number of reset commands
Restore Table Commands Number of restore table commands
Revoke Commands Number of revoke commands
Rollback Commands Number of rollback commands
Select Commands Number of select commands
Set Option Commands Number of set option commands
Truncate Commands Number of truncate commands
Unlock Tables Commands Number of unlock tables commands
Update Commands Number of update commands

Error Messages

The following messages may appear in either the appliance log file or the system log of the grid controller when the appliance fails to start:
  • Failed to create database.
  • Failed to start mysql.
  • Insufficent permissions for root@% in the mysql database.

Typical Usage

Simple two-tier application

The following diagram shows a typical usage of the MYSQL appliance in a two-tier web application:

mysql_usage.PNG

Appliances in use:

  • in1 - input gateway
  • web1 - web server
  • db1 - MySQL database appliance
  • logs - NAS appliance for storing log files
  • admin - input gateway for viewing log files

Client request arrive on the in1 gateway. The gateway forwards the requests to the web1 server, which serves the request. When scripts (e.g., Perl or PHP) on web1 need to access persistent data, they use the db1 appliance through the out terminal of the web1 server. The db1 appliance is configured to store its log files within the root directory of the share exposed by logs.

Using a browser, administrators connect to the admin gateway in order to view the mysql log files. The admin gateway forwards the requests to the logs NAS appliance.

Example property configuration:

Property name Value Notes
auto_create 1 Create the database if the volumes are empty.
error_log_filename /my.log Name of error log file that is to be stored on the logs data volume.
error_log_level error Error logging level

ALERT! Note that the data volume must also be configured on the db1 appliance as well as the logs appliance. To create application volumes that can be used here, see the Editor Manage Volumes help topic.

Scalable two-tier application

The following diagram shows a typical usage of the MYSQL appliance in a two-tier web application in which the database is used to share state and data between multiple, load-balanced web servers. In addition, this example has a separate input for maintenance, through which an administrator can log in and access the database for maintenance as well as an input through which an administrator can log in and view the mysql error log.

mysql_usage2.PNG

Appliances in use:

  • usr - input gateway for user requests
  • web_lb - web load-balancer for user requests
  • web1, web2 - web servers with active content (e.g., CGI scripts)
  • db - database
  • logs - storage for database error log files
  • maint - input gateway for maintenance access
  • admin - a generic Linux server used by the administrator
  • gway - a network gateway for administrator's access to the Internet
  • log - input gateway for access to the database error log

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 db database.

The db database writes its error log to the logs appliance through the log terminal. In addition, an administrator can log in through the log gateway to the logs appliance and view the database error log files.

Additionally, an administrator can log in over ssh through the maint gateway to the admin server. From the admin server, the administrator can access the db database for statistics or changing the database schema. The admin server can access the Internet through the gway gateway, for example, to download a newer version of libraries or the database schema.

Example property configuration:

Property name Value Notes
auto_create 1 Create the database if the volumes are empty.
error_log_filename /my.log Name of error log file that is to be stored on the logs data volume.
error_log_level error Error logging level

ALERT! Note that the data volume must also be configured on the db appliance and the data volume must also be configured on the logs appliance.

IDEA! The maint, admin, gway, and log appliances are not required for the operation of the two-tier application. If present, the admin server may have cron jobs for database scrubbing, sending e-mail, etc.

Notes

  • When MYSQL is started, there is a message written to the appliance log file stating that chmod failed to modify the owner for the mysql log file. This is to be expected and does not affect the operation of the MYSQL appliance.

  • ALERT! When creating users for the database, make sure 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;

  • Volume requirements
    • The volume size should be 25MB or more - currently, the InnoDB engine is enabled and it occupies about 22MB on the data volume. In this version, there is no way to disable this, even if you don't use InnoDB for data storage.
    • You can leave the volume empty (just created) if auto_create is set to 1.
    • The volume contains only the database data. The data can be moved by copying all files to a new (e.g., larger) volume.

  • The appliance connected to MYSQL is responsible for creating its own database and tables if they do not exist. Alternatively, you can manually copy the initial database on the data volume.

  • The appliance or server connected to MYSQL's in input should have the MySQL client library in order to access the MySQL server and submit requests. All virtual servers provided in the appliance catalog have the MySQL client library installed, including the generic LINUX server.

Open source and 3rd party software used inside of the appliance

MYSQL5 uses the following 3rd party open source packages in addition to the 3rd party open source packages used by its base class LUX5.

Software Version Modified License Notes
mysql 5.0.77-4 NO GPLv2 N/A
mysql-server 5.0.77-4 NO GPLv2 N/A
perl-DBD-MySQL 3.0007-2 No Artistic N/A
perl-DBI 1.52-1.fc6 No Artistic N/A
samba-client 3.0.28-1 No GPLv2 N/A
samba-common 3.0.28-1 No GPLv2 N/A

To see the full list of open source packages used in this appliance, please see its Implementation Design.

Related Documents

Questions and Comments

IDEA! To post a question or comment on this appliance, visit our forum.

-- PavelGeorgiev - 27 Jan 2010

 
Copyright © CA 2005-2011. All Rights Reserved.
%