Archived

If you are looking for the last documentation in the 4.x series, see 4.7.5. Looking for another version? See all documentation.

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 12 Next »

By default, Fedora comes configured to write binary resources (i.e. files) to the file system and RDF resources (i.e. objects) to a LevelDB database. It is often desirable to replace the LevelDB database with a different object store. As of 2016-03-04, the configuration for MySQL or PostgreSQL databases are available within the deployable Fedora war file.  Below are the steps to use MySQL or PostgreSQL instead of LevelDB.

Performance Note: For ModeShape configured to use Infinispan, it may be desirable to index the 'version' column of the 'ispn_entry_FedoraRepository' table.  See discussion at https://groups.google.com/d/topic/fedora-tech/dnyGQvatIfU/discussion and Infinispan issue https://issues.jboss.org/browse/ISPN-6710.

 

MySQL

  1. Install an instance of MySQL and create a database user account
  2. Run Fedora with the following JAVA_OPTS:

    JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-mysql/repository.json"
    JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.mysql.username=<username>"
    JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.mysql.password=<password>"
    JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.mysql.host=<default=localhost>"
    JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.mysql.port=<default=3306>"

Note, the database and table used by ISPN are auto-created.

PostgreSQL

  1. Install PostgreSQL and create a database called ispn and a user account that can access it
  2. Run Fedora with the following JAVA_OPTS:
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.modeshape.configuration=classpath:/config/jdbc-postgresql/repository.json"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.postgresql.username=<username>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.postgresql.password=<password>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.postgresql.host=<default=localhost>"
JAVA_OPTS="${JAVA_OPTS} -Dfcrepo.ispn.postgresql.port=<default=5432>"

Note, the ispn database must be manually created, but the tables will be automatically created.

 

JNDI Configuration

For both of the configurations above, you may alternatively use JNDI to connect to the MySQL or PostgreSQL databases.

This was accomplished for MySQL with Tomcat 7.0.54 on RHEL 7.2 as follows:  (Note: Fedora web app is deployed as 'fcrepo'.  Database username and password masked.)

  • Define the JNDI resource

          /usr/share/tomcat/conf/Catalina/locahost/fcrepo.xml

 

<Context path="/fcrepo">
  <Resource name="jdbc/ispn" auth="Container" type="javax.sql.DataSource"
      username="***********" password="*************" driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://127.0.0.1:3306/ispn?createDatabaseIfNotExist=true"
      factory="org.apache.commons.dbcp.BasicDataSourceFactory" /> 
</Context>
  • Modify Infinispan configuration

                 In inifinispan.xml :

    • Comment out <jdbc:connection-pool /> element.

    • Uncomment <jdbc:data-source /> element and set it as follows (to match the JNDI resource defined above):

<jdbc:data-source jndi-url="java:comp/env/jdbc/ispn"/>

Modeshape 5.x

Databases tested with the experimental Modeshape 5.0 branch:

  • MySQL 5.5.49
  • PostgreSQL 9.4 - 9.5

Database Setup

PostgreSQL

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

$ sudo -u postgres psql
> create database fcrepo;
> create user user1;
> alter user user1 password 'xyz';
> grant all privileges on database fcrepo to user1;
> \q
  • No labels