Switching to MySQL (Linux only)
You can optionally configure HQueue to use MySQL instead of SQLite on Linux.
On this page
Overview
Required packages
Setting up MySQL
Overview
By default, HQueue uses SQLite as a backend database. If the HQueue server is on Linux, you can configure it to use MySQL instead.
You may want to do this if you already have a MySQL server infrastructure that’s centrally managed, backed-up, and so on.
The following procedure does not migrate the contents of the default database over to MySQL. You will need to re-add clients, groups, and jobs after switching to MySQL.
Required packages
You must install the following Linux packages on the server machine, for example using aptitude
or yum
(depending on the Linux distribution):
-
mysql-client
-
mysql-server
-
python-mysqldb
The packages may be named differently depending on your Linux distribution.
Setting up MySQL
- Create the
hqserver
database.Start amysql
session and run:You can also create an hquser user account which has access to the database. In your mysql session, enter the following commands:
- Edit the HQueue configuration file.Open
/opt/hqueue/hqserver.ini
and look for the line with thesqlalchemy.default.url
configuration value. Replace it with:If you created the hquser account, then this would be:
Additionaly, uncomment the lines with the
sqlalchemy.default.pool_size
andsqlalchemy.default.max_overflow
configuration values. - Shutdown the HQueue server.In a terminal run:
- Find out where Python MySQLdb is installed.In a terminal run
python
and then in Python type:You will need to remember where the MySQLdb module is installed for later use. With the example above, the install location would be
/usr/local/lib/python2.7/dist-packages/MySQL_python-1.2.5-py2.7-linux-x86_64.egg
. - Modify the HQueue paster script so it can find Python MySQLdb.Open
/opt/hqueue/bin/paster
in a text editor. Then insert this line after the line that readsimport sys
:Save and close the file.
- Setup the
hqserver
database.In a terminal, run: - Restart the HQueue server.In a terminal, run:
Now your HQueue server is configured to use a MySQL database.