All of Fedora's persistent content and metadata are stored on disk in an OCFL storage root. For performance reasons, Fedora maintains a cache of system and user metadata in a rebuildable database.
For quickly spinning up Fedora in a testing / experimental context, a default H2 database is available by default.
Expand | ||||||
---|---|---|---|---|---|---|
| ||||||
|
However, for production installations, it is recommended to use a MariaDB, MySQL or PostgreSQL database.
Note |
---|
Fedora currently supports the following versions:
|
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 |
---|
fcrepo.db.url=jdbc:mariadb://localhost:3306/fcrepo fcrepo.db.user=<username> fcrepo.db.pwpassword=<password> |
Note, the fcrepo
database must be manually created, but the tables will be automatically created.
...
Code Block |
---|
fcrepo.db.url=jdbc:postgresql://localhost:5432/fcrepo fcrepo.db.user=<username> fcrepo.db.pwpassword=<password> |
Note, the fcrepo
database must be manually created, but the tables will be automatically created.
...
Code Block |
---|
fcrepo.db.url=jdbc:mysql://localhost:3306/fcrepo fcrepo.db.user=<username> fcrepo.db.pwpassword=<password> |
Note, the fcrepo
database must be manually created, but the tables will be automatically created.
...
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
...
No Format |
---|
docker run --name f6-mariadb -e MYSQL_ROOT_PASSWORD=root-pw -e MYSQL_DATABASE=fcrepo -e MYSQL_USER=fcrepo-user -e MYSQL_PASSWORD=fcrepo-pw -p 3306:3306 -d mariadb:10.5.3 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
..when done with the database:
docker stop f6-mariadb
docker rm f6-mariadb |
...
In order for Fedora to connect with a database configured as above, the Fedora should be started with the following system properties:
No Format |
---|
-Dfcrepofcrepo.db.url=jdbc:mariadb://localhost:3306/fcrepo -Dfcrepofcrepo.db.user=fcrepo-user -Dfcrepofcrepo.db.password=fcrepo-pw |
PostgreSQL
...
In order for Fedora to connect with a database configured as above, the Fedora should be started with the following system properties:
No Format |
---|
-Dfcrepofcrepo.db.url=jdbc:postgresql://localhost:5432/fcrepo -Dfcrepofcrepo.db.user=fcrepo-user -Dfcrepofcrepo.db.password=fcrepo-pw |
MySQL
...
No Format |
---|
docker run --name f6-mysql -e MYSQL_ROOT_PASSWORD=root-pw -e MYSQL_DATABASE=fcrepo -e MYSQL_USER=fcrepo-user -e MYSQL_PASSWORD=fcrepo-pw -p 3306:3306 -d mysql:8.0 --character-set-server=utf8mb4 --collation-server=utf8mb4_bin
..when done with the database:
docker stop f6-mysql
docker rm f6-mysql |
...
In order for Fedora to connect with a database configured as above, the Fedora should be started with the following system properties:
No Format |
---|
-Dfcrepofcrepo.db.url=jdbc:mysql://localhost:3306/fcrepo -Dfcrepofcrepo.db.user=fcrepo-user -Dfcrepofcrepo.db.password=fcrepo-pw |