Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For quickly spinning up Fedora in a testing / experimental context, a default H2 database is available by default.

Expand
titleClick here for instructions to connect to H2...


Info

You can connect to the H2 database by:

  1. Downloading a copy of h2 (needs to match the version used by the version of fedora that you're using, which is 2.1.210 for the latest release): https://mvnrepository.com/artifact/com.h2database/h2/2.1.210
  2. Launch the h2 web console (this should open a webpage in your browser):

    Code Block
    java -jar h2-2.1.210.jar


  3. Open the db by specifying the jdbc url, for example jdbc:h2:/home/jdoe/Downloads/fcrepo/fcrepo-home/data/fcrepo-h2 .
    When you start fedora, there should be a log line like 

    Code Block
    INFO 15:48:22.039 [main] (DatabaseConfig) JDBC URL: jdbc:h2:/Users/psmith/www/fcrepo/ocfl_temp/data/fcrepo-h2;FILE_LOCK=SOCKET

    Copy the value from there.

  4. Remove the default user name
  5. Click "connect"

Note, you can't have fedora running when you connect to the db.


However, for production installations, it is recommended to use a MariaDB,  MySQL or PostgreSQL database.

Note

Fedora currently supports the following versions:

  • PostgresQL 12.3
  • MariaDB 10.5.3
  • MySQL 8.0

Below are the steps to use MySQL, MariaDB or PostgreSQL, as well as Docker instructions if you choose to run your database in a Docker container.

Info

For the full list of database properties, please refer to the Database section of the Properties documentation.

You can find additional information on this wiki about how Fedora rebuilds these caches and the structure of the tables in the database.


Table of Contents

Native Database Setup

...

Code Block
$ mysql -u root -p
> createCREATE databaseDATABASE fcrepo CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
> createCREATE userUSER 'user1'@'localhost' IDENTIFIED BY 'xyz';
> GRANT ALL PRIVILEGES ON fcrepo.* to 'user1'@'localhost';
> \q


Note

MySQL and MariaDB use case insensitive collations by default, but resources in Fedora are case sensitive. If you decide to create your database using a case insensitive collation, then Fedora will not be able to handle case appropriately, leading to undefined behavior.

PostgreSQL

To create a new database and user in PostgreSQL, assuming a username of user1 and a password of xyz:

Code Block
$ sudo -u postgres psql
> createCREATE databaseDATABASE fcrepo;
> createCREATE userUSER user1;
> alterALTER userUSER user1 passwordPASSWORD 'xyz';
> grantGRANT allALL privilegesPRIVILEGES onON databaseDATABASE fcrepo toTO user1;
> \q


Docker-based Database Setup

...