Installing and Configuring MySQL as StoreGrid Backend Database on Linux
Overview
StoreGrid now supports MySQL as a backend database to store all the clients' backup metadata information. Unlike StoreGrid using SQLite embedded database as its backend database, the MySQL database Server is external to the StoreGrid backup server application. Using a client-server database as the backend database rather than an embedded database would provide better scalability and performance. It also enables third party applications to directly query StoreGrid's metadata for integration with those applications. To get StoreGrid to work with MySQL as a backend database, you need to install MySQL Server either in the same machine where StoreGrid backup server is installed or in another dedicated machine where you wish to store the StoreGrid's metadata information
Note : The following steps are also applicable for StoreGrid Replication Server using the MySQL database as a backend database.
Install MySQL Server
Install MySQL Server 5.1.30 in the machine where you want to store the StoreGrid Backup Server's metadata.
- Download the MySQL server (mysql-5.1.30.tar.gz) file from the URL http://downloads.mysql.com/archives.php?p=mysql-5.1&v=5.1.34
- Extract the tar file by executing 'tar -xzvf mysql-5.1.30.tar.gz'
- Go the extracted folder by executing 'cd mysql-5.1.30'
- Execute './configure --enable-thread-safe-client --enable-gui=no --with-plugins=max --with-gnu-ld' (Assuming you have all the appropriate stuff like gcc, g++, make, etc.,)
- Execute 'make'
- Execute 'make install' as root user. By default, this will install MySQL in /usr/local.
NOTE: StoreGrid's metadata stored in the MySQL databases could use up certain amount of space. To give a rough estimation of the usage, if the backup server stores 1 million backed up files, then the MySQL DB could be of size 1.5 GB. For this disk size estimation, each version file is also considered as a separate file. Therefore, for example, if a client is backing up 1 million files and for each file there are 3 versions stored in the backup server then there will be 3 million backed up files for that client machine. For these 3 million backed up files, the MySQL DB size could be about 4.5 GB. Please make sure that you have enough space in this location for all future backups from all the client machines.
- Copy the MySQL configuration file by executing 'cp support-files/my-medium.cnf /etc/my.cnf' as root user.
- Open the '/etc/my.cnf' file and edit the settings as follows :
[mysqld]
socket=/tmp/mysql.sock
user=root
default-storage_engine=innodb
max_connections=800
slow_query_log = 1
innodb_log_file_size = 512M
innodb_flush_method=O_DIRECT
wait_timeout=604800
Comment out the lines 'log-bin=mysql-bin' and 'binlog_format=mixed' in '/etc/my.cnf' file as shown below to disable MySQL binary log files.
#log-bin=mysql-bin
#binlog_format=mixed
- Execute 'mysql_install_db' to install and set up the system tables.
- Copy the MySQL daemon script file by executing the command 'cp support-files/mysql.server /etc/init.d/mysql' as root user.
- Change mode for the daemon file by executing the command 'chmod 755 /etc/init.d/mysql' as root user.
- Add the MySQL daemon by executing the command '/sbin/chkconfig --add mysql' as root.
- Start MySQL Server by executing '/etc/init.d/mysql start'.
- Set the root password for MySQL Server by executing 'mysqladmin -u root password [mysql_root_password]' where [mysql_root_password] is the password for the MySQL root user.
Install MySQL Client
StoreGrid Backup server uses the MySQL client program to connect to the MySQL Server. Hence, you need to install the MySQL 5.1.30 client in the backup server.
Note: If you have installed the MySQL Server in your StoreGrid backup server machine itself, then please ignore this step.
For backup/replication server running in 32 bit machine :
- Extract the MySQL installer file by executing 'tar -xzvf mysql-5.1.30.tar.gz'
- Go to the extracted folder by executing 'cd mysql-5.1.30'
- Execute the command './configure --enable-thread-safe-client --enable-gui=no --without-server --with-plugins=max --with-gnu-ld'
- Execute 'make'
- Execute 'make install' as root user
For backup/replication server running in 64 bit machine :
- Login as root user and execute yum install mysql.i386
- This will install 32 bit MySQL client in your 64 bit machine.
Install UnixODBC
Install the unixODBC v2.2.14 in the backup server
For backup/replication server running in 32 bit machine :
- Download the unixODBC installer file (unixODBC-2.2.14.tar.gz) from the URL : http://www.unixodbc.org/
- Extract the installer file by executing 'tar -zxvf unixODBC-2.2.14.tar.gz'
- Go the extracted folder by executing 'cd unixODBC-2.2.14'
- Execute './configure --enable-gui=no --enable-threads=yes'
- Execute 'make'
- Execute 'make install' as a root user
For backup/replication server running in 64 bit machine :
- For Redhat flavours: RHEL, SUSE, CentOS and Fedora 64bit machines - Login as root user and execute yum install unixODBC.i386
NOTE: If unixOBDC was installed through a binary package ('yum'), the odbc information files odbcinst.ini and odbc.ini will be located in '/etc/' but StoreGrid requires the ini files to be in '/usr/local/etc'. Therefore please create a symbolic links for these two files by executing below shown commands as a root user.
/bin/ln -s /etc/odbcinst.ini /usr/local/etc/odbcinst.ini
/bin/ln -s /etc/odbc.ini /usr/local/etc/odbc.ini
- For Debian flavours: Debian or Ubuntu 64bit machines. Download unixODBC 32bit debian package: unixodbc_2.2.12-94.1_i386.deb
Login as root user and execute dpkg --install --force-architecture unixodbc_2.2.12-94.1_i386.deb
NOTE: If unixOBDC was installed through a binary package ('dpkg'), the odbc information files odbcinst.ini and odbc.ini will be located in '/etc/unixODBC/' but StoreGrid requires the ini files to be in '/usr/local/etc'. Therefore please create a symbolic links for these two files by executing below shown commands as a root user.
/bin/ln -s /etc/unixODBC/odbcinst.ini /usr/local/etc/odbcinst.ini
/bin/ln -s /etc/unixODBC/odbc.ini /usr/local/etc/odbc.ini
- This will install 32 bit unixODBC library in your 64 bit machine under /usr/lib/libodbc.so.
Install MySQL Connector
Install the MySQL Connector v3.51.27 in the backup server
- Download the MySQL Connector file (mysql-connector-odbc-3.51.27-linux-x86-32bit.tar.gz) from the URL : http://dev.mysql.com/downloads/connector/odbc/3.51.html
- Extract the installer file by executing 'tar -zxvf mysql-connector-odbc-3.51.27-linux-x86-32bit.tar.gz'
- Go the extracted folder by executing 'cd mysql-connector-odbc-3.51.27-linux-x86-32bit'
- Copy the exacted connector binary files by executing 'cp -f lib/* /usr/local/lib/.'
- This will create the MySQL Connector file '/usr/local/lib/libmyodbc3S-3.51.27.so'.
Configure the MySQL Connector
Configure the MySQL Connector in the backup server as follows :
- Execute the command 'odbcinst -j'
- Note the path of the 'odbcinst.ini' file for DRIVERS. By default, it is '/usr/local/etc/odbcinst.ini'
- Login as root and open the file 'odbcinst.ini'
- Append the following content to the file.
[ODBC]
Trace = No
Trace File = /tmp/sql.log
Pooling = Yes
[MySQL]
Description =
Driver = /usr/local/lib/libmyodbc3-3.51.27.so
Driver64 =
Setup = /usr/local/lib/libmyodbc3S-3.51.27.so
Setup64 =
UsageCount =1
CPTimeout =300
CPReuse =1
Threading =0
Note : If the ODBC Driver [ODBC] is already added in the file, please enable connection pooling by adding 'Pooling=Yes'.
Create StoreGrid database
Create a separate database for StoreGrid in the MySQL server.
- Login to the machine where MySQL Server is running.
- Execute the command 'mysql -u root -p' and enter the password.
- Create the StoreGrid database by executing 'create database [database name] collate latin1_general_cs;' where [database name] is the name of the database.
Note : Make sure the database name does not exceed 30 characters.
Create System DSN
Create a system DSN in the backup server to access the StoreGrid database in the MySQL Server.
- Execute the command 'odbcinst -j'
- Note the path for 'odbc.ini' file for SYSTEM DATA SOURCES.
- Login as root and open the file 'odbc.ini' (By default, file is will be '/usr/local/etc/odbc.ini').
- Append the following content to the file
[sgserver]
Driver = MySQL
DATABASE = StoreGridDB
PWD = password123
SERVER = lintest
UID = root
In the above example file, a DSN with the name 'sgserver' is created for the database 'StoreGridDB' in the MySQL server running in 'lintest' machine with the user name as 'root' and password as 'password123'.
Test connectivity with MySQL Server
After creating the MySQL driver and DSN in the backup server, check the connectivity from backup server to the MySQL Server
Execute the following command 'isql -v [dsn name] [user name] [password]' and check if you are able to connect the MySQL Server from the backup server.
Specify the attributes during StoreGrid installation
After creating the DSN in the backup server, you need to specify DSN name, database name, user name and password during the StoreGrid installation in the backup server.
Troubleshooting Tips
|