UniTime Installation

Prerequisites

Java Development Kit

Apache Tomcat

MySQL

Installation

tar -xvzf unitime-4.6_bld77.tar.gz

mysql -uroot -p -f <schema.sql

mysql -uroot -p <woebegon-data.sql

export JAVA_OPTS="${JAVA_OPTS} -Djava.awt.headless=true"

export JAVA_OPTS="${JAVA_OPTS} -Xmx2048m"

mkdir /var/lib/tomcat8/data

chown tomcat8 /var/lib/tomcat8/data

[Service] ReadWritePaths=/var/lib/tomcat9/data

Upgrade

Customization

export JAVA_OPTS="${JAVA_OPTS} -Dtmtbl.title=Timetabling Demo"

export JAVA_OPTS="${JAVA_OPTS} -Dtmtbl.custom.properties=/etc/default/unitime.properties

tmtbl.custom.properties=${catalina.base}/conf/unitime.properties

# MySQL Configuration Example

connection.url=jdbc:mysql://localhost:3306/timetable?serverTimezone=Europe/Prague

connection.username=timetable

connection.password=unitime

connection.driver_class=com.mysql.jdbc.Driver

dialect=org.hibernate.dialect.MySQLInnoDBDialect

tmtbl.uniqueid.generator=org.hibernate.id.TableHiLoGenerator

default_schema=timetable

Remote Solver Server(s)

curl https://repo1.maven.org/maven2/mysql/mysql-connector-java/5.1.49/mysql-connector-java-5.1.49.jar --output solver/mysql-connector-java.jar

java -Xmx2g -Dtmtbl.custom.properties=custom.properties -jar solver/timetable.jar


jgroups.tcp.address=127.0.0.1

IP address of the machine that is using this configuration file. This property should be different on each machine; the remaining properties are usually the same for all the UniTime instances (Tomcats as well as remote solver servers). If the property is set to 127.0.0.1 or localhost, the server will not be able to accept remote connections -- use only if all the instances are running on the same machine!

unitime.solver.cluster=true

This property enables the Solver cluster. This cluster is used for RPCs between the Tomcat(s) and the remote solver server(s). Communication between UniTime instances is done using JGroups.

unitime.solver.port=7800

Default communication port for the Solver cluster. If the given port is taken (e.g., there are running multiple remote solver server(s) on the same machine), the next one available will be used instead.

unitime.solver.initial_hosts=127.0.0.1[7800]

By default, TCP ping discovery is used to form a cluster. The above parameter defines a comma-separated list of machines (and their communication ports) on which a UniTime instance may be running. It does not necessarily need to have all the possible IP addresses; usually, it is set to the IP addresses of the Tomcat server(s) running UniTime.

unitime.solver.jgroups.config=solver-jgroups-tcp.xml

An alternative JGroups configuration file can be provided with this property. The default configuration file is available here.

unitime.enrollment.server.replicated=false

This property enables the replication of online student scheduling servers. If enabled, there is an additional Enrollment cluster is formed, and the same instance (academic session) of an online student scheduling server can be spawned by each of the servers (with the data replicated among them). By default, one of them will be elected as master and handle all the updates, while the others will assist in no-updating queries (e.g., computation of a student's schedule or suggestions) and step in in case of a failover. It is also possible to direct particular academic sessions to particular UniTime instances (Tomcats or remote solver servers) using the unitime.enrollment.term, unitime.enrollment.year, unitime.enrollment.campus properties (containing a regular expression that has to match against academic session term, year, and initiative, respectively).

unitime.enrollment.port=7866

If online student scheduling server replication is enabled, an additional Enrollment cluster is formed. It is used to replicate data between online student scheduling instances. This is the communication port for the Enrollment cluster.

unitime.enrollment.initial_hosts=127.0.0.1[7866]

List of initial hosts for the Enrollment cluster.

unitime.enrollment.jgroups.config=sectioning-jgroups-tcp.xml

An alternative JGroups configuration file can be provided with this property. The default configuration file is available here.

java -Xmx2g -Dtmtbl.custom.properties=custom.properties -cp solver/timetable.jar:solver/mysql-connector-java-5.1.46.jar org.unitime.timetable.solver.jgroups.SolverServerImplementation

Having Multiple Tomcats (Clustering)

With UniTime 4.0, it is possible to run multiple instances of UniTime on a cluster of Tomcats and/or remote solver servers. Besides the Solver cluster and Enrollment cluster, it is also possible to form a Hibernate cluster that is used to replicate Hibernate L2 cache. The following properties can be used to configure the Hibernate cluster.

unitime.hibernate.cluster=true

This property enables the Hibernate cluster. This cluster is used for replication of Hibernate second level cache between multiple UniTime instances.

unitime.hibernate.port=7833

Default communication port for the Hibernate cluster. If the given port is taken (e.g., there are running multiple remote solver server(s) on the same machine), the next one available will be used instead.

unitime.hibernate.initial_hosts=127.0.0.1[7833]

By default, TCP ping discovery is used to form a cluster. The above parameter defines a comma-separated list of machines (and their communication ports) on which a UniTime instance may be running. It does not necessarily need to have all the possible IP addresses; usually, it is set to the IP addresses of the Tomcat server(s) running UniTime.

unitime.hibernate.jgroups.config=hibernate-jgroups-tcp.xml

An alternative JGroups configuration file can be provided with this property. The default configuration file is available here.

Please note that Hibernate cluster is only needed when there are two or more Tomcats running UniTime. Remote solver servers have the L2 cache disabled and hence no need to connect to the Hibernate cluster.

Using Oracle Database

Here are some notes about using Oracle Database

# Oracle Configuration Example

connection.url=jdbc:oracle:thin:@localhost:1521:xe

connection.username=timetable

connection.password=unitime

connection.driver_class=oracle.jdbc.driver.OracleDriver

dialect=org.hibernate.dialect.Oracle10gDialect

tmtbl.uniqueid.generator=org.hibernate.id.SequenceGenerator

default_schema=timetable

imp timetable/###### file=woebegon.dat full=y

sqlplus system

create user timetable identified by ######; grant dba to timetable; exit

Using PostgreSQL

Here are some notes about using PostgreSQL, for more details, please see the Migrating to PostgreSQL document.

createuser --interactive --pwprompt -U postgres

Enter name of role to add: timetable

Enter password for new role: unitime

Enter it again: unitime

Shall the new role be a superuser? (y/n) n

Shall the new role be allowed to create databases? (y/n) y

Shall the new role be allowed to create more new roles? (y/n) n

Password: <password provided during install>

createdb timetable -U timetable -O timetable

Password: unitime

psql -U timetable <timetable.sql

# PostgreSQL Configuration Example

connection.url=jdbc:postgresql://localhost:5432/timetable

connection.driver_class=org.postgresql.Driver

dialect=org.hibernate.dialect.PostgreSQL9Dialect

connection.username=timetable

connection.password=unitime

default_schema=timetable

hibernate.dbcp.validationQuery=select 1

hibernate.globally_quoted_identifiers=true