Using the latest version?
JFrog Platform User Guide


Skip to end of metadata
Go to start of metadata

Overview

By using MySQL you can benefit from features in the MySQL infrastructure such as backup and restore.

For Artifactory to run with MySQL you must create a dedicated MySQL database instance and then configure Artifactory to use it as described in the following sections.

Before You Continue

Before proceeding with the steps below, please make sure you have read and followed the steps described inConfiguring the Database.

Page Contents



Creating the Artifactory MySQL Database

Supported MySQL Versions

Artifactory supports MySQL v5.5, 5.6 and 5.7 withInnoDBengine which is the default provided.

Artifactory provides a script that will execute the SQL commands you need to create your MySQL database.

The script can be found in$ARTIFACTORY_HOME/misc/db/createdb/createdb_mysql.sqland is displayed below.

You should review the script and modify it as needed to correspond to your specific environment.

createdb.sql Script
创建数据库artdb字符集utf8核对tf8_bin; GRANT ALL on artdb.* TO 'artifactory'@'localhost' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;

Once you have verified that the script is correct, you need to run it to create the database and proceed with configuring the database.

Artifactory privileges

If you are running MySQL database on a Docker container please use the following:
创建数据库artdb字符集utf8核对tf8_bin; GRANT ALL on artdb.* TO 'artifactory'@'%' IDENTIFIED BY 'password'; FLUSH PRIVILEGES;

(Note: If artifactory is failing to restart with the following error then run the above commands again in MySQL in Docker.

java.sql.SQLException: null, message from server: "Host 'xxxx' is not allowed to connect to this MySQL server")

Selecting a Case-Sensitive Collation

While MySQL Database Server is not case-sensitive by default, it is important to select a case-sensitive collation because Artifactory is case-sensitive.

For example, in thecreatedb.sqlscript above COLLATE is set to "utf8_bin".

Artifactory privileges

We recommend providing Artifactory with full privileges on the database


Configuring Artifactory to use MySQL

  1. Copy$ARTIFACTORY_HOME/misc/db/mysql.propertiesto$ARTIFACTORY_HOME/etc/db.properties
    (If you do not have this file you can take it from thestandalone zip distribution). For a full explanation on the contents of this file please refer toThe Bundled Storage Configurations.


  2. Adjust the connection definitions in the$ARTIFACTORY_HOME/etc/db.propertiesfile to match the attributes of the Artifactory database you created.
    You must configure the database URL and username/password to use. The schema and tables are created first time Artifactory is run using the new database.
  3. Download the MySQL JDBC driver (available from theMySQL website) and copy themysql-connector-java-.jarfile into the server's shared lib directory.
    For example$TOMCAT_HOME/libwhen installed as a service or$ARTIFACTORY_HOME/tomcat/libin the standalone version.

    Permissions

    Make sure your driver has the same permissions as the rest of the files in the shared lib directory.

  4. Start Artifactory.


Storing BLOBs inside MySQL

The suggested (and recommended) configuration stores all artifact information in MySQL while the artifact binary data is stored on the file system (under$ARTIFACTORY_HOME/data/filestore).
While it isnot recommended, it is possible to store BLOBs inside MySQL provided that the typical BLOB size is relatively small. Storing large BLOBs in MySQL can cause memory issues because MySQL buffers BLOBs rather than streaming them (please refer toMySQL Bug #15089) and may result inOutOfMemoryerrors with large binaries depending on your JVM heap size.

blob存储在MySQL中,您将需要configure the Filestore with theFull-DB Binary Providerand changemax_allowed_packetto be higher than the maximum artifact size you intend to store in Artifactory.






Increasing MySQL Default Packet Size

Since some data files (builds, configurations etc.) are stored in MySQL, it is extremely important to increase the maximum allowed packet size used by MySQL to avoid errors related to large packets.

(Please refer to MySQL documentation:Packet Too Large).

It is recommended to change this in the/etc/my.cnffile as follows:

Modifying /etc/my.cnf
# The MySQL server [mysqld] . # The maximum size of the binary payload the server can handle max_allowed_packet=8M .

/etc/my.cnf Absolute Path

If/etc/my.cnfdoes not already exist it should be created under the absolute path and not under$ARTIFACTORY_HOME

Restart required

After modifying the maximum allowed packed size you need to restart MySQL

You can also use the command line

You can also change themax_allowed_packetvariable on the MySQL command line as in the following example:

SET GLOBALmax_allowed_packet = 134217728;

Note, however, that upon a restart, the value ofthemax_allowed_packetvariable will be read from the/etc/my.cnffile and revert to the value in that file as described above.



Tuning MySQL for Artifactory

When using Artifactory with MySQL it is recommended to use the InnoDB engine with the following tuning parameters configured in the/etc/my.cnffile:

Tuning Parameters for MySQL
# The MySQL server [mysqld] . # By default innodb engine use one file for all databases and tables. We recommend changing this to one file per table. # NOTE: This will take effect only if Artifactory tables are not created yet! Need to be set and MySQL restarted before starting Artifactory for the first time. innodb_file_per_table # Theses are tuning parameters that can be set to control and increase the memory buffer sizes. innodb_buffer_pool_size=1536M tmp_table_size=512M max_heap_table_size=512M # Theses control the innodb log files size and can be changed only when MySQL is down and MySQL will not start if there are some innodb log files left in the datadir. # So, changing theses means removing the old innodb log files before start. innodb_log_file_size=256M innodb_log_buffer_size=4M .

Restart required

After tuning, you need to restart MySQL

  • No labels