Environment Variables
This chapter describes the environment variables used by Tmax system, and how to configure them.
1. Overview
There are two types of Tmax environment variables in the configuration file: system variables and server process variables. Most of the Tmax environment variables are used to access Tmax system. The same values should be specified for the environment variable in this chapter as for the items in the configuration file introduced in the next chapter. These variables will affect all server processes in the system.
On client-only machines, Tmax environment variables can be configured in one of the following two ways:
-
In the shell’s profile.
-
As a file in the standard Tmax configuration file format.
Server process variables must be configured in a standard Tmax configuration file, and the file must be defined in the ENVFILE section of the configuration file.
2. Tmax Environment Variables
All clients and servers where Tmax is installed use the same environment variables, but there is no need to separately configure the environment variables of all Tmax nodes in the clients.
2.1. Tmax Server Configuration Variables
The following are environment variables configured on the server.
Variable | Description |
---|---|
TMAXDIR |
Home directory of Tmax system (Configuration file item: TMAXDIR). |
TMAX_BKAPPDIR |
The directory, where a new process will be placed, when changing the existing server process. |
TMAX_HOST_ADDR |
IP address of the server where Tmax will run on. Loads are balanced as clients are randomly connected to servers. For more information, refer to Registering Multiple Servers. |
TMAX_HOST_PORT |
Port number for accessing Tmax (Configuration file item: TPORTNO). |
TMAX_BACKUP_ADDR |
IP Address of Tmax backup server. |
TMAX_BACKUP_PORT |
Port number of Tmax backup server. |
TMAX_RAC_PORT |
Port number used by racd for centralized management of a system with distributed nodes (Configuration file item: RACPORT). |
TMAX_ERR_MSG |
Option to display error messages on the server console ("Y" or "N"). |
SDLFILE |
File where structural information is stored. |
FDLFILE |
File where field key information is stored. |
TMAX_PATHDIR |
Environment file path that is referred to during tmdown (Configuration file item: PATHDIR). |
TMAXHOME |
To use the install directory and the work directory separately, set as follows. (Configuration file item: TMAXHOME)
|
TMAX_SEMANTICS |
Action to take according to the length of an FML buffer inside functions that read data (fbget, fbget_tu, fbget_tut, fbgetf, fbgetlast_tu, fbnext_tu). Enter the data length as the last argument of the function to verify the user-assigned buffer. This is used to prevent error when the size of the user-assigned buffer is smaller than the actual data size. |
TMAX_TRACE |
Option to enable run-time tracing of Tmax application execution. |
TMAX_DEBUG |
Name for the file to which a client’s debugging and error logs will be recorded, instead of the screen. If set to filename.pid, the real name of the file is automatically set along with the client’s process ID (PID). (Example: log.22672) |
TMAX_STRING_NULL |
Option to allocate a STRING type buffer by using the tpalloc or tprealloc API. If the user requests for service with data that fills up to the last one-byte space designated for NULL in the allocated buffer, a TPEINVAL (client) and TPESVCERR (server) error occurs. In such case, an additional one-byte buffer can be allocated and automatically set to a NULL character by setting this option to Y. |
TMAX_HOST_IPV6 |
Set to 'Y' or 'IPV6' if an address set in the TMAX_HOST_ADDR variable uses the IPv6 protocol. Set to 'SDP' if the address uses InfiniBand Socket Direct Protocol (SDP). |
TMAX_BACKUP_IPV6 |
Set to 'Y' or 'IPV6' if an address set in the TMAX_BACKUP_ADDR variable uses the IPv6 protocol. Set to 'SDP' if the address uses InfiniBand Socket Direct Protocol (SDP). |
TMAX_WEBADM_IPV6 |
Option to use the IPv6 protocol when twagent (Tmax WebAdmin agent) listens from TMAX_WEBADM_PORT. Set to 'Y' or 'IPV6' to use IPv6. Set to 'SDP' to use InfiniBand Socket Direct Protocol (SDP). |
TMAX_RAC_IPV6 |
Option to use the IPv6 protocol when executing 'connect' or 'listen' from a racd daemon process that is used for integrated management of a distributed system.
Only used when the [-k] option is used to start racd. SYSTEM_IPV6 setting will be used instead when a Tmax binary environment file is used to start racd. |
TMAX_IPV6_LINK_IF |
New network interface name to use if Tmax processes cannot recognize the interface index of a network interface name when executing 'connect' or 'listen' in an environment that uses the IPv6 protocol. |
TMAX_APPLY_IPCPERM |
When a server starts for the first time, permissions of log files that are written by specifying the -e and -o options are determined according to IPCPERM set in the DOMAIN or NODE section.
|
TMAX_LOGLVL |
Debug log level for tmm, modules that do not need to connect to tmm, and modules that are not connected to tmm yet. This variable has the same value as the value set in TMMLOGLVL under the DOMAIN section. Log output location can be set by using this variable along with TMAX_DEBUG. The default location of TMAX_DEBUG or higher log is stderr. General utilities output no message if TMAX_ERR_MSG is N or n. For modules that need to connect to tmm, the log output is determined by the TMAX_ERR_MSG environment variable before the tmm connection. After the tmm connection, all logs are outputted. In the DEBUG4 level, some gateways can output dump messages. |
TMAX_TENC_CIPHER |
Encryption method related to the SEED encryption/decryption utility that can be set in Tmax configuration file. If set to non-SEED or not set, existing encryption method is used. |
TMAX_TENC_KEYFILE |
Secret key location. Must be defined to use the SEED encryption algorithm. |
TMAX_STRING_NULL is only supported for buffers allocated through tpalloc or tprealloc, and works similarly in both the server and client. Note that the variable must be set to Y. |
The following is an example of setting TMAX_SEMANTICS. If a user specified buffer size is smaller than the actual data size, the data is truncated to the buffer size, and then written to the buffer.
TMAX_SEMANTICS = "FDL_LEN=TRU"
If the following is set, the FBENOSPACE error occurs when a user specified buffer size is smaller than the actual data size.
TMAX_SEMANTICS = "FDL_LEN=ERR"
If the following is set, a user specified length is ignored, and Tmax runs with the assumption that the user has allocated a buffer with sufficient length. This setting is valid only when the data length is specified as the last argument of the fbget type function. If the last argument is specified to 0 or NULL, Tmax runs with the assumption that the user allocated a buffer with sufficient length.
TMAX_SEMANTICS = "FDL_LEN=OLD"
2.2. Tmax Client Environment Variables
The following are environment variables configured on the client.
Variable | Description |
---|---|
TMAX_HOST_ADDR |
Tmax system IP address. |
TMAX_HOST_PORT |
Tmax system port number. |
TMAX_CONNECT_ TIMEOUT |
Timeout value for connecting to Tmax (x.xxx seconds). |
SDLFILE |
File where structural information is stored. |
FDLFILE |
File where field key information is stored. |
ULOG (or ULOGPFX) |
Client side log path. If the path is not specified, the log will be recorded in ULOGDIR of the Tmax environment file. |
TMAX_TRACE |
Option to enable run-time tracing of Tmax application execution. |
TMAX_SEMANTICS |
Action to take according to the length of an FML buffer inside functions that read data (fbget, fbget_tu, fbget_tut, fbgetf, fbgetlast_tu, and fbnext_tu). Refer to Tmax server configuration variables. The encryption function is provided for stable data transmission between a client and the server. |
TMAX_CRYPT_ ALGORITHM |
Encryption algorithm. "AES" can be specified. (Default: 3DES). |
TMAX_DEBUG |
Name for the file to which a client’s debugging and error logs will be recorded, instead of the screen. If set to filename.pid, the real name of the file is automatically set along with the client’s process ID (PID). (Example: log.22672) |
TMAX_HOST_IPV6 |
Set to 'Y' or 'IPV6' if an address set in the TMAX_HOST_ADDR variable uses the IPv6 protocol. Set to 'SDP' if the address uses InfiniBand Socket Direct Protocol (SDP). |
TMAX_BACKUP_IPV6 |
Set to 'Y' or 'IPV6' if an address set in the TMAX_BACKUP_ADDR variable uses the IPv6 protocol. Set to 'SDP' if the address uses InfiniBand Socket Direct Protocol (SDP). |
TMAX_IPV6_LINK_IF |
New network interface name to use if Tmax processes cannot recognize the interface index of a network interface name when executing 'connect' or 'listen' in an environment that uses the IPv6 protocol. |
TMAX_ACTIVATE_ AUTO_TPSTART |
Set to either Y or N.
The following functions are affected by this variable.
|
PB_TPCALL_RETRY |
Maximum number of attempted retries if a tpcall request fails due to a network error in the Power Builder environment. The following functions are affected by this variable.
|
PB_TPCALL_RETRY_ TIMEOUT |
BLOCKTIME per second for each request during a tpcall request in the Power Builder environment. For APIs which are affected by this environment variable, refer to the description about PB_TPCALL_RETRY. |
PB_TUXCOMPAT |
Provides compatibility with the Tuxedo library for using some of the APIs in the Power Builder environment. For detailed information, refer to Tmax Programming Guide(4GL). The following functions are affected by this variable.
|
FDLVERSION |
FDL version. (Default value: 1)
|
TMAX_LOGLVL |
Debug log level for tmm, modules that do not need to connect to tmm, and modules that are not connected to tmm yet. This variable has the same value as the value set in TMMLOGLVL under the DOMAIN section. |
Set TMAX_SEMANTICS to use the encryption function. For encryption, the encryption function must set for both the client and server. The client encryption function can be set in .profile as in the following. For information about encryption setting of the server, refer to "CRYPT in 3.2.1 DOMAIN".
<.profile>
export TMAX_SEMANTICS = "CRYPT_SW=Y"
To use TMAX_SEMANTICS in tmaxreadenv, use a colon (:) instead of an equal sign (=) inside double quotes (").
<tmax.env>
TMAX_SEMANTICS = "FDL_LEN:ERR" TMAX_SEMANTICS = "CRYPT_SW:Y"
3. Setting Tmax Environment Variables
The following describes how to set server and client environment variables.
3.1. Server Environment Variables
Environment variables for Tmax system must be configured according to the shell type. The variables must be configured in <.profile> for korn shell, in <.bash_profile> for bash shell, and in <.cshrc> for c shell.
Make sure that there are no blank spaces between the name of the variable and the equal sign ('='). |
-
korn shell and bash shell
<.profile and .bash_profile>
export TMAXDIR = /home/tmax export TMAX_BKAPPDIR = /home/tmax/bkappbin export TMAX_HOST_ADDR = 192.168.0.1 export TMAX_HOST_PORT = 8888 export TMAX_RAC_PORT = 3333 export SDLFILE = /home/tmax/sample/sdl/tmax.sdl export FDLFILE = /home/tmax/sample/sdl/tmax.fdl export TMAX_PATHDIR = /home/tmax/path_new export TMAX_DEBUG = /home/tmax/sample/client/clidebug
-
c shell
<.cshrc>
setenv TMAXDIR = /home/tmax setenv TMAX_BKAPPDIR = /home/tmax/bkappbin setenv TMAX_HOST_ADDR = 192.168.0.1 setenv TMAX_HOST_PORT = 8888 setenv TMAX_RAC_PORT = 3333 setenv SDLFILE = /home/tmax/sample/sdl/tmax.sdl setenv FDLFILE = /home/tmax/sample/sdl/tmax.fdl setenv TMAX_PATHDIR = /home/tmax/path_new setenv TMAX_DEBUG = /home/tmax/sample/client/clidebug
Tmax is installed by executing install.sh, which will automatically add the basic environment variables at the end of the shell environment file. Environment variables required for server processes must be configured in a text file, and the file must be set in the ENVFILE section of the NODE and SVRGROUP sections in Tmax environment file.
<Server Environment File>
LOGDIR = /tmp USER_VARIABLE = test1 USER_VARIABLE = test2 USER_VARIABLE = test3 USER_VARIABLE = test4 USER_VARIABLE = test5
3.2. Client Environment Variables
The method for configuring the environment variables on client-only machines is different for each OS.
-
UNIX
Like server environment variables, variables are configured in the profile.
-
DOS, Windows98, or Windows NT/2000
Environment variables are configured in the <autoexec.bat> or in the system profile of the control panel. ([Control panel] > [System properties] > [Advanced] > [Environment variables])
<autoexe.bat>
set TMAX_HOST_ADDR = 192.168.0.1 set TMAX_HOST_PORT = 8888 set TMAX_CONNECT_TIMEOUT = 3 set SDLFILE = /home/tmax/sample/sdl/tmax.sdl set FDLFILE = /home/tmax/sample/sdl/tmax.fdl set TMAX_DEBUG = /home/tmax/sample/client/clidebug
Client environment variables must be defined in a text file, which the system will refer to.
<tmax.env>
[TEST] TMAX_HOST_ADDR = 192.168.0.1 TMAX_HOST_PORT = 8888 TMAX_CONNECT_TIMEOUT = 3 SDLFILE = /home/tmax/sample/sdl/tmax.sdl FDLFILE = /home/tmax/sample/sdl/tmax.fdl ULOGPFX = /home/tmax/testlog TMAX_DEBUG = /home/tmax/sample/client/clidebug [REAL] TMAX_HOST_ADDR = 192.168.0.2 TMAX_HOST_PORT = 1234 TMAX_CONNECT_TIMEOUT = 3 SDLFILE = /home/tmax/sample/sdl/tmax.sdl FDLFILE = /home/tmax/sample/sdl/tmax.fdl ULOGPFX = /home/tmax/reallog TMAX_DEBUG = /home/tmax/sample/client/clidebug
For more information about setting client environment variables, refer to "3.1.37. tmaxreadenv" in Tmax Reference Guide. |
4. Registering Multiple Servers
In the previous versions of Tmax, each client could only connect to one specific server, but versions 3.12.2 and later include load balancing feature to randomly connect each client to a server. To use multiple servers, configure the TMAX_HOST_ADDR setting.
To enable this function, the following must be set in the configuration file.
-
IPv4
TMAX_HOST_ADDR = (host_address:portno|host_address2:portno2), host_address3:portno3,host_address4:portno4
-
IPv6
TMAX_HOST_ADDR = ([host_address]:portno|[host_address2]:portno2), [host_address3]:portno3,[host_address4]:portno4
Backup addresses for the client to connect to are separated by a comma. In the previous example, the client will first attempt to connect to "host_address:portno|host_address2:portno2". If the connection attempt fails, the client will try to connect to "host_address3:portno3". If the second attempt also fails, then the client will try to connect to "host_address4:portno4".
The addresses in parenthesis separated by a pipe(|) have a load balancing relationship with one another. This means that a client will randomly attempt to connect to one of these addresses, and in case of a connection failure, the client will sequentially attempt to connect to those in the load balancing relationship. If all fails, it will then try to connect to the backup addresses.
The following is the description of TMAX_HOST_ADDR.
-
Maximum length is 255 bytes.
-
In the event that all attempts to connect to the addresses in TMAX_HOST_ADDR fail, the client will then attempt to connect to the addresses specified by TMAX_BACKUP_ADDR.
-
No spaces should be used for TMAX_HOST_ADDR value.
-
Double quotation marks(" ") must be used when specifying environment variables with export or setenv in the shell, because the shell interprets parentheses and pipe character differently than other characters.
Example
The following example compares server configuration methods.
-
Connecting the client by using existing settings
TMAX_HOST_ADDR = 192.1.1.1 TMAX_HOST_PORT = 9000
-
Enabling load balancing that randomly connects the client to one of multiple addresses:
TMAX_HOST_ADDR = (192.1.1.1:9000|192.1.1.2:9001),192.1.1.3:9003,192.1.1.4:9004
-
Randomly connecting the client to an address (IPv6 protocol environment)
In an IPv6 protocol environment, addresses are placed inside square brackets([ ]) to distinguish a host address from a portno.
TMAX_HOST_ADDR = ([2011::10]:9000|[2011::20]:9001),[2011::100:30]:9003,[2011::100:40]:9004