Install InterSystems Caché and GlobalsDB on Linux

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

What is required


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

1. Preparation


Before starting the installation, you need to prepare the machine for working with Caché and GlobalsDB.
First you need to increase the amount of shared memory that we can use. To work, Caché and GlobalsDB need more than usually set by default in Linux. The documentation for this is written here .
To do this, you need to adjust two parameters in sysctl, these are shmall and shmmax. I have it on CentOS 6.5, they already received the appropriate values ​​during installation and did not have to be changed (but you may need to do this).
You can check the current values ​​with the commands (hereinafter, it is assumed that the actions are performed as root):
$ sysctl kernel.shmmax
kernel.shmmax = 68719476736
$ sysctl kernel.shmall
kernel.shmall = 4294967296

As you can see, in my version shmmax is 64GB, shmall is 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 the changes will disappear after a reboot. In order for the values ​​we need to always work, just edit the file /etc/sysctl.conf. 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 until reboot:
$ ulimit -l 4096000
The value that will be saved after reboot must be set in the file /etc/security/limits.conf
root           soft       memlock              4096000
root           hard       memlock              4096000

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

2. Installation


Now you are ready to install Caché or GlobalsDB .

Caché
Unpack the downloaded tar.gz Caché distribution.
$ 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
We start 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 at your discretion. Type of installation I think you should choose the first. Unicode support depends on the need to use old 8-bit projects, but I recommend turning on Unicode support, especially since there are already options for migrating from 8 bits to Unicode. The security level can be set to a minimum. At this level, the SYS password will be set for all users, and an unauthorized login will be active. The security level can then be increased if necessary.
Hidden text
Enter instance name: CACHE
Do you want to create Cache instance 'CACHE' ? 
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 Cache while
      the installation is in progress.
-------------------------------------------------- -
Select installation type.
    1) Development - Install Cache server and all language bindings
    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 ? yes
How restrictive do you want the initial Security settings to be?
"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 ? 
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 correctness 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 at the link http: // localhost: 57772 / csp / sys / UtilHome.csp
Starting and stopping Caché is done by 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 GlobalsDB distribution.
$ 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
We start the installation:
$ cd ./globals_2013.2.0.350.0_unix/kit_unix_globals/
$ ./installGlobals 
Enter the number for your system: 
We are prompted 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 can occur when installing on Ubuntu a 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 with the name cplatname.patch
$ nano cplatname.patch
and the 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 we will
apply a new patch, it will solve the problem for both CentOS and Ubuntu.
$ patch < cplatname.patch

We try to restart the installation:
$ ./installGlobals 
Installing Globals for Red Hat Enterprise Linux 6 (x64)
Enter destination directory name for this installation.
Directory :
Great, now it works, you can install. Unlike Caché, here the installer will ask us only for the installation path, and after that immediately install and run the installed GlobalsDB.
You can enter the GlobalsDB terminal:
$ 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 the commands in the mgr subfolder where GlobalsDB was installed:
$ cd /opt/globalsdb/mgr/
$ ./startGlobals 
$ ./stopGlobals 
If necessary, you can specify the size of the global buffer, for example 1024MB
$ ./startGlobals memory=1024


3. Automatic start and stop when loading and turning off the machine.


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

Caché
To control the start and stop of Caché, I found on github a script from unix_junkie,
download 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 on 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 option, 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
You need to prepare the settings file
# путь к установленному 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 Caché terminal from a remote machine. Of course, having telnet or ssh access to the machine, you can run it after authorization csession. But this way is not for everyone and may not always be convenient. I will consider the option of making a remote connection directly to the Caché terminal.
For example, you already have configured ssh / telnet access. Then we can create a user with a Caché terminal as a shell. We create a file, for example, with the name /usr/bin/cachesessionand contents, in which you need to specify the correct instance, and the remaining parameters to your taste. Up to the possibility of starting any routine at once.
#!/bin/bash
/usr/bin/csession cache -U USER
We make it executable and check, by simple launch, it should go 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 with ssh / telnet, under the user cachesession we will immediately go to Caché.

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

Also popular now: