Running Artifactory on MySQL

Skip to end of metadata
Go to start of metadata
Table of Contents

Overview

The instructions below describes how to set up Artifactory on MySQL.
By using MySQL (over the built-in Derby DB) you can leverage exiting MySQL infrastructure and use the MySQL backup, restore and high-availability features. The setup involves creating the dedicated MySQL database instance and then configuring Artifactory to use that instance.

Please make sure to read the general section about changing the default storage before configuring MySQL.

Create the Artifactory MySQL Database

Please use MySQL 5.0.3 and above. Older versions of MySQL will not work with Artifactory.

You can use the $ARTIFACTORY_HOME/misc/mysql/createdb.sql SQL script to execute the SQL commands below to create a database. Please review and edit this script before executing it, according to your environment.

Increasing MySQL's Default Packet Size

Since binaries are stored in MySQL, it is extremely important to increase the default packet size used by MySQL (see: max_allowed_packet increase, for reference).
We recommend changing this in the /etc/my.cnf file. Create this file if it does not already exist (under the absolute path, not under $ARTIFACTORY_HOME):

Configure Artifactory to Use the MySQL Database

  1. Add (or uncomment) the following line in $ARTIFACTORY_HOME/etc/artifactory.system.properties:
    Note: this path is relative to $ARTIFACTORY_HOME/etc.
  2. Adjust the connection definitions in the file $ARTIFACTORY_HOME/etc/repo/filesystem-mysql/repo.xml to match the attributes of the Artifactory database you created (if you don't have this file you can grab it from the standalone zip distribution or directly from here.).
    Jackrabbit uses 3 separate connection configurations for each of the following:
    1. The basic JCR repository metadata (configured under FileSystem tag) - minimal load and no connection pooling.
    2. The JCR datastore for all the binaries (configured under DataStore tag) - heavy load and uses connection pooling.
    3. The JCR workspace metadata (configured under PersistenceManager tag) - minimal load and no connection pooling.
      For each one of these tags you need to configure the database parameters and username/password to use. The schema and tables will be created on first run of Artifactory against the database.
  3. Download the MySQL JDBC driver and copy the mysql-connector-java-x.x.x.jar jar file into the server's shared lib directory ($ARTIFACTORY_HOME/lib in the standalone version), $TOMCAT_HOME/lib etc.
  4. Start Artifactory.
General advice against storing artifacts as BLOBs inside MySQL

The suggested configuration keeps all artifacts information in MySQL while storing the artifact binary data on the file system (under $ARTIFACTORY_HOME/data/store). This is the recommended setup.
It is possible, but not recommended, to store BLOBs inside MySQL, provided that typical BLOB size is relatively small. This is important because MySQL buffers BLOBs instead of streaming them (this behavior is unrelated to Artifactory - http://bugs.mysql.com/bug.php?id=15089). Therefore, using large BLOBs may result in out-of-memory errors with large binaries, depending on your JVM heap size.
If you wish to store BLOBs inside MySQL, please use repo/mysql instead of repo/filesystem-mysql, and change the max_allowed_packet above to the maximum artifact size you are planing to store in Artifactory, for example 128M.

Labels:
  1. May 25, 2012

    In step 2 of the "Configure Artifactory to Use the MySQL Database" section, there is a broken link "here" which provides $ARTIFACTORY_HOME/etc/repo/filesystem-mysql/repo.xml. The correct link (at this time) is: http://subversion.jfrog.org/artifactory/public/trunk/distribution/standalone/src/main/install/etc/repo/filesystem-mysql/repo.xml