Database configuration

Database configuration : -

  • Converting database type
    • Run the conversion
    • Unconvertible tables
  • Database configuration
    • Requirements
    • Parameters    

 

Converting database type : -

 

    You can convert a SQLite database to a more performing MySQL, MariaDB orPostgreSQL database with the IFC cloud command line tool. SQLite is good fortesting and simple single-user Ifc cloud servers, but it does not scale formultiple-user production users.

 

Run the conversion : - 

First setup the new database, here called “new_db_name”.In IFC cloud root folder call

 

 

php occ db:convert-type [options] type username hostname database

 

 

The Options

  • --port="3306"                       the database port (optional)
  • --password="mysql_user_password"    password for the new database. If omitted the tool will ask you (optional)
  • --clear-schema                      clear schema (optional)
  • --all-apps                          by default, tables for enabled apps are converted, use to convert also tables of deactivated apps (optional)

Note: The converter searches for apps in your configured app folders and usesthe schema definitions in the apps to create the new table. So tables of removedapps will not be converted even with option --all-apps

For example

 

 

php occ db:convert-type --all-apps mysql oc_mysql_user 127.0.0.1 new_db_name

 

 

To successfully proceed with the conversion, you must type yes when promptedwith the question Continue with the conversion?

On success the converter will automatically configure the new database in your IFCcloud config config.php.

 

 

Unconvertible tables

If you updated your IFC cloud installation there might exist old tables, whichare not used anymore. The converter will tell you which ones.

 

 

The following tables will not be converted:
oc_permissions
...

 

 

You can ignore these tables.Here is a list of known old tables:

  • oc_calendar_calendars
  • oc_calendar_objects
  • oc_calendar_share_calendar
  • oc_calendar_share_event
  • oc_fscache
  • oc_log
  • oc_media_albums
  • oc_media_artists
  • oc_media_sessions
  • oc_media_songs
  • oc_media_users
  • oc_permissions
  • oc_queuedtasks
  • oc_sharing

 

Database configuration : -

 

IFC cloud requires a database in which administrative data is stored. The following databases are currently supported:

The MySQL or MariaDB databases are the recommended database engines.

 

Requirements

Choosing to use MySQL / MariaDB, PostgreSQL, or Oracle as your databaserequires that you install and set up the server software first.

 

Note

The steps for configuring a third party database are beyond thescope of this document.  Please refer to the documentation for your specificdatabase choice for instructions.

 

 

Database “READ COMMITTED” transaction isolation level

As discussed above IFC cloud is using the TRANSACTION_READ_COMMITTED transaction isolationlevel. Some database configurations are enforcing other transaction isolation levels. To avoiddata loss under high load scenarios (e.g. by using the sync client with many clients/users andmany parallel operations) you need to configure the transaction isolation level accordingly.Please refer to the MySQL manualfor detailed information.

 

 

 

Parameters

For setting up IFC cloud to use any database, use the instructions in Installation wizard. You should not have to edit the respective values in the config/config.php.  However, in special cases (for example, if you want to connect your IFC cloud instance to a database created by a previous installation of Nextcloud), some modification might be required.

 

Configuring a MySQL or MariaDB database

If you decide to use a MySQL or MariaDB database, ensure the following:

  • That you have installed and enabled the pdo_mysql extension in PHP
  • That the mysql.default_socket points to the correct socket (if the database runs on the same server as IFC cloud).

 

Note

MariaDB is backwards compatible with MySQL.  All instructions work for both. You will not need to replace mysql with anything.

 

The PHP configuration in /etc/php7/conf.d/mysql.ini could look like this:

 

 

# configuration for PHP MySQL module
extension=pdo_mysql.so

[mysql]
mysql.allow_local_infile=On
mysql.allow_persistent=On
mysql.cache_size=2000
mysql.max_persistent=-1
mysql.max_links=-1
mysql.default_port=
mysql.default_socket=/var/lib/mysql/mysql.sock  # Debian squeeze: /var/run/mysqld/mysqld.sock
mysql.default_host=
mysql.default_user=
mysql.default_password=
mysql.connect_timeout=60
mysql.trace_mode=Off

 

 

Now you need to create a database user and the database itself by using theMySQL command line interface. The database tables will be created by IFC cloudwhen you login for the first time.

To start the MySQL command line mode use:

 

 

mysql -uroot -p

 

 

Then a mysql> or MariaDB [root]> prompt will appear. Now enter the following lines and confirm them with the enter key:

 

 

CREATE USER 'username'@'localhost' IDENTIFIED BY 'password';
CREATE DATABASE IF NOT EXISTS IFCcloud;
GRANT ALL PRIVILEGES ON IFC cloud.* TO 'username'@'localhost' IDENTIFIED BY 'password';

 

 

You can quit the prompt by entering:

 

 

quit

 

 

An IFC cloud instance configured with MySQL would contain the hostname on whichthe database is running, a valid username and password to access it, and thename of the database. The config/config.php as created by theInstallation wizard would therefore contain entries likethis:

 

 

<?php

  "dbtype"        => "mysql",
  "dbname"        => "IFC cloud",
  "dbuser"        => "username",
  "dbpassword"    => "password",
  "dbhost"        => "localhost",
  "dbtableprefix" => "oc_",

 

 

 

 

PostgreSQL database

If you decide to use a PostgreSQL database make sure that you have installedand enabled the PostgreSQL extension in PHP. The PHP configuration in /etc/php7/conf.d/pgsql.ini could looklike this:

 

 

# configuration for PHP PostgreSQL module
extension=pdo_pgsql.so
extension=pgsql.so

[PostgresSQL]
pgsql.allow_persistent = On
pgsql.auto_reset_persistent = Off
pgsql.max_persistent = -1
pgsql.max_links = -1
pgsql.ignore_notice = 0
pgsql.log_notice = 0

 

 

The default configuration for PostgreSQL (at least in Ubuntu 14.04) is to use the peer authentication method. Check /etc/postgresql/9.3/main/pg_hba.conf to find out which authentication method is used in your setup.To start the postgres command line mode use:

 

 

sudo -u postgres psql -d template1

 

 

Then a template1=# prompt will appear. Now enter the following lines and confirm them with the enter key:

 

 

CREATE USER username CREATEDB;
CREATE DATABASE IFC cloud OWNER username;

 

 

You can quit the prompt by entering:

 

 

\q

 

 

An IFC cloud instance configured with PostgreSQL would contain the path to the socket onwhich the database is running as the hostname, the system username the PHP process is using,and an empty password to access it, and the name of the database. The config/config.php ascreated by the Installation wizard would therefore contain entries likethis:

 

 

<?php

  "dbtype"        => "pgsql",
  "dbname"        => "IFC cloud",
  "dbuser"        => "username",
  "dbpassword"    => "",
  "dbhost"        => "/var/run/postgresql",
  "dbtableprefix" => "oc_",

 

 

 

Note

The host actually points to the socket that is used to connect to the database. Using localhost here will not work if postgreSQL is configured to use peer authentication. Also note, that no password is specified, because this authentication method doesn’t use a password.

 

If you use another authentication method (not peer), you’ll need to use the following steps to get the database setup:Now you need to create a database user and the database itself by using thePostgreSQL command line interface. The database tables will be created by IFC cloud when you login for the first time.

To start the postgres command line mode use:

 

 

psql -hlocalhost -Upostgres

 

 

Then a postgres=# prompt will appear. Now enter the following lines and confirm them with the enter key:

 

 

CREATE USER username WITH PASSWORD 'password';
CREATE DATABASE IFC cloud TEMPLATE template0 ENCODING 'UNICODE';
ALTER DATABASE IFC cloud OWNER TO username;
GRANT ALL PRIVILEGES ON DATABASE IFC cloud TO username;

 

 

You can quit the prompt by entering:

 

 

\q

 

 

An IFC cloud instance configured with PostgreSQL would contain the hostname onwhich the database is running, a valid username and password to access it, andthe name of the database. The config/config.php as created by theInstallation wizard would therefore contain entries likethis:

 

 

<?php

  "dbtype"        => "pgsql",
  "dbname"        => "IFC cloud",
  "dbuser"        => "username",
  "dbpassword"    => "password",
  "dbhost"        => "localhost",
  "dbtableprefix" => "oc_",

 

  • 0 Users Found This Useful
Was this answer helpful?

Related Articles

User Management -I

User Management -I User Management Creating a New User Reset a User’s Password...

Uploading big files

  Uploading big files The default maximum file size for uploads is 512MB. You can increase...

Providing Default Files

You may distribute a set of default files and folders to all users by placingthem in directory...

Automated tagging of files

IFC’s Files Automated Tagging app allows to assign collaborative tagsto files and folders based...

Table of Contents

List of All Topics Coverd User Management  User Management-I User Management -II...

Powered by WHMCompleteSolution