📜 ⬆️ ⬇️

Installing InterSystems Caché and GlobalsDB on Linux

Since those who first install InterSystems products on Linux often have problems during the installation process, I decided to describe this process. Currently, from free versions of Linux since version 2014.1, CentOS 6.4 is supported, so the installation process will be described on this OS, but the installation, for example, on Ubuntu is no different (although it is not officially supported by InterSystems now).

What is required


To install InterSystems Caché, we need a distribution, if you don’t have it, you can download it here . Single-user version, for RedHat, installer in tar.gz format. To install on Ubuntu, you need to take a version for SuSE Linux. At the time of writing, version 2014.1 is available.
To install InterSystems GlobalsDB here, download the version for RedHat, Node.js or Java is offered to choose from, but it doesn’t matter - it doesn’t affect the downloaded file.

1. Preparation


Before you start the installation, you need to prepare the machine to work with Caché and GlobalsDB.
First you need to increase the amount of shared memory that we can use. Caché and GlobalsDB need more than the usual default Linux setting. The documentation is written about it here .
To do this, you need to correct two parameters in the sysctl, this is shmall and shmmax. On CentOS 6.5, I got the appropriate values ​​when installing and did not have to change (but you may need to do this).
You can check the current values ​​with commands (hereinafter, it is assumed that actions are performed under the root user):
$ sysctl kernel.shmmax kernel.shmmax = 68719476736 $ sysctl kernel.shmall kernel.shmall = 4294967296 

As you can see, in my version shmmax - 64GB, shmall - 4Gb.
To change the value, you need to run the command:
 $ sysctl kernel.shmmax=68719476736 $ sysctl kernel.shmall=4294967296 
or so
 $ echo 68719476736 > /proc/sys/kernel/shmmax $ echo 4294967296 > /proc/sys/kernel/shmall 

But so changes will disappear after a reboot. To ensure that the values ​​we need always work, it is enough to edit the /etc/sysctl.conf file. You should add such lines, or find and change the corresponding parameters if they are already there.
 # Controls the maximum shared segment size, in bytes kernel.shmmax = 68719476736 # Controls the maximum number of shared memory segments, in pages kernel.shmall = 4294967296 


Additionally, you need to set the amount of memory that can be locked. Check current value (result in kilobytes):
 $ ulimit -l 64 
Set the value valid before the reboot:
 $ ulimit -l 4096000 
The value that will be saved after the reboot should be set in the /etc/security/limits.conf file.
 root soft memlock 4096000 root hard memlock 4096000 

After that, you can reboot and check all the changes.
')

2. Installation


Now everything is ready to install Caché or GlobalsDB .

Caché
Unpack the Caché distro loaded by the tar.gz.
 $ mkdir cache-2014.1.0.608.0su-lnxrhx64 $ tar -zxf cache-2014.1.0.608.0su-lnxrhx64.tar.gz -C ./cache-2014.1.0.608.0su-lnxrhx64 
Run the installation
 $ cd cache-2014.1.0.608.0su-lnxrhx64 $ ./cinstall Your system type is 'Red Hat Enterprise Linux 6 (x64)'. Currently defined instances: Enter instance name: 
Well, our system is recognized as supported, now you can fill in the necessary parameters. The parameters entered further are already at your discretion. Installation Type I think you should choose the first. Unicode support, depends on the need to use old projects on 8 bits, but I recommend to include unicode support, especially since there are already options for migrating from 8 bits to unicode. Security level can be set to the minimum. At this level, the SYS password will be set for all users, and unauthorized input will be active. The security level can then be increased if necessary.
Hidden text
 Enter instance name: CACHE
 Do you want to create a cache instance 'CACHE' <Yes>? 
 Enter a destination directory for the new instance.
 Directory: / opt / cache
 Directory '/ opt / cache' does not exist.
 Do you want to create it? 

 -------------------------------------------------- -
 NOTE: Users should not attempt to access while cache
       the installation is in progress.
 -------------------------------------------------- -


 Select installation type.
     1) Development - Install Cache Server
     2) Server only - Install Cache server
     3) Custom
 Setup type <1>? 

 Disk blocks required = 2372204
 Disk blocks available = 22197288

 Do you want to install Cache Unicode support <No>?  yes

 How restrictive do you want?
 "Minimal" is the least restrictive, "Locked Down" is the most secure.
     1) Minimal
     2) Normal
     3) Locked Down
 Initial Security settings <1>? 

 What group should be allowed to start and stop
   this instance?  root

 Cache did not detect a license key
 in directory / opt / cache / mgr.
 Do you want to enter a license key <No>? 

 Please review the installation options:
 -------------------------------------------------- ----------------
 Instance name: CACHE
 Destination directory: / opt / cache
 Cache version to install: 2014.1.0.608.0su
 Installation type: Development
 Unicode support: Y
 Initial Security settings: Minimal
 User who owns instance: root
 Group allowed to start and stop instance: root
 Effective group for Cache processes: cacheusr
 Effective user for Cache SuperServer: cacheusr
 SuperServer port: 1972
 WebServer port: 57772
 JDBC Gateway port: 62972
 CSP Gateway: using built-in web server
 Client components: all
 -------------------------------------------------- ----------------

 Do you want to proceed with the installation? 

We check the accuracy of the selected parameters, and agree with the installation. We are waiting for the installation to complete.

 Starting up Cache... Once this completes, users may access Cache Starting CACHE using 'cache.cpf' configuration file Automatically configuring buffers Allocated 351MB shared memory: 256MB global buffers, 24MB routine buffers Creating a WIJ file to hold 31 megabytes of data This copy of Cache has been licensed for use exclusively by: Cache Evaluation Copyright (c) 1986-2014 by InterSystems Corporation Any other use is a violation of your license agreement You can point your browser to http://localhost.localdomain:57772/csp/sys/UtilHome.csp to access the management portal. Installation completed successfully 

Now we can enter the Caché terminal with the command:
 $ csession cache 
And to the Caché management portal via the link http: // localhost: 57772 / csp / sys / UtilHome.csp
Starting and stopping Caché is done with the commands:
 $ ccontrol start cache $ ccontrol stop cache 
The last parameter is the name of the instance that we specified during installation.

GlobalsDB

Unpack the tar.gz distribution of GlobalsDB.
 $ mkdir globals_2013.2.0.350.0_unix $ tar -zxf globals_2013.2.0.350.0_unix.tar.gz -C ./globals_2013.2.0.350.0_unix 
Run the installation:
 $ cd ./globals_2013.2.0.350.0_unix/kit_unix_globals/ $ ./installGlobals Enter the number for your system: 
We are offered to enter the number of our system from the list, but there is no choice. This is due to the fact that the installation is performed on CentOS, the same problem may occur when installing on Ubuntu version other than 11.04, since the installer code has a hard link to the version number. To solve this problem, apply the patch. Create a file in the current folder named cplatname.patch
$ nano cplatname.patch
and contents:
 --- cplatname 2013-05-02 17:50:01.000000000 -0700 +++ cplatname.new 2014-04-05 11:43:21.676624274 -0700 @@ -114,13 +114,13 @@ distName=`cat /etc/issue | cut -f1 -d" "` version=`cat /etc/issue | cut -f2 -d" " | cut -f1-2 -d"."` proc=`uname -m` - if [ "$distName" = "Ubuntu" -a "$version" = "11.04" -a "$proc" = "x86_64" ] ; then + if [ "$distName" = "Ubuntu" -a "$proc" = "x86_64" ] ; then plat="lnxsusex64" fi fi if [ -f /etc/redhat-release ] then - grep -P 'Red Hat Enterprise Linux .* release 6' /etc/redhat-release > /dev/null 2>&1 + grep -P '.* release 6' /etc/redhat-release > /dev/null 2>&1 if [ $? = 0 ] then proc=`uname -m` 

can be downloaded from GitHubGist
apply the new patch, it will solve the problem for both CentOS and Ubuntu.
 $ patch < cplatname.patch 

Try restarting the installation:
 $ ./installGlobals Installing Globals for Red Hat Enterprise Linux 6 (x64) Enter destination directory name for this installation. Directory : 
Ok, now it works, you can install it. Unlike Caché, here the installer will ask only the installation path from us, and then immediately install and run the installed GlobalsDB.
You can log into the terminal GlobalsDB:
 $ cd /opt/globalsdb/mgr/ $ ../bin/cache -s ./ ^^/opt/globalsdb/mgr/>w $zv Globals for UNIX (Red Hat Enterprise Linux for x86-64) 2013.2 (Build 350U) Thu May 2 2013 19:28:54 EDT 
Starting and stopping the GlobalsDB server is performed by commands in the mgr subfolder where GlobalsDB was installed:
 $ cd /opt/globalsdb/mgr/ $ ./startGlobals $ ./stopGlobals 
If necessary, you can specify the size of the buffer globals, for example 1024MB
 $ ./startGlobals memory=1024 


3. Automatic start and stop when loading and shutting down the machine.


Out of the Box there is no ready-made solution for automatically launching and stopping InterSystems DBMS on Linux, which is true for both Caché and GlobalsDB.

Caché
To control the start and stop of Caché, I found a script from unix_junkie on github
swing and install it:
 $ wget https://raw.githubusercontent.com/unix-junkie/ccontrol-scripts/master/etc/init.d/cache $ cp cache /etc/init.d/cache $ chown root:root /etc/init.d/cache $ chmod 755 /etc/init.d/cache 
now you need to activate the cache service. So it can be done in CentOS.
 $ chkconfig --add cache $ chkconfig --list cache cache 0:off 1:off 2:off 3:on 4:off 5:on 6:off 
And so in Ubuntu.
 update-rc.d cache defaults 
I note that the service depends on another InterSystems service, for which there is still such a script, this is the ISCAgent service. And if it is stopped then Caché will not start. This may be after stopping Caché.

GlobalsDB
A script that is suitable for Caché is not suitable for GlobalsDB. Therefore, I can offer my version, you can take it here .
Hidden text
 #!/bin/bash # ## Example of /etc/sysconfig/globalsdb # ## Globals home directory # GLOBALS_HOME=/opt/globalsdb # ## Configure MB of database buffers (default=256) # MEMORY=1024 # ### BEGIN INIT INFO # Provides: GlobalsDB # Required-Start: # Default-Start: 3 5 # Default-Stop: 0 1 2 6 # Short-Description: Starts GlobalsDB # Description: Starts GlobalsDB ### END INIT INFO . /etc/rc.d/init.d/functions [ -f /etc/sysconfig/globalsdb ] && . /etc/sysconfig/globalsdb if [ "$GLOBALS_HOME" ]; then if [ ! -d "$GLOBALS_HOME/mgr" ]; then echo "$GLOBLAS_HOME/mgr directory not found!" >&2 ; exit 1 fi cd $GLOBALS_HOME/mgr else echo "GLOBALS_HOME is empty" >&2 ; exit 1 fi mgrdir=`pwd` start() { echo -n "Starting Globals in $mgrdir:" args="" test "$MEMORY" && args=$args' memory='$MEMORY ./startGlobals quietly $args 1>/dev/null 2>/dev/null status=$? if [ $status -eq 0 ] ; then success else failure fi echo return $status } stop() { echo -n "Stopping Globals in $mgrdir: " ./stopGlobals 1>/dev/null 2>/dev/null status=$? if [ $status -eq 0 ] ; then success else failure fi echo return $status } restart() { stop status=$? if [ $status -ne 0 ] ; then return $status fi start status=$? if [ $status -ne 0 ] ; then return $status fi return ${status} } status() { ../bin/cache -s . -cV 1>/dev/null 2>/dev/null status=$? case $status in 225) echo "Globals in $mgrdir is stopped" exit 1 ;; *) echo "Globals in $mgrdir is running" exit 1 ;; esac return 0 } usage() { echo "Usage: `basename $0` {start|stop|restart|status|help}" return 0 } if [ $# -ne 1 ] then usage exit 1 fi case "$1" in start) start exit $? ;; stop) stop exit $? ;; restart) restart exit $? ;; status) status exit $? ;; help) usage exit $? ;; *) usage exit 1 ;; esac 

 $ wget https://gist.githubusercontent.com/daimor/10009450/raw/84856a0c360ebd91ecf442715737f51e81ccf154/globalsdb $ chmod 755 globalsdb $ chown root:root globalsdb $ cp globalsdb /etc/init.d/globalsdb 
Need to prepare a file with the settings
 #    GlobalsDB,      $ echo "GLOBALS_HOME=/opt/globalsdb" > /etc/sysconfig/globalsdb #     ,         256 $ echo "MEMORY=1024" >>/etc/sysconfig/globalsdb 
Now you can enable the service. CentOS.
 $ chkconfig --add globalsdb $ chkconfig --list globalsdb globalsdb 0:off 1:off 2:off 3:on 4:off 5:on 6:off 
Ubuntu
 update-rc.d globalsdb defaults 


4. Remote access to the Caché terminal


Now about the possibility of connecting to the terminal Caché from a remote machine. Of course, having telnet or ssh access to the machine, you can run csession after authorization. But this path is not for everyone and may not always be convenient. I will consider how to make a remote connection immediately to the Caché terminal.
For example, you already have configured ssh / telnet access. Then we can create a user who will have a Caché terminal as shell. Create a file, for example, with the name /usr/bin/cachesession and contents, in which you need to specify the correct instance, and the other parameters to your taste. Up to the possibility of starting immediately some routine.
 #!/bin/bash /usr/bin/csession cache -U USER 
Making it executable and verifying, by a simple launch, should get to the terminal.
 $ chmod 755 /usr/bin/cachesession $ chown root:root /usr/bin/cachesession 
Now create a user
 $ useradd -s /usr/bin/cachesession cachesession $ passwd cachesession 
now when logging in via ssh / telnet, under the user cachesession we will immediately get into Caché.

That's all, I hope the article will be useful.

Source: https://habr.com/ru/post/217567/


All Articles