Changes

Database configuration

3,994 bytes added, 17:26, 17 April 2020
Disabling the built-in MySQL
NoTouch Center stores its data into a SQL database. The primary database is MySQL, but we also support Oracle (including the latest 12c) and Microsoft SQL Server. Both the [[Installation of NTC (Windows)|NoTouch Center Windows installer]] and the The [[Stratodesk NComputing Virtual Appliance]] come comes with MySQL included, so actually the fact that a database is used is transparent to you and you don't have to worry about that.
If, and only if, you want to use an external database, be it another MySQL that you have installed somewhere, or an existing instance of Oracle or Microsoft SQL server this information is for you. Please also note that we can not support your own external database - if for instance you chose to use Oracle, you must have all the required knowledge and time to deal with Oracle!
* '''lmc.dbpass=''' password of the database user. Default: easyadmin
* '''lmc.dbtype=''' a string value denoting the type of database used. Default: mysql
** <code>mysql </code> for MySQL** <code>jtds </code> for MSMicrosoft SQL Server (preferred)** <code>sqljdbc</code> is an alternative driver for Microsoft SQL Server, relating to Microsoft's SQL-SQLJDBC driver (NoTouch 4.2.14 and later) ** <code>oracle </code> for Oracle** <code>derby </code> for Apache Derby (unsupported)** <code>hsqldb </code> for HSQL (unsupported)** hsqldbmm <code>hsqldbmem</code> for HSQL in-memory (unsupported- "in-memory" means that all contents are gone after reboot)
* '''lmc.dbport=''' an optional TCP port number if it is non-standard for the given database type. Default: empty
* '''lmc.dbPool=''' refers to the [[#Connection Pooling]] mechanism, can be c3p0, dbcp, dbcp2_basic, dbcp2_pooling. Default: empty (means C3P0 will be used)* '''lmc.dbUrlOptions=''' allows to add JDBC driver specific URL options. Default: empty
See [[tcmgr.properties]] for information on how to access the properties.file and edit NoTouch Center configuration properties.
== Disabling the built-in MySQL ==
Both the NoTouch Center Windows installer and the The [[Stratodesk NComputing Virtual Appliance]] come comes with MySQL. If you use an external database, you can deactivate MySQL.
=== Stratodesk NComputing Virtual Appliance ===
# [[SSH login|Login to the Virtual Appliance via Secure Shell]] and gain root privileges as described
# Stop the MySQL services by executing these command:
#* service mysql stop mysql
# Make sure MySQL stays deactivated:
#* echo "manual" >> /etc/init/mysql.override
 
=== Windows ===
 
When [[Installation of NTC (Windows)|installing NoTouch Center with the easy Windows installer]], you have the option to deselect MySQL during installation. If you disable the checkbox, MySQL will not be installed.
 
If you have already installed NoTouch Center including MySQL, simply disable the "NoTouch Center Database" service in the Windows Services overview.
= Database migration =
If you want to migrate your complete NoTouch Center installation (i.e. not just the database), there are easy-to-use migration paths:
* [[Migrate standalone NoTouch Center into Virtual Appliance]]
* [[Virtual Appliance Migration]] to migrate from one instance of the Stratodesk NComputing Virtual Appliance into another.
Remember, this sections deals with migrating the database only. Please always use your database servers tool to import and export. So for example if you move the NoTouch Center database from an older MS SQL server to a newer version on a different server, properly export it on the old one using the Microsoft SQL Server tools and and import it on the new one. Make sure user account, password and privileges are intact on the new system as well.
== MySQL backup and restore ==
For any MySQL installation, be it those created by the NoTouch Center Windows installer or [[Stratodesk NComputing Virtual Appliance]] or any custom/third-party installation you can easily get database contents "in" and "out".
To backup a MySQL database to a file, call:
The latter command implies that the database has been prepared correctly and the user account was created and permissions granted (see above).
 
Note: Your MySQL binaries may not reside in the default PATH, i.e. your command shell may not find it. If you use the MySQL that gets installed by the NoTouch Center Windows installer, you must manually use the full path to the mysql\bin\ subdirectory of the installation folder. That means the complete path of the mysqldump.exe and mysql.exe tools is most likely something like
C:\Program Files\NComputing\NoTouch Center\mysql\bin\
== NoTouch Center Database XML files ==
The command line tools "dbimport" and "dbexport" are located in the installation directory of NoTouch Center.
* On Windows systems this is
C:\Program Files\StratodeskNComputing\NoTouch Center\lmc* On a [[Stratodesk NComputing Virtual Appliance]] it is
/opt/center
=== Exporting the database to a NoTouch Center XML file ===
The dbexport command is available as dbexport.cmd for Windows systems and dbexport.sh for Linux systems. Simply calling it will produce an XML file - check the console output for the file name, or supply your own desired file name using the -f parameter. By default, the tool will read out the database information from the etc/tcmgr.properties file. You can specify another properties file with the -c switch or add database parameters using the command line. We suggest to run the tool only after stopping NoTouch Center.
<pre>
The dbimport command is available as dbimport.cmd for Windows systems and dbimport.sh for Linux systems. The -f parameter followed by the file to import is mandatory. By default, the tool will read out the database information from the etc/tcmgr.properties file. You can specify another properties file with the -c switch or add database parameters using the command line.
dbimport works best if used on a new database without anything in it. Refer to the instructions about preparing a database. If NoTouch Center has only been run once, it will have already created its table structure and database constraints. This implies that NoTouch Center must not run during dbimport operation!
<pre>
-x | --help ... print this help
<LMCDATA ExportFormat="2">
<METADATA>
<About>This is an export of a Stratodesk NComputing database. The content of this file is proprietary and confidential.</About>
<CreationDate TimeSource="Instance-Server">2015-06-15 01:40:56 +0000</CreationDate>
<CreatorTablePrefix></CreatorTablePrefix>
<ProductShortName>NTC</ProductShortName>
<Release>4.1.389</Release>
<Vendor>StratodeskNComputing</Vendor>
[...]
</ProductMetaData>
</pre>
= Connection Pooling =
 
NoTouch Center does not directly deal with the database, it uses an intermediary module providing "connection pooling". The reason is that opening connections to a database is a relatively expensive operation. Thus, a pool of existing connections is formed, and whenever a transaction occurs, it is done using one of the existing connections. NoTouch supports different connection pooling mechanisms, configured by the lmc.dbPool property. See above for more information on these properties: [[#Configuration properties]]. The values in parentheses are the lmc.dbPool configuration settings:
 
* '''C3P0''' (c3p0). C3P0[http://www.mchange.com/projects/c3p0] is the default connection pooling mechanism that NoTouch Center uses.
* '''DBCP''' (dbcp). Apache DBCP 1 [https://commons.apache.org/proper/commons-dbcp/] is deprecated and does not really work well. We do not recommend this.
* '''DBCP2 Basic''' (dbcp2_basic). Apache DBCP2 [https://commons.apache.org/proper/commons-dbcp/] is a rewrite of DBCP and much different to DBCP.
* '''DBCP2 Pooling''' (dbcp2_pooling). This is the real pooling mechanism of Apache DBCP2. Use this if you experience problems that you believe originate from C3P0.
 
== C3P0 configuration ==
 
See [[tcmgr.properties]] for information on how to access the properties.file and edit NoTouch Center configuration properties. The C3P0 properties begin with the lmc.c3p0 prefix - you can supply any C3P0 property, not just the ones mentioned here!
 
=== Connection testing ===
 
Connection testing means that the pool makes sure connections are still live before they are handed to the application. Why would connections expire? That is beyond our and possibly your control - firewalls, server and database settings may make connections time out. The C3P0 homepage has more information on connection testing and the tradeoffs used herein [http://www.mchange.com/projects/c3p0/#configuring_connection_testing].
 
* '''lmc.c3p0.idleConnectionTestPeriod=''' Default: 30
* '''lmc.c3p0.testConnectionOnCheckin=''' Default: true
* '''lmc.c3p0.testConnectionOnCheckout=''' Default: false
 
=== Unreturned connections ===
 
NoTouch Center is carefully engineered to return connections to the pool after completing a transaction. However, given the wide variety of database types we can not be sure that e.g. deadlocks occur. If you experiences problems, please use these options to debug the issue like described here [http://www.mchange.com/projects/c3p0/#configuring_to_debug_and_workaround_broken_clients]
 
* '''lmc.c3p0.debugUnreturnedConnectionStackTraces=''' Default: false.
* '''lmc.c3p0.unreturnedConnectionTimeout=''' Default: 0
 
In a debugging scenario, one would set debugUnreturnedConnectionStackTraces to true and assign a sensible timeout like 60 seconds to unreturnedConnectionTimeout. Do NOT assign a very short timeout (anything below 30 seconds) - this would chop off legimitate transactions, crippling NoTouch Center operation!
 
If you use this, please keep an eye on NoTouch Center operation, read the log files frequently (do not rely on the Web GUI Log view) and be ready to reset these two options to default.
[[Category:NTC]] [[Category:Migration]]