Changes

Database configuration

9,064 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!
== Configuration properties == A NoTouch Center instance needs to know where its database is and how to connect. There is only one database configurable.  NoTouch Center is configured via [[Configuration properties]]. These are the relevant properties in the [[tcmgr.properties]] file:* '''lmc.dbhost=''' DNS host name or IP address of the database server. Default: localhost* '''lmc.dbname=''' name of the database that will be used on the database server. Default: easyadmin* '''lmc.dbuser=''' username that is used to connect to the database. Default: easyadmin * '''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 Microsoft SQL Server (preferred)** <code>sqljdbc</code> is an alternative driver for Microsoft SQL Server, relating to Microsoft's SQL-JDBC 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)** <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: emptySee [[tcmgr.properties]] for information on how to access the properties.file and edit NoTouch Center configuration properties. = External database operation = == Database preparation ==
NoTouch Center needs its own "database" (sometimes referred to as tablespace or schema), and a user account name and password that has all privileges in this database, including modifying table definitions. Some databases call this "DDL administration".
Please consult the Oracle documentation on creating users and tablespaces. If using Oracle XE, the database name will be hardcoded to "XE".
== Database configuration Initial set-up ==
The configuration information of which When NoTouch connects first time to an empty database, it will create all database tables and fill in essential values needed for operation. Pay close attention to use is stored in the tcmgrlog output (center.properties filelog or Console if starting in foreground). You find that file in the etc subdirectory of NoTouch Center's installation directory:* On Windows, the full path will write clear and descriptive error messages to the file is C:\Program Files\Stratodesk\NoTouch Center\lmc\etc\tcmgr.properties* On a [[Stratodesk Virtual Appliance]] the full path to the file is /opt/center/etc/tcmgrlog if it can not connect, there are configuration or database errors.properties
The tcmgr.properties file is a plain text file. Use any text editor like Notepad (Windows), vi or nano (Linux) to edit this file. Do NOT use Microsoft Word or generally speaking a word processor.== Disabling the built-in MySQL ==
Edit the file only when NoTouch Center is stoppedThe [[NComputing Virtual Appliance]] comes with MySQL. Otherwise your changes will be overwritten by NoTouch Center when If you restart ituse an external database, you can deactivate MySQL.
These are the relevant properties:* '''lmc.dbhost=''' DNS host name or IP address of the database server. Default: localhost== NComputing Virtual Appliance ===* '''lmc.dbname='''name of the database that will be used on the database server. Default: easyadmin* '''lmc.dbuser=''' username that is used to connect # [[SSH login|Login to the database. Default: easyadmin Virtual Appliance via Secure Shell]] and gain root privileges as described* '''lmc.dbpass='''password of # Stop the database user. DefaultMySQL services by executing these command: easyadmin#* '''lmc.dbtype=''' a string value denoting the type of database used. Default: service mysqlstop** mysql for # Make sure MySQLstays deactivated:#** jtds for MS-SQL** oracle for Oracle** derby for Apache Derby (unsupported)** hsqldb for HSQL (unsupported)** hsqldbmm for HSQL in-memory (unsupported)* '''lmcecho "manual" >> /etc/init/mysql.dbport='''an optional TCP port number if it is non-standard for the given database type. Default: emptyoverride
== Database migration ==
Sometimes people have to move their database to a new server, for whatever reasons. In that case you need to let NoTouch Center know about the change so that it can connect to and use its database.
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 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.  NoTouch Center does not officially support cross-migration from one of its supported databases to another one, although the unsupported NoTouch Center XML tools work well in many cases. There is no guarantee that this will work, and even if something seems to work fine, problems may come up later.  To migrate your database, proceed as follows:# Stop NoTouch Center# Migrate your database to the new server, taking into account all the information on this page# Edit the database configuration values of [[tcmgr.properties]] (see above)# Start NoTouch Center == MySQL backup and restore == For any MySQL installation, be it those created by the [[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: mysqldump -u easyadmin -p easyadmin >mydatabase.sql To read a MySQL database file and store contents to the database, do mysql -u easyadmin -p easyadmin <mydatabase.sql 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 NoTouch Center database XML file format is a proprietary XML-based file format that contains all the tables, rows and columns of a NoTouch Center database, all in XML, with the goal of exporting from and importing to different database types. It is not possible to guarantee error-free restore of such a file, thus they are '''not''' a replacement for backups of the underlying database!
The command line tools "dbimport" and "dbexport" are located in the installation directory of NoTouch Center does not support cross-migration from Oracle to MS SQL or vice-versa (there may be third-party tools though), but you can migrate both formats to MySQL. In fact, * On Windows systems this is done automatically, if you C:\Program Files\NComputing\NoTouch Center\lmc* On a [[migrate standalone NoTouch Center into NComputing Virtual Appliance]].it is /opt/center
If you have moved your === Exporting the database to a new server, please change NoTouch Center configuration according to the information below in this article.XML file ===
== NoTouch Center on 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 an external the -c switch or add database ==parameters using the command line. We suggest to run the tool only after stopping NoTouch Center.
=== Installation with an external <pre>Options: -x | --help ... print this help -f | --file ... data file (zip or xml) for export (MANDATORY) -c | --config ... configuration properties file -h | --dbhost ... database ===host (overrides config file setting) -u | --dbuser ... database user (overrides config file setting) -p | --dbpassword ... database password (overrides config file setting) -t | --dbtype ... database type such as mysql, oracle, jtds (overrides config file setting) -d | --dbname ... database name (overrides config file setting) -e | --dbport ... database TCP/IP port (overrides config file setting)</pre>
When [[Installation of NTC (Windows)|installing === Importing the database from a 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. XML file ===
Subsequently, during first connect with your browser 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 NoTouch Centerimport is mandatory. By default, a dialog box the tool will appear asking for a working read out the database configurationinformation from the etc/tcmgr.properties file. Please fill in You can specify another properties file with the data to complete -c switch or add database parameters using the installationcommand line.
=== Changing 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 -f | --file ... data file (zip or xml) for import (MANDATORY) -c | --config ... configuration ===properties file -o | --onlyimportant ... only mandatory tables, without peripheral inventory and log --nodelete ... do not delete database contents before importing --noinstall ... do not install tables --nocleanup ... do not clean up ie delete records with missing foreign keys -r | --resetpw ... reset admin password to default -h | --dbhost ... database host (overrides config file setting) -u | --dbuser ... database user (overrides config file setting) -p | --dbpassword ... database password (overrides config file setting) -t | --dbtype ... database type such as mysql, oracle, jtds (overrides config file setting) -d | --dbname ... database name (overrides config file setting) -e | --dbport ... database TCP/IP port (overrides config file setting) -m | --maxrows X ... import at most X rows per table (debugging option) --droponly ... delete everything in database and exit (no importing done) DANGEROUS --noautoinstall ... do not autoinstall (i.e. the new parameter definitions)</pre>
# Log in to the Windows system locally or via RDP or any desktop sharing product # Stop === NoTouch Center service with the standard Windows services dialog# Edit the Database XML file <Program Files>\Stratodesk\NoTouch Center\lmc\etc\tcmgr.properties with a standard text editor like Notepad# Save and exit the text editor# Start the NoTouch Center serviceformat ===
== Stratodesk Virtual Appliance ==No complete documentation of the XML file format exists. The following example is given so that system administrators can verify the file type.
<pre><?xml version="1.0" encoding="utf-8"?><LMCDATA ExportFormat= VA deployment with "2"> <METADATA> <About>This is an external export of a 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> <ProductMetaData> <Product>NoTouch Center</Product> <ProductShortName>NTC</ProductShortName> <Release>4.1.389</Release> <Vendor>NComputing</Vendor> [...] </ProductMetaData> <DatabaseMetaData> <DatabaseProductName>MySQL</DatabaseProductName> <DatabaseProductVersion>5.5.43-0ubuntu0.14.04.1</DatabaseProductVersion> <DatabaseMajorVersion>5</DatabaseMajorVersion> <DatabaseMinorVersion>5</DatabaseMinorVersion> <URL>jdbc:mysql://localhost:3306/easyadmin</URL> [...] </DatabaseMetaData> [...] </METADATA> <TABLES> [...] </TABLES> [...]</LMCDATA></pre>
# Deploy = 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: [[Stratodesk Virtual Appliance#Configuration properties]] as documented.The values in parentheses are the lmc.dbPool configuration settings:# * '''C3P0''' (c3p0). C3P0[[SSH login|Login to the Virtual Appliance via Secure Shell]http://www.mchange.com/projects/c3p0] and gain root privileges as described# Stop both is the default connection pooling mechanism that NoTouch Center service and the MySQL services by executing these command:uses.#* stop center'''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.#* stop mysql# Make sure MySQL stays deactivated'''DBCP2 Basic''' (dbcp2_basic). Apache DBCP2 [https:#* echo "manual" >> /etc/initcommons.apache.org/proper/commons-dbcp/mysql] is a rewrite of DBCP and much different to DBCP.override# Start * '''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 service againconfiguration properties. The C3P0 properties begin with the lmc.c3p0 prefix - you can supply any C3P0 property, intentionally making it fail 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 connect to its the application. Why would connections expire? That is beyond our and possibly your control - firewalls, server and databasesettings 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#* start center'''lmc.c3p0.testConnectionOnCheckout=''' Default: false === Unreturned connections === # Connect with your browser to NoTouch Centeris carefully engineered to return connections to the pool after completing a transaction. A dialog box will appear asking for a working However, given the wide variety of database configurationtypes we can not be sure that e.g. deadlocks occur. Please fill in the data If you experiences problems, please use these options to complete debug the installationissue 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
=== Changing VA 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 database configuration ===operation!
# [[SSH login|Login to the Virtual Appliance via Secure Shell]] and gain root privileges# Stop the NoTouch Center service by executing If you use this command:#* stop center# Open the , please keep an eye on NoTouch Center configuration file:#* nano /opt/center/etc/tcmgr.properties# Change these values:#* lmc.dbhost#* lmc.dbname#* lmc.dbtype#** mysql for MySQL#** jtds for MS-SQL#** oracle for Oracle#* If necessaryoperation, also lmc.dbport read the log files frequently (Port number; 0 should do not rely on the Web GUI Log view) and be fine), lmcready to reset these two options to default.dbuser (database username), lmc.dbpass (database password)# Save and exit by pressing Ctrl-X# Restart NoTouch Center:#* start center# Check the screen for potential error messages
[[Category:NTC]] [[Category:Migration]]