Installation

FairCom DB can be installed using a downloaded compressed (.zip or .tar) file or an Installer (.msi) file if you purchased a product for Windows.

Compressed files are ideal for embedding the FairCom server into an application or for running multiple instances of the server on the same computer.

On Windows, the installer file automatically installs dependencies and runs the FairCom server as a Windows Service.

Note: After purchasing a product, you will be sent a direct-download link.

 

Hardware and Software Requirements

Software

Windows

Supported versions

  • Windows 7 or Windows server 2008 or newer.
    Windows Vista or 2003 and some earlier versions of Windows may be supported if necessary. Check with FairCom for possible availability.
  • For the V11.5 FairCom DB SQL JDBC Driver you will need JDK 1.7 or newer and the FairCom DB SQL server to develop using JDBC.
  • For the V11.0 FairCom DB SQL JDBC Driver you will need JDK 1.6 or newer and the FairCom DB SQL server to develop using JDBC.
  • SQL stored procedures for FairCom server V12 and later:
    • To develop a stored procedure, you will need JDK 1.7 or newer.
    • To execute a stored procedure, you will need JRE 1.7 or newer.
  • SQL stored procedures for FairCom server V11:
    • To develop a stored procedure, you will need JDK 1.6 or newer.
    • To execute a stored procedure, you will need JRE 1.6 or newer.

 

FairCom DB .NET requirements

FairCom provides deprecated .NET applications for managing the FairCom server. They require the Microsoft .NET 4.0 Framework.

These are located in <faircom>\tools\gui\.

FairCom DB V10 requires at least framework version 3.5 SP1 complete — for example, the complete version, not just the "client" version.

 

.NET - Removed STRONGSIGN from assemblies

To be more compliant with standard practice for C# programmers, STRONGSIGN has been removed from .NET assemblies. We no longer force the assembly to be signed with the FairCom key. This allows developers to sign with their own key, which they can keep secret.

 

.NET tools for VS2010 - all projects updated to use .NET framework v4.0

All the .NET projects for VS2010 have been updated to use the v4.0 .NET framework. If you target the .NET v3.5 framework, it uses the VS2008 compiler tool chain which can result in an internal compiler error in VS2010. The target framework was changed to v4.0 in the *_v10.sln files to eliminate that error.

For more information, see http://support.microsoft.com/kb/976656

 

FairCom DB ADO.NET requirements

System requirements

The minimum development system requirements for FairCom DB QL ADO.NET Entity Framework support:

The complete version is required — for example, the complete version, not just the "client" version.

  • Visual Studio 2008 Service Pack 1 or greater
  • FairCom DB V11.5 requires Microsoft .NET 4.0 Framework.
  • FairCom DB V11.0 requires Microsoft .NET 4.0 Framework.
  • FairCom DB V10.3 requires Microsoft .NET 4.0 Framework.
  • FairCom DB V10 requires at least Framework Version 3.5 SP1

 

Auto Incrementing field type restriction

Entity Framework Models allow Int16, Int32 or Int64 field types to be specified as Auto Incrementing in model design. Auto Incrementing fields are also known as Identity fields in some schemas.

FairCom DB SQL allows one user Auto Incrementing field type.

FairCom DB already supported a serial segment field, currently used by default as the ROWID value. As there is a limitation of one SRLSEG field type per data file (table), this precluded the addition of a user-defined field. An IDENTITY attribute is now available for this purpose.

 

Other known limitations

Known FairCom DB SQL limitations that can be encountered when using Entity Framework support:

These are in various stages of development. Contact your nearest FairCom office for the latest information concerning specific support for these items.

  • The SKIP operator is not currently supported. The SKIP operator is commonly used with the TOP operator for "paging" purposes.
  • The EXCEPT operator is not currently supported.
  • Parameters are not currently supported in functions and in the TOP operator.
  • BIT (Boolean) columns can currently only be tested against 1 or 0 (that is, if ( bitColumn == 1 ). Entity Framework requires a test against true/false (for example, if ( bitColumn == true) or more simply if ( bitColumn ).
 
 

Linux

Supported versions

  • Linux
    • FairCom supports all major Linux distributions. Please inquire about specific versions should you have unique requirements.
    • Intel 64-bit
    • ARM 32- and 64-bit
    • Red Hat Enterprise Linux 8 and 7 and compatible CentOS releases, and other Linux distributions
    • Raspberry Pi OS
  • Unix
    • AIX
    • FreeBSD
    • HP-UX
    • QNX and QNX RTP
    • Solaris (Intel and SPARC)
    • SCO 6

 

Supported platforms

Currently supported FairCom DB Unix servers:

  • AIX
  • FreeBSD
  • HP-UX
  • Linux (Intel, PPC, and Sparc)
  • Mac OS X
  • QNX and QNX RTP
  • Solaris (Intel and SPARC)

On Unix platforms, the FairCom server is installed by following the same general method and, for the most part, share the same hardware requirements. Items specific to a particular FairCom server are discussed in.

Should you require support on other platforms, contact FairCom. FairCom DB has been ported to dozens of platforms over the years. Generally, all that is required is a supported C compiler, and for best multithreading support, a native pthread library. Even without native thread support, FairCom can provide a proprietary threading architecture.

 

Shared Memory client-server communication for Unix/Linux

The FairCom server for Unix supports shared memory connections. Shared memory communication between clients and servers residing on the same machine generally provides much better performance for locally running applications. Local shared memory connections are supported across the board including ISAM and SQL connections, and this includes JDBC and Windows ADO.NET Data providers.

 

System files, permissions, and ownership

The FairCom shared memory communication protocol creates a file used by clients to find the shared memory identifier for its shared memory logon region, and creates a Unix domain socket as a file for initial communication between a client and server.

The FairCom server creates the directory /tmp/ctreedbs and the file /tmp/ctreedbs/<servername>.logon. This file name is determined by the value specified with the SERVER_NAME configuration option. This file contains an identifier of a shared-memory region used for clients to connect.

SERVER_PORT applies to the TCP/IP protocol and overrides SERVER_NAME if both are used together.

The following configuration option allows this directory to be directly specified:

SHMEM_DIRECTORY <directory_name>

If your server combines shared memory and TCP/IP usage, here are a few tips:

  • If you are content with the TCP/IP port resulting from the SERVER_NAME option, then use that option and you can connect using the name with either protocol.
  • If you wish to explicitly set the TCP/IP port, use SERVER_PORT to set that port (then connect with #port to use TCP/IP on that port) and SERVER_NAME to set the name used by the shared memory protocol. Note that this approach means that a connection attempt will not be able to 'fall back' to using TCP/IP if the shared memory connection fails, unless you choose your server name so that it matches your SERVER_PORT setting. For example, consider the following set of options:
SERVER_PORT 7000

SERVER_NAME #7000

Connect with a server name of #7000. The client will attempt to connect using shared memory first and if that fails it will connect with TCP/IP on port 7000.

On some Linux/Unix systems, be sure to place double quotes around the connection string (for example when using the bash shell).

For example: ./ctstat -vas -u admin -p ADMIN -s "#5598ocalhost"Without the double quotes, bash treats # as a comment, so it ignores the remainder of the connection string.

FairCom DB must have sufficient read, write, create, and delete permissions with this directory.

The following server keyword sets the shared memory resource permissions:

SHMEM_PERMISSIONS <permissions>

The default is 660. 666 will allow access to FairCom DB by any user account.

By default, a client application must belong to the server owner’s primary group to use shared memory. This is configurable with the SHMEM_GROUP keyword.

SHMEM_GROUP  <group>

Example 2. Possible errors indicating problems

FSHAREMM: Could not get group ID for group <group> for shared memory

FSHAREMM: Failed to set group for LQMSG shared memory region: X

 

Shared memory keys

When more than one FairCom process is run on a Unix system, the shared memory key used by the servers might hash to the same value, causing problems connecting to the servers. This happens as the ftok() system call is used by default to generate the shared memory keys, and ftok() is not guaranteed to return unique values. Another possibility is that another unrelated process might happen to use the same shared memory key as generated by the FairCom Server.

An administrator can specify a specific shared memory key for ISAM and SQL shared memory communication protocols to ensure that keys do not match keys already in use on the system. This is specified with the following FairCom configuration options:

SHMEM_KEY_ISAM <isam_shared_memory_key>

SHMEM_KEY_SQL <sql_shared_memory_key>

The shared memory key values can be specified in either decimal or hexadecimal format, for example:

; Set shared memory key for ISAM connections to the specified decimal value:

SHMEM_KEY_ISAM 12345

; Set shared memory key for ISAM connections to the specified hexadecimal value:

SHMEM_KEY_ISAM 0xabcd

These server configuration options support specifying an environment variable, whose value is substituted for the configuration option value when the server starts up. For example, if the environment variable MY_ISAM_KEY is set to a numeric value such as 12345 or 0xabcdef before starting the server process, then the following option can be specified in the server configuration file to use this environment variable value for the SHMEM_KEY_ISAM configuration option value:

SHMEM_KEY_ISAM %MY_ISAM_KEY% 

 

Client configuration

From the client side, either set the global variable ctshmemdir to the directory name before connecting, or set the CTREE_SHMEM_DIRECTORY environment variable. The environment variable takes precedence over the ctshmemdir setting. This allows the directory to be dynamically overridden without having to recompile client code.

 

Errors with shared memory protocol

The FairCom server logs error messages to CTSTATUS.FCS when a shared-memory connection attempt fails.

The message is of the form:

FSHAREMM: <error message>

 

Adjusting system limits

When running the FairCom server with more than 128 shared-memory connections, you may encounter one of the following errors:

FSHAREMM: Connect named pipe failure: 13

FSHAREMM: Connect named pipe failure: 28

Many Unix/Linux implementations have a default limit of 128 system semaphores, which are used by FairCom shared memory connections. However, this value applies system-wide among all processes.

FSHAREMM: Failed to create system semaphore: check system semaphore limits such as SEMMNI

The following error can be reported as well:

FSHAREMM: Failed to create shared memory segment: check shared memory limits such as SHMMNI

These are typically kernel configurations. The FairCom server requires (2 + # shared memory CONNECTIONS) shared memory segments (SHMMNI) and semaphores (SEMMNI).

The ipcs command displays current limits:

#ipcs -l

------ Semaphore Limits --------

max number of arrays = 128

------ Shared Memory Limits --------

max number of segments = 128

To increase limits to allow up to 1024 shared memory segments and semaphores, consider adding the following to your local /etc/sysctl.conf file.

kernel.shmmni = 1024

kernel.sem = 250 256000 32 1024

Run this command to then enable support:

/sbin/sysctl -p

In general, you will require root superuser access to make these changes. Consult your specific Unix/Linux documentation for the actual file location and parameters of this configuration.

 

Usage

To take advantage of this feature, check the following:

  1. Shut down your FairCom server and add the following keyword to your ctsrvr.cfg file:
COMM_PROTOCOL FSHAREMM
  1. Restart the FairCom server.
  2. Execute any FairCom utility you've linked with V9.5 or later of the FairCom server you have on the same machine as the FairCom server process. Even if you are linked with a c-tree TCP/IP library, it will automatically detect if you are running on the same machine and try to connect via shared memory. This way you don't need multiple versions of your application and utilities.
  3. You can monitor your connections by listing the clients from the ctadmn command-line utility on Linux, or by using the FairCom DB Monitor program from Windows (it is shown in the Comm Info column on the far right).

 

Usage notes

  • Unix and Windows client libraries are built with shared-memory support by default.
  • When the FairCom server detects a request to connect from the same machine as the client, it first attempts to connect using shared memory. If that succeeds, the connection uses the shared-memory protocol. Otherwise, the connection is made using TCP/IP.
  • 32-bit clients can connect to 64-bit servers (and vice versa).
  • By default, a client application must belong to the server owner’s primary group to use shared memory. This is configurable with the SHMEM_GROUP keyword.
  • Shared memory uses a Unix domain (file system) socket for transferring data between the client and server. The Unix domain socket exists as a file named /tmp/ctreedbs/<servername>.logon.
    • The COMPATIBILITY SHMEM_PIPE option has been deprecated and no longer has any effect.
  • A Unix/Linux server using shared-memory communications will create a directory /tmp/ctreedbs. If this directory already exists (for example, if a different user had started the server, even from a previous run) and the server does not have write permission to this directory, startup will fail, most likely reporting a DSRV_ERR error (509, duplicate server), even if no other server is currently running.
  • pthread mutex shared-memory support is expected for Unix systems. However, if a client and the server are compiled with incompatible options (for example, the client uses System V semaphores but the server uses pthread mutexes) the connection attempt will fail and the FairCom server will log one of the following messages to CTSTATUS.FCS.

If client is using System V semaphore and server is using pthread mutex:

A shared-memory connection attempt by an incompatible client failed: pthread mutex required

If server is using System V semaphore and client is using pthread mutex:

A shared-memory connection attempt by an incompatible client failed: SYSV sema required

 

System tools

The Unix/Linux ipcs utility is useful for listing the shared-memory regions and semaphore sets that currently exist on a system. ipcs can also be used to remove shared-memory regions and semaphore sets. Under normal circumstances, the FairCom server removes shared-memory regions and semaphore sets for connections that have been closed. However, if the FairCom server process terminates abnormally, it may be necessary to manually remove the shared-memory regions and semaphore sets belonging to this process.

 

Other possible shared memory messages

FairCom ISAM and SQL ports are independent of each other. In general, there is a shared memory connection protocol enabled for each, in addition to TCP/IP ports. Keep in mind that's a total of four connection protocols, with configuration options for each.

Possible SQL shared memory connection errors can appear such as the following. Analyze and correct these as you would for the ISAM errors previously mentioned as the same parameters should be examined.

Possible SQL share memory connection errors:

- User# 00012   sqlshmlisten: shared memory protocol initialization failed: -1
- User# 00012   sqlshmlisten: shared memory protocol accept failed: -2
- User# 00012   sqlshmlisten: Failed to get shared memory environment: XX
  • Named pipe creation failed with error ERROR_PIPE_BUSY. The operation will be retried.
- User# 00012   sqlshmlisten: shared memory protocol listen failed: -4
  • Failed permissions on the temporary directory needed.
- User# 00012   SQLSHAREMM: Failed to open /tmp/ctreedbs/CTSQL_6597 for shared memory: 13

 

Solaris considerations

Orphan shared memory segments and semaphores contribute to the system limit. Their presence can affect the number of user connections you will be able to achieve. There is no way of ensuring these are removed if the server process exits unexpectedly, so they must be removed manually.

To remove orphan shared memory segments and semaphores, follow this procedure:

  1. List the shared memory segments and the number of attached processes (NATTACH):
ipcs -m -o
  • This shows all the shared memory segments on the system. Ones with no attached processes might be safe to remove.
  • Be careful not to delete the shared memory segments created by other processes. Deleting a shared memory segment that is in use does not cause an immediate problem for c-tree. This is similar to deleting a file that is open: any process using it can keep using it, but no one can start using it.
  1. Use the ipcrm command to remove unwanted shared memory segments and semaphores. Consult the manpage on your system for specific details about using this command.
  2. List the interprocess semaphores using the ipcs -s command. 
    1. For Solaris 5.10, see List interprocess semaphores on Solaris 5.10 below.

Solaris does not provide a way to see which interprocess semaphores belong to a specific process. To get an idea of whether a semaphore might be in use, use ipcs -s -t to see the time of last use. You may be able to infer which semaphores belong to c-tree by the time of last use (especially if you can shut down c-tree cleanly and observe the change in semaphores).

  1. Delete any unwanted interprocess semaphores.

Deleting an interprocess semaphore if it is actively in use by c-tree causes the connection to immediately fail. Deleting an interprocess semaphore that is in use by another process may cause that process to fail.

  1. Start the server and connect to it once you have removed the items shown above.
    Raising the limits on Solaris 5.10 and later
    The following parameters are useful for managing resources:
    1. max-shm-ids - Maximum number of shared memory segments on a system
    2. max-sem-ids - Maximum semaphore IDs for a project.
    3. max-sem-nsems - Maximum number of semaphores allowed per semaphore set.

Temporarily raise the limits set for these parameters

  1. Run the following as root, where SHELL_PID is the PID of the shell that will be starting the c-tree server process:
prctl -n project.max-shm-ids -r -v 1024 -i project default

prctl -n project.max-sem-ids -r -v 1024 -i project default

prctl -n process.max-sem-nsems -r -v 1024 SHELL_PID
  1. Start FairCom server from the shell with PID = $SHELL_PID and connect users.
  2. The above settings will be reset to the default when the machine is rebooted.

Remember that max-sem-nsems is only increased for that shell process and its children

  1. To make these changes permanent so they are effective after every reboot, execute the following command:
/usr/sbin/projmod -sK "project.max-shm-ids=(privileged,1024,deny)" default
  1. After changing the shared memory parameters, you may need to delete orphaned shared memory segments as described above.

List interprocess semaphores on Solaris 5.10

Solaris 5.10 (and later) has a different method for capturing the current number of semaphores:

  1. Run the following command:
prctl -n project.max-shm-ids $$

Example 3. Output

/export/home/fctech$ prctl -n project.max-shm-ids $$

process: 3636: -tcsh

NAME    PRIVILEGE       VALUE    FLAG   ACTION       RECIPIENT

project.max-shm-ids

        privileged        128       -   deny                 -

        system          16.8M     max   deny 
  1. Run the following command:
prctl -n process.max-sem-nsems $$

Example 4. Output

/export/home/fctech$ prctl -n process.max-sem-nsems $$

process: 3636: -tcsh

NAME    PRIVILEGE       VALUE    FLAG   ACTION       RECIPIENT

process.max-sem-nsems

        privileged        512       -   deny                 -

        system          32.8K     max   deny  

 

Specify shared memory keys on Unix

When more than one FairCom server was run on a Unix system, the shared memory keys used by different servers could have the same value, which prevented connections to the servers. In addition, it was possible for unrelated applications to collide with default keys generated by FairCom DB servers.

To address this key collision, it is now possible for an administrator to specify specific shared memory keys for ISAM and SQL shared memory communication protocols ensuring the keys do not match existing keys already in use on the system.

New FairCom server configuration options are available to directly specify a shared memory key.

Example 5. SQL and ISAM each require separate shared memory support

SHMEM_KEY_ISAM <isam_shared_memory_key>

SHMEM_KEY_SQL <sql_shared_memory_key>

Example 6. Shared memory key values can be specified in either decimal or hexadecimal format

; Set shared memory key for ISAM connections to the specified decimal value:

SHMEM_KEY_ISAM 12345

; Set shared memory key for ISAM connections to the specified hexadecimal value:

SHMEM_KEY_ISAM 0xabcd

These server configuration options support specifying an environment variable, whose value is substituted for the configuration option value when the server starts up.

Example 7. If the environment variable MY_ISAM_KEY is set to a numeric value such as 12345 or 0xabcdef before starting the server process, then the following option can be specified in the server configuration file to use this environment variable value for the SHMEM_KEY_ISAM configuration option value.

SHMEM_KEY_ISAM %MY_ISAM_KEY% 
Compatibility notes

When these configuration options are not used, FairCom server uses the old method of assigning shared memory keys so its shared memory communication protocol is compatible with old clients. FairCom server now writes the shared memory key to the shared memory resource file and new clients know to read the shared memory key from this file. If a new client finds no shared memory key in the file, it uses the old method to assign a shared memory key so it is compatible with an old server.

The shared memory resource file is named /tmp/ctreedbs/<server_name> for ISAM, and /tmp/ctreedbs/CTSQL_<sql_port> for SQL, where /tmp/ctreedbs is the default shared memory directory. It can be changed using the SHMEM_DIRECTORY configuration option.

An old client will not be able to connect to a new server using shared memory if the server uses the SHMEM_KEY_ISAM or SHMEM_KEY_SQL configuration option to specify a shared memory key that differs from the shared memory key that the old method would generate.

 

Message logged when shared memory fails to create semaphore or segment

On Unix systems, the FairCom server logs a message to CTSTATUS.FCS when it fails to create a system semaphore or shared memory segment due to a resource limit setting. This helps the server administrator understand the cause of the error.

Example 8. Example message

Fri Aug 22 15:14:44 2014

 - User# 00013  FSHAREMM: Failed to create system semaphore: check system semaphore limits such as SEMMNI

Fri Aug 22 15:14:44 2014

 - User# 00013  NewUser: Unable to create an instance of a named pipe

 

System group assignment of Unix/Linux shared memory resources

On Unix/Linux systems, a user can belong to more than one group of which one group is the primary group, and all other groups are secondary groups. When the SHMEM_PERMISSIONS option is used to only enable user and group permissions on shared memory resources, the resources created for shared memory connections (files, semaphores, shared memory regions) are assigned with the user's current primary group by default.

To address this situation, a new configuration option, SHMEM_GROUP, has been added preventing a user account that shares a secondary group with the user account under which the FairCom server process is running failing to connect using shared memory.

This option causes the FairCom server to assign group membership to the specified group. This option applies to the resources for both the ISAM and the SQL shared memory protocol.

Example 9. Group assignment example

As an example, consider two user accounts:

  • user1 - belongs to groups group1 and group2
  • user2 - belongs to group group2

If the user1 account runs the FairCom server with SHMEM_PERMISSIONS 660 in ctsrvr.cfg, a client program run by the user2 account will fail to connect using shared memory.

To allow the client program run by user2 to connect, add the following configuration option to ctsrvr.cfg and restart FairCom server:

SHMEM_GROUP group2

This causes the shared memory resources to be assigned to group group2, which allows the user2 client program to connect.

 

Unix shared memory protocol not freeing shared memory segments (different client and server user accounts)

When clients used the shared memory protocol on Unix systems and the client and server processes were run under different user accounts, shared memory segments could be left behind after the connections were closed. The ipcs -m listing showed shared memory segments with no processes attached. In V10.3 and later, the logic has been modified to correct this.

These changes add a field to the client and server logon data structures to pass the user ID between the client and server processes, resulting in the following compatibility considerations:

  • An old client can connect to a new server and it will behave as it did before these changes.
  • A new client cannot connect to an old server using shared memory. It will receive error 133 if the server is configured to only use shared memory. It will connect with TCP/IP if the server is using both shared memory and TCP/IP. The old server will log the following message to CTSTATUS.FCS:
FSHAREMM: The client's shared memory version (2) is not compatible with the server's shared memory version (1)
  • At startup, the FairCom server now logs messages to CTSTATUS.FCS to indicate the shared memory directory used for logon purposes and the shared memory protocol version that it is using:
FSHAREMM: SHMEM_DIRECTORY=/tmp/ctreedbs/
FSHAREMM: Protocol version=2 

 

Use of domain sockets for faster Unix/Linux shared memory connections

In release V11 and later, Unix and Linux FairCom DB servers use a Unix domain socket instead of named pipes for the initial shared memory protocol communication between the client and server (prior to this revision, all Unix and Linux systems except AIX used named pipes for the initial shared memory connection.)

The following

Shared memory protocol changes that were enacted:

  • Now FairCom server uses a Unix domain socket instead of a pair of named pipes for the initial communication when a client connects to the server. FairCom server still creates the named pipes, and when a client connects, the server waits for the client to write to either the socket or the named pipe. In this way, the server is able to support both clients that use the new method and those that use the original method.
  • The COMPATIBILITY SHMEM_PIPE configuration option has been deprecated and no longer has any effect.
  • FairCom DB clients (both ISAM and SQL) now use the Unix domain socket method when connecting using the shared memory protocol if the server indicates that it supports it. If not, the clients use the original method.
  • A FairCom DB client library can be compiled with #define NO_ctFeatUNIX_SHMEMsocket to force the client to use the original method only.
 
 

MacOS

System requirements

  • Operational environment
  • Minimum hardware requirements for Macintosh

Installation

  • FairCom DB v10 and earlier installation
  • Configuring Mac systems

 

Operational environment

This version of the FairCom server is designed specifically to work on the Apple Mac OS X platform. Both the SQL and ISAM servers run as a FBA (faceless background application) launched via the terminal. Applications using this release communicate via the TCP/IP protocol. Mac client processes can execute on the same machine as the FairCom server for Mac.

The FairCom server for Mac contains the FairCom server executable, ctreeace or ctsrvr, and the utility and companion programs discussed throughout this guide.

 

Minimum hardware requirements for Macintosh

The minimum memory requirements are:

  • 4MB RAM for up to 8 users
  • 8MB for more than 8 users
  • Mac OS X 10.10 or later

Legacy OS versions, PPC, and Universal Binary builds may be available upon request.

The minimum hard drive space required by the FairCom Server for Mac is 500 MB + the size of the data (.dat) and index (.idx) files.

 

FairCom DB v10 and earlier installation

To install the FairCom server for Mac on your platform, follow these steps:

  1. Make the desired directory (where the FairCom server is to be installed) the current directory.
  2. Copy the files in the /bin/ace/ (isam or sql) directory to your desired directory.
  3. Ensure you have an appropriate license authorization file for your platform and FairCom DB configuration.
    1. Your application vendor may provide applicable FairCom DB license files.
  1. For versions of FairCom server prior to V10.0, activate the FairCom server using the fcactvat program, after installation. See the FairCom server activation key card for instructions.
    1. Some FairCom server OEM vendors provide pre-activated FairCom server with their applications.
 
 

Other Operating Systems

Hewlett Packard HP-UX

The HP-UX 11 operating system, and above, supports standard FairCom DB files up to 4 GB in size and allows huge files. Earlier versions support 2GB file sizes and requires segmented files to support larger files.

For proper operations of the FairCom server under various loads, FairCom recommends adjusting the following kernel parameters of the HP/UX 11 system, using the sam utility:

  • Increase maximum per-process stack memory size (maxssiz) from the default of 8 MB to 128 MB.
  • Increase maximum per-process data memory size (maxdsiz) from the default of 64 MB to 256 MB.
  • Consider increasing the number of threads per process if connecting a large number of clients. The default for older releases of the OS is relatively low (64 maximum threads per process).
  • Either increase the default number of file handles from 60 to 256 by using sam or, prior to starting the FairCom DB SQL process, issue limit descriptors 256 to increase the number of file descriptors used by that process only.

 

Native threads

FairCom has enjoyed multi-threaded support from nearly our inception and has extensive engineering experience in supporting various threading architectures that have appeared through the years. POSIX pthread support is considered the industry standard in recent times, and we highly encourage taking advantage of this support when at all possible. By default, all FairCom DB servers include pthread support when available on a chosen platform.

For platforms not supporting a native threading technology, FairCom supports a proprietary threading library. FairCom recommends native thread support when available as performance enhancements are typical.

The Native Thread server supports only the TCP/IP communications protocol.

 

IBM AIX

The FairCom server for IBM AIX requires a minimum of 500 MB RAM. FairCom DB V11* supports AIX 6.1 and newer. Earlier versions of AIX may also be available. Contact FairCom for availability for AIX versions prior to V6.

 

Solaris - SPARC and Intel

The FairCom server supports Solaris Version 2.10 and newer and both the SPARC and X86/X64 based CPU. Earlier versions of Solaris may also be available. Contact FairCom for availability for Solaris versions prior to 2.10.

 

Cross-platform compatibility

Big-endian and little-endian compatibility

The FairCom server automatically allows big-endian and little-endian machines to share data across the same network. The FairCom term for this type of logic is Netformat.

Netformat logic automatically controls all aspects of data byte ordering (big-endian/little-endian). The server process defines the ordering of the data (High/Low as big-endian or Low/High as little-endian) while the client process dictates the alignment of the file.

Example 10. Netformat logic scenario

To further illustrate the power of the Netformat logic, review the following network scenario:

  • Server: c-tree IBM POWER 7 TCP/IP Server running AIX
  • Clients: Intel-based Windows word-aligned client application.

All data files will be stored in a High/Low (most significant byte, big-endian) format used by the IBM POWER 7 CPU. Files created by the Intel Windows application will be word-aligned (the default with Microsoft Visual Studio compiler). The applications will all be able to share the same files (assuming the application developer has aligned all numeric fields on at least a 2-byte boundary for this example — a good C programming practice).

 
 

 

Hardware

  • Minimum hardware requirements:
    • 1 GHz CPU
    • 1 GB RAM
    • 2 GB Disk space
      • This space is required to install the server, transaction logs, data files, index files, web applications, command line utilities, tutorials, and plugins.
      • After installation, you can reduce this space by about 300 MB by removing unused web applications, command line utilities, tutorials, and plugins. Contact FairCom customer support for a version that uses 120 MB or less.
  • Recommended hardware requirements:
    • 2 GHz CPU
    • 8 GB RAM
    • 2 GB Disk space + additional space for data and indexes as needed
  • Support for large enterprise hardware:
    • Unlimited number of CPUs with many cores
    • Terabytes of RAM
    • Petabytes of storage

 

Minimum hardware requirements

The minimum hard drive space required by the FairCom server for Unix is:

  • The size of the FairCom server executable
  • + the amount specified by the LOG_SPACE keyword (10 MB default)
  • + 1MB for the FairCom server status logs
  • + size of pre-compiled FairCom utilities
  • + the size of the data (.dat) and index (.idx) files

The minimum memory requirements for operating the FairCom server for all Unix systems are:

  • FairCom DB SQL server: 1 GB RAM
  • FairCom DB server: 300 MB RAM

Additional memory will be needed for additional users beyond 16 concurrent users and larger data and index caches. Cache sizes larger than 2GB require a 64-bit version of the OS and a 64-bit version of the FairCom server.

It is possible to reduce the memory requirements below these recommended settings. For details, please contact FairCom.

 

Supported languages and IDEs

C and C++

FairCom's drivers and APIs support C and C++.

 

Java

FairCom DB supports Java on any platform that the Java environment is currently available, including Windows, AIX, Oracle Sun, and Linux.

  • FairCom’s JSON APIs work on all Java versions because they send and receive JSON over HTTP and HTTPS.
  • MQTT works on Java versions 1.8 and later, see FairCom’s MQTT tutorial for Java.
  • SQL Stored Procedures, Triggers, and User-Defined Functions can be written in Java. They require the Java 1.7 JDK and JRE environment or newer.
  • JDBC supports Java 1.6 or newer.
  • FairCom’s c-treeDB API for Java requires Java 1.6 or newer.
    • The Java installer does not install MSVCR100.DLL. You can install the Visual C++ 2010 Redistributable package to install MSVCR100.DLL.
    • Be sure to install the 64-bit or 32-bit version of the Visual C++ 2010 Redistributable package to match the 32-bit or 64-bit version of your Java SDK installation.

Contact FairCom for the latest Java compatibility announcements and availability of the latest Java support.

 

JavaScript

FairCom supports the JavaScript language running in web browsers, Node.js, and Deno.

FairCom also embeds Google's V8 JavaScript engine in the server for running server-side JavaScript code.

 

JetBrains IDEs

FairCom supports the following JetBrains IDEs:

  • IntelliJ IDEA
  • PyCharm
  • WebStorm

 

Microsoft Visual Studio

FairCom supports the following versions of Microsoft Visual Studio:

  • VS 2022
  • VS 2019
  • VS 2017
  • VS 2015
  • Prior Visual Studio versions may be available by contacting FairCom.

 

Microsoft Visual Studio Code

FairCom supports Python and JavaScript in Visual Studio Code.

 

.NET

FairCom's drivers and APIs support the .NET languages: C# and Visual Basic.

SQL Stored Procedures, triggers, and user-defined functions can be written in C# and VB. They require Microsoft .NET Framework 4 or newer.

 

PHP

FairCom's drivers and APIs support PHP 5 and later.

 

Python

FairCom's drivers and APIs support Python version 3.10 and later.

 

SQL

FairCom's drivers and APIs support SQL, ODBC, JDBC, Java Hibernate, ADO.Net, Microsoft Entity Framework, Python SQL Alchemy, and PHP PDO.

Through FairCom's RESTful JSON DB API, you can run SQL statements from any programming language.

 

Download

  1. Go to the FairCom website.
  2. Click the Download Products button.
  3. Scroll to the FairCom DB product and click Download FairCom DB
  4. Fill in the subsequent form then click the Download DB button.
  5. Select the product package for the desired operating system.

Note: Contact FairCom for downloads that run on other operating systems that are not listed.

A compressed file containing the product will be downloaded to your default "Downloads" folder.

Important: The evaluation version of the product times out after three hours and shuts down the server. Therefore, the server needs to be restarted every three hours.

 

FairCom Folder

After downloading the FairCom product package, it is important to locate the FairCom root folder (<faircom>).

The <faircom> folder for each FairCom product contains all the files it uses. Our documentation regularly refers to this folder, and you must know where to find it to run and configure the server and its command-line utilities.

By default, the <faircom> folder has a long name that includes the product name, operating system, 64-bit or 32-bit platform, and a four-part version number, such as FairCom-Edge.windows.64bit.v4.2.0.173.

We advise creating a dedicated FairCom installation directory for its products since all FairCom products operate using the permissions associated with this directory. Examples include C:\FairCom (Windows), /user/FairCom (Linux), or /documents/FairCom (MacOS).

You can have multiple FairCom products and versions installed in the same FairCom directory, such as C:\FairCom\FairCom-Edge.windows.64bit.v4.2.0.173\ and C:\FairCom\FairCom-DB.windows.64bit.v13.0.1.42\.

 

Inside the <faircom> folder

Inside the <faircom> folder are all files used by the FairCom server.

  • Start the server by running faircom.exe in the server subfolder.
  • Configure the server using ctsrvr.cfg and services.json in the config subfolder.
  • Run tutorials located in the drivers folder.
  • Run command-line utilities in the tools folder.
  • Back up the data files stored in the data folder and the transaction logs in the tranlogs folder.

 

FairCom folders

When you install the FairCom server, its root folder is placed in the folder of your choice. This <faircom> folder name includes the product name followed by the operating system and the exact version. The version corresponds to the underlying core engine that powers the FairCom server. It follows the pattern, Major, Minor, Patch, and Build.

The following folders are in the <faircom> folder.

Table 1. FairCom product root folder structure and contents
Folder Description
/build_sdk A software development kit for C programmers. It is only available in FairCom's professional package.
/config

Server startup configuration files. The following list shows which files configure which settings.

Ports and protocols services.json
Database server ctsrvr.cfg
Database replication ctagent.json
ISAM Explorer application ctIsamExplorer.cfg
Database Monitor application ctMonitor.cfg
Data Explorer application ctSQLExplorer.cfg
ThingWorx connector ctthingworx.json
Timestamp configuration cttimestamp.json
/data Data, and index files.
/drivers

Tutorials and drivers for many programming languages. 

 
/server FairCom software executables.
/tools Command-line utilities for managing the server.
/tranlogs Transaction log files.

 

Config folder

The config folder contains configuration files that you modify to change the behavior of the FairCom server. These configuration files are referenced throughout this document.

 

Data folder

The data folder contains log files and one folder for each database that you create. Your data and index files are in these database folders.

The image below shows two database folders:
  • ctreeSQL.dbs
  • testdata

By default, FairCom products ship with a single database named ctreeSQL. Use that name in any of the APIs that ask you to enter the name of your database.

The sql_server.log file contains JSON log entries for each SQL operation you perform. This is useful for troubleshooting SQL. You can turn on logging to this file by placing the SQL_DEBUG LOG_STMT_TIMES_FETCH command in the ctsrvr.cfg file.

FairCom system files (*.fcs) are also kept here. Most are transaction log files used to record that all data sent to the FairCom database engine is durably captured on disk.

The following FCS files contain useful troubleshooting information:

  • ctstatus.fcs contains a history of critical events, such as starts and stops of the FairCom server.
  • snapshot.fcs contains a snapshot of the FairCom server when it shuts down.

 

Drivers folder

The directory structure for the drivers folder may differ depending on your platform.

This drivers folder contains a sub-folder for each programming language, API, and connector that FairCom supports, plus one special folder named c-tree.drivers . The sub-folders are organized by language and API. Inside each sub-folder are tutorials, drivers, connectors and a ReadMe file that walks you through running the tutorials, to get you started in only a few minutes.

The c-tree.drivers sub-folder is a general-purpose folder that contains the components needed by each programming language to run, link, and compile the code in the other drivers sub-folders.

 

Server folder

The server executable file (faircom.exe ) is in the server directory.

The other files and folders in this directory are to facilitate specific features and operations.

 

Tools folder

The tools folder contains command‑line utilities you can use to manage your database.

 

Install

Windows

You can install FairCom from a Windows Installer file (.msi) or from a compressed file (.zip). This section explains how to use the Windows installer. It automatically starts FairCom as a Windows service.

This installation process takes approximately five minutes, depending on the download speed of your Internet connection.

Note: If you want to install from a .zip file and (optionally) manually configure FairCom as a service, see Use the zip file.

Microsoft Windows supports background processes known as services. Services may be configured to start automatically at system startup or to be started manually by a user. They have no user interface and can continue to run even when no users are logged on to the system. Windows automatically terminates services at system shutdown, or a user can manually terminate them.

 

Use Windows Installer

  1. Download the FairCom server as a .msi file.
  2. Run the downloaded .msi file.
  3. When the Setup window appears, click Next.
  4. After reading the license agreement select I accept the terms in the License Agreement and click Next.
  5. In the Select Installation Folder window, select the installation location and click Next.
    1. The software can be installed in any folder with at least 600 MB of disk space. The default and recommended location is the C: drive in the FairCom folder.
  1. Click Install to install the FairCom server.
  2. Click Yes when Windows asks permission to install the server.
  3. Observe the progress of the installation in the Setup Wizard.
    1. Installation typically takes about one minute.
  1. When the installation is complete in the Setup window, select the View readme file checkbox and click Finish.
    1. Selecting the View readme file checkbox will cause the readme file to open in a web browser after clicking Finish.
  1. View the opened readme file.

 

Access the UI browser apps

Make sure the FairCom server is installed and running before attempting to access these FairCom browser-based graphical user interface apps.

  1. Open FairCom's browser-based service in a Chrome-based web browser. If the FairCom server is not configured with a security certificate, the following is displayed:

Note: You must use https in the URL because FairCom products require the secure HTTPS protocol. For more information, see Enable HTTP on port 8080 and Manage certificate warnings

  1. If you see the warning, click the Advanced button, then click the Proceed to localhost (unsafe) link to access FairCom's browser apps. The FairCom browser apps menu will appear, so you can use the apps to manage the server.
     

Manage a FairCom server as a Windows service

Configure a FairCom server as a Windows Service using FairCom's setup.bat file.

Use the Windows Services Manager to start or stop a FairCom server that is configured as a Windows service.

 

Configure FairCom to run as a Windows service

  1. In Windows Explorer, navigate to the <faircom> installation folder.
  2. Run the setup.bat file to open the FairCom Setup window.
    1. The setup.bat file runs the <faircom>/tools/Setup/FairComConfig.exe file in a console window, which you will need to close later.
  1. Optionally, change the FairCom Installation Directory to the location of the product you want to configure.
  2. Select the desired checkboxes under Select features to install or configure.
    1. For information on features to install or uninstall, see Configure installed features using FairComConfig.exe.
  1. Click Configure. A Setup process completed successfully... message is displayed.
    1. If the configuration was unsuccessful, contact FairCom support.
  1. Click OK.

 

Run the Windows Services manager

  1. Open the Windows Start menu.
  2. Search by typing services.
  3. Press Enter. The Windows Services manager window opens

 

Use Windows Services Manager to start or stop a FairCom Windows Service

  1. In the Windows Services Manager, locate and double-click the FairCom service in the list of services.
  2. In the Service Properties window, click Start to start the service or Stop to stop it.
  3. Click OK or Apply.
    1. For more information on starting the FairCom server, see Start the FairCom server.
    2. If you stop the service, the FairCom server stops running, but is still registered as a Windows Service.

 

Specify when Windows will run a FairCom server as a service

  1. In the Windows Services Manager, locate and double-click the FairCom service in the list of services.
  2. In the General tab of the Properties window, make a selection from the Startup type: dropdown menu.
    • Automatic (Delayed Start)
      Windows runs the FairCom service automatically at startup with a delay.
    • Automatic
      Windows runs the FairCom service automatically at startup.
    • Manual
      Windows does not run the FairCom service automatically. You must manually use the Windows Services Manager to start or stop a FairCom Windows Service
    • Disabled
      Windows prevents the FairCom service from running.
  3. Click OK or Apply.

 

Remove FairCom as a Windows service

  1. In Windows Explorer, navigate to the FairCom installation folder.
  2. Run the setup.bat file to open the FairCom Server Setup window.
  3. Optionally, change the FairCom Installation Directory to the location of the product you want to remove.
  4. Click Remove. A Removal process completed successfully... message displays.
    1. If removal was unsuccessful, contact FairCom support.
  1. Click OK.
    1. FairCom is still installed on your system. To uninstall, see Uninstall the server.

 

Uninstall the FairCom server

If you have installed the FairCom server using the Microsoft Installer, you can uninstall it using the Windows built-in Uninstaller.

Note: To uninstall a FairCom product that you copied from a zip file, simply delete the folder that contains the version of the FairCom product.

  1. Open the Windows Start menu.
  2. Search Add or remove programs.
  3. Under Apps & features, in the textbox, search for faircom.
  4. Click Uninstall for the FairCom app.

Note: The uninstaller removes the server but leaves the data files you created. If you no longer need the data, you can manually delete the contents of the FairCom folder.

 
 

Linux 

  1. Download the .tar file and move it to a directory where your current user account has full permissions.
    1. It is common to move the .tar file to the user folder — for example, if the .tar file is named FairCom-Edge.linux.x64.64bit.v4.5.1.170.230227.tar.gz the mv FairCom-Edge.linux.x64.64bit.v4.5.1.170.230227.tar.gz ~/user command will move it to the user directory.
  1. Use the tar command to expand the .tar file to create a new subdirectory that contains the FairCom server — for example, if the .tar file is named FairCom-Edge.linux.x64.64bit.v4.5.1.170.230227.tar.gz the tar -xvzf FairCom-Edge.linux.x64.64bit.v4.5.1.170.230227.tar.gz command will expand it.
    1. The subdirectory has a long name that includes the product name, target operating system, and the server version — for example, FairCom-Edge.linux.64bit.v4.5.1.145.
  1. Run the cd command followed by the name of the subdirectory to change the active directory to the newly installed subdirectory — for example, if the subdirectory is named FairCom-Edge.linux.64bit.v4.5.1.145 the cd FairCom-Edge.linux.64bit.v4.5.1.145 command will change the active directory to the subdirectory.
  2. Some Linux variants, including Ubuntu and CentOS, require the installation of a compression library for the FairCom server to launch correctly. Use the following commands to install the needed libraries:
    1. Ubuntu
      1. sudo apt install zlib1g-dev
    2. CentOS
      1. sudo yum install zlib-devel
  3. Type ./faircom and Enter to temporarily start the server and run it in the current terminal session.
    1. You can stop the server by closing the terminal session.
  4. Type ./startserver and Enter to start the server in the background and keep it running even when you close the terminal session.
  5. To stop the server:
  • Open a new terminal session.
  • Use the cd command to change the active directory to the server subdirectory.
  • Type ./stopserver and Enter.

 

Run the server in production

 

Run multiple instances

You can run multiple instances of FairCom on the same computer by configuring them to use different ports.

Note: Attempting to run a second instance of FairCom with the same ports as a running instance will cause the second instance to exit with errors

 

Check for running instances of FairCom

  1. Run the command: ps -ef | grep faircom.
  2. Observe the response.
    • Two lines of code indicate there is a FairCom server running.
    • One line of code indicates there is no FairCom server running.
 
 

MacOS 

  1. Download the .tar file (FairCom-Edge.osx.v<version>.<processor>.tar) and move it to the Documents folder using the Finder app.
  2. Open the Terminal app in the Documents folder.
    1. In the Finder window path bar, Control-click the Documents folder.
    2. Select Open in Terminal from the shortcut menu.
  3. Use the tar command or double-click the .tar file to expand it to create a new subdirectory that contains the FairCom server — for example, if the .tar file is named FairCom-Edge.linux.x64.64bit.v4.5.1.170.230227.tar.gz the tar -xvzf FairCom-Edge.linux.x64.64bit.v4.5.1.170.230227.tar.gz command will expand it.
    1. The subdirectory has a long name that includes the product name, target operating system, and the server version — for example, FairCom-Edge.linux.64bit.v4.5.1.145
  1. Run the cd command to change the active directory to the Home folder within the Contents folder — for example, FairCom-Edge.OSX.<processor>.<version>/Contents/Home.
  2. Type ./faircom and Enter to start the server and run it in the current terminal session.
    1. You can stop the server by closing the terminal session.
  1. Type ./startserver and Enter to start the server in the background and keep it running even when you close the terminal session.
  2. To stop the server:
    1. Open a new terminal session.
    2. Use the cd command to change the active directory to the server subdirectory.
    3. Type ./stopserver and Enter.

 

Run the server in production

  • FairCom recommends using the systemd command.
  • See also, Script to start and stop the server.

 

Run multiple instances

You can run multiple instances of FairCom on the same computer by configuring them to use different ports.

Note: Attempting to run a second instance of FairCom with the same ports as a running instance will cause the second instance to exit with errors.

 

Check for running instances of FairCom

  1. Run the command: -ef | grep faircom.
  2. Observe the response.
    1. Two lines of code indicate there is a FairCom server running.
    2. One line of code indicates there is no FairCom server running.
  3. Alternatively, run the Activity Monitor application and search for faircom.
 
 

 

Install into production

Establishing secure connections is necessary to maintain safe communications among FairCom servers and data collection devices. The following process for establishing TLS connections is recommended when deploying FairCom servers.

 

Security

  1. Create a valid certificate for each FairCom Edge server.
  2. Configure the certificate for HTTPS connections only.
  3. Turn on file encryption.
  4. Change the ADMIN password to a secure password.
  5. Add additional user accounts for applications and end users.

Note: Do not allow application and end-user accounts to have admin access or to know the ADMIN password. Ensure each account has a secure password

 

Configuration settings

  1. Update the settings in the ctsrvr.cfg file to fit production needs.
    1. Increase the default topic settings for FairCom Edge and FairCom MQ. There needs to be 62*number of expected topics. If the persistence settings were changed it will be (retentionPeriod+1)*2.
  1. Verify that the system files limit is at least as high as the FILES settings from Step 1.
  2. Increase the DAT_MEMORY and IDX_MEMORY settings to allow caching as much of the data you expect to access as possible.
    1. Keep this within the footprint of the physical RAM the hardware has available.
  1. Store the data, index, and tranlog folders on fast local SSD storage.
    1. Using a shared or network volume to store these files will dramatically slow down performance.

 

Start or stop the FairCom server

To start the FairCom server on any platform:

  1. Navigate to the<faircom>/server folder.
  2. Run faircom.exe (or faircom on Linux (Unix) or MacOS).

 

To stop the FairCom server on any platform:

In the <faircom>/tools folder, run the command line ctstop -AUTO to immediately shut down the FairCom server.

Windows

Start

Manually start the FairCom server on Windows

If the FairCom server is not configured to run as a Windows service, there are multiple ways to start and stop it and to detect if it is currently running.

  1. The FairCom server opens and runs the Control Window. Observe the name of your FairCom server at the top of this window.
  2. To start the FairCom server, double-click on the server executable in Windows Explorer: <faircom>\server\faircom.exe.

When the FairCom server is running manually (not as a service), an icon is displayed in the Windows taskbar. Double-clicking this icon brings up the FairCom console window.

  1. The FairCom console window provides troubleshooting information about the FairCom server.

When connecting through a network, be aware that the local firewall may block the TCP/IP port used to communicate with the FairCom server. If you cannot connect to a running instance of the FairCom server, a firewall could be blocking communication. If so, you may need to unblock the FairCom server port, which defaults to 6597. For more details, see Configure ports and services.

This window provides these menu options to shut down the FairCom server:

If you close this window, the FairCom server continues to run and the window is minimized to the taskbar.

  1. Open the Message Monitor window.
  2. Open the Function Monitor window.

 

Message Monitor window

The message window shows console messages.

The startup messages tell you information such as TCP/IP ports for applications to communicate with the FairCom server, license information such as the maximum allowed connections, and notice if the server is in DEMO mode, which shuts down automatically every three hours.

 

Function Monitor window

The function monitor (View > Function Monitor Window) is for basic troubleshooting. It displays a message each time an application calls a FairCom function.

When the Function Monitor window is open, it significantly slows down the performance of the FairCom server so it can show you each function an application calls.

 

Start the FairCom server from the Windows command-line

  1. To run the FairCom server in the console tray without displaying the Control Window, find the TOOL_TRAY keyword in the ctsrvr.cfg file and disable it by putting a semicolon at the beginning of the line.
    ;CONSOLE TOOL_TRAY
  2. Run the FairCom server from the command line.
    C:\server> faircom ^&
  3. Observe that the FairCom server is running in the tool tray without displaying the user interface.

It is a best practice for production deployments on Windows to run the FairCom server as a Windows Service. This ensures Windows keeps it running, and it allows administrators to easily manage the service remotely.

 

Start the FairCom server as a Windows service

Start the FairCom server as a service using either the Microsoft sc.exe command or the Windows Services Control Panel applet.

  1. Open the Control Panel.
  2. Select the Services applet.
  3. Select the name of the FairCom service from the list of installed services.
  4. Click Start to start the service.

Installing the FairCom server using the Windows Installer automatically makes it available to run as a Windows service. However, if you installed it by unzipping it into a folder, you will need to manually configure the FairCom server to run as a service.

 

Tool tray interface

When the server configuration file contains the CONSOLE TOOL_TRAY keyword, the FairCom server starts in the background, displaying only a FairCom DB icon in the Windows tool tray. This feature is especially nice for simple user sites, with no system administrative expert. Although more sophisticated sites will prefer running the FairCom server as a service, this feature gives a similar service-like background effect, without the user needing to learn Windows service administration.

  1. Navigate to and open the ctsrvr.cfg file.
  2. Add the keyword CONSOLE TOOL_TRAY.

This keyword is not supported when the server is running as a service.

 

Example 2. Launch the server in background-tool-tray mode

The FairCom server for Windows accepts the & symbol, or the ^& for Windows server, as a command line parameter to execute in CONSOLE TOOL_TRAY mode.

C:\server>  ctreeace &

or

C:\server>  ctsrvr &

 

Stop

If replication is running, it is advisable to stop replication before stopping the server. If replication is running, you may see error 792 (External server shutdown disabled), although replication should be able to handle an unexpected server shutdown.

  1. Windows service
    If the FairCom server is configured to run as a service on your machine, you can stop the service using the Windows Service Administrator or by issuing the net stop... command in a Command Prompt window.
  2.  Windows taskbar
    If the FairCom server was launched manually, a FairCom icon () appears in your taskbar. Right-click on the icon and select the appropriate shutdown option.
    This approach is normally used in demonstrations and some development environments. In production environments, the FairCom server runs as a Windows service.
  3. FairCom console
    Exit the console application via the menu or the standard Windows "X" in the corner. If the FairCom server was launched manually, the console window can be displayed by double-clicking on the tool tray icon. Use the console window’s Control menu to shut down the database engine.
    This approach is normally used in demonstrations and some development environments. In production environments, the FairCom server runs as a Windows service.
  4. ctadmn
    The ctadmn command-line utility provides an option to shut down the server. It works both when the server is running as a service and when it’s been launched manually. This tool only runs when supplied with an administrator username and password.
  5. ctstop
    The stop utility can be used to shut down the server from the command line or in a batch file. It can be used when the server is running as a service and when it’s been launched manually. This tool only runs when supplied with an administrator username and password.

 

Stop the FairCom Windows service

The FairCom service can be stopped by using either the Microsoft sc.exe command or the Windows Services Control Panel applet, or the net stop command.

  • The service stops automatically when Windows signals the operating system itself is shutting down. A clean shutdown of Windows should result in a clean shutdown of the faircom server. However, since Windows only allows a 20 second delay for service shutdown, FairCom recommends all files be maintained under transaction processing to allow automatic recovery if cache cannot be safely flushed to prevent data corruption. The default 20-second delay can be adjusted using the WaitToKillServiceTimeout registry key, found in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\, when present.
  • Windows Vista and later allow a new Service PRESHUTDOWN notification, which gives the service extra time to complete its shutdown. This can help to avoid a lengthy auto-recovery if the server has too many cache pages to flush within the SHUTDOWN limit.

See Start for information about scripting the startup and shutdown operations on Linux.

Stop the FairCom service from the Windows command line

Table 1. Stop a service

Service Command
FairCom DB sc stop FairCom-DB
FairCom EDGE sc stop FairCom-EDGE
c-treeRTG sc stop ctreeRTG
 
 
 
 
 
 
 
 

Linux

Start

Start the FairCom server on Linux, Raspbian, and Unix

The FairCom server operates as a typical program on all supported Unix/Linux platforms. In these environments, FairCom recommends Administrators run the FairCom server in the background to decrease the chance of unwittingly terminating it — for example, # faircom &.

The no-hang-up option may also be used to keep the FairCom server from being terminated if the user starting the FairCom server logs off the system — for example, # nohup faircom &.

 

Script to start and stop the server

On Unix/Linux systems, a script can start and stop the FairCom server. The script can be used to integrate the FairCom server as a startup service in systems where SystemD manages the startup service. Some of the most recent Linux distributions using SystemD include RedHat 7, CentOS 7, Fedora, and Raspbian.

If the script is placed in the correct directory (such as /lib/systemd/system on CentOS 7), the systemctl system tool can be used to manage FairCom as a system service — for example, to enable the ctree.service at startup, use the systemctl enable ctree.service command.

Because the Unix/Linux packages are distributed as .tar.gz archives, the location of the extracted files cannot be controlled. Therefore, Example 1, “Script to start and stop the server” may need to be edited to match the paths used on your system.

In Example 1, “Script to start and stop the server”,

  • Because the systemd tool must launch the service as root, uncomment the line
    A User= keyword may be used to start the service as a specified user:
  • Uncomment the #User=myuser line.
  • Change myuser to the desired user name to start the service as a different user.
    • The ctstop -auto command works ONLY if the default credentials are set. If you have changed these credentials, you would need to use the ctstop syntax to include the user ID and password in the script.
    • Including a password in the script is against security policy in most production environments.

Example 1. Script to start and stop the server

This sample script, called ctree.service, is an example of how to implement such a script.

[Unit]

Description=ctree database

After=multi-user.target network.target

[Service]

#Uncomment the next line if you want to start the service as a different use than "root"

#User=myuser

Environment=LD_LIBRARY_PATH=/opt/FairCom/linux.v2.6.x86.32bit/bin/ace/sql

WorkingDirectory=/opt/FairCom/linux.v2.6.x86.32bit/bin/ace/sql

ExecStart=/opt/FairCom/linux.v2.6.x86.32bit/bin/ace/sql/ctreesql

ExecStop=/opt/FairCom/linux.v2.6.x86.32bit/tools/cmdline/admin/client/ctstop -auto

Restart=on-abort

[Install]

WantedBy=multi-user.target

 

Stop

Linux, and MacOS users can use the included stop scripts to initiate a server shutdown. The script is in <faircom>/server/stopserver.

This script is provided as a "C" shell script and will work in most Linux shell environments. You are free to modify and tailor it to suit your local requirements.

These scripts must be run from the folder that contains them.

Other ways of stopping the FairCom server include:
  • ctadmn
    The ctadmn utility provides an option to shut down the server. Only administrator users can run it.
  • <faircom>\tools\ctstop.exe
    The ctstop utility can shut down the server. Only administrator users can run it.
  • The kill command
    An alternative way to stop the FairCom server is with the kill command. This command can be used in scripts if you include COMPATIBILITY TERMINATE_ON_SIGNAL in ctsrvr.cfg. The FairCom database engine traps the SIGSTOP signal.
    1. Use the ps command to find a process with faircom or ctree in the results.
    2. Kill any process that contains either faircom or ctree in the name.
ps -e | grep faircom

If the FairCom server process is running, you will see it (see, Example 4, “Stop a script”).

Older versions of the FairCom products called the process "ctreesql" or "ctreeedge".

Example 4. Stop a script

Use "kill 7288" in this example.

7288 pts/0 00:00:06 faircom
#kill <faircom PID>
 
 

MacOS

Stop

Linux, and MacOS users can use the included stop scripts to initiate a server shutdown. The script is in <faircom>/server/stopserver.

This script is provided as a "C" shell script and will work in most Linux shell environments. You are free to modify and tailor it to suit your local requirements.

These scripts must be run from the folder that contains them.

Other ways of stopping the FairCom server include:
  • ctadmn
    The ctadmn utility provides an option to shut down the server. Only administrator users can run it.
  • <faircom>\tools\ctstop.exe
    The ctstop utility can shut down the server. Only administrator users can run it.
  • The kill command
    An alternative way to stop the FairCom server is with the kill command. This command can be used in scripts if you include COMPATIBILITY TERMINATE_ON_SIGNAL in ctsrvr.cfg. The FairCom database engine traps the SIGSTOP signal.
    1. Use the ps command to find a process with faircom or ctree in the results.
    2. Kill any process that contains either faircom or ctree in the name.
ps -e | grep faircom

If the FairCom server process is running, you will see it (see, Example 4, “Stop a script”).

Older versions of the FairCom products called the process "ctreesql" or "ctreeedge".

Example 4. Stop a script

Use "kill 7288" in this example.

7288 pts/0 00:00:06 faircom
#kill <faircom PID>
 
 

 

Configure

Change the admin password

The ADMIN user and members of the ADMIN group have full control over all operations in the FairCom server. They are also the only users who can stop the server.

Note: Changing the ADMIN password on all servers is critical to secure your data from malicious attackers.

  • The default administrator user ID is admin.
    • FairCom user IDs are NOT case-sensitive.
  • The default password is ADMIN
    • FairCom passwords ARE case-sensitive.

 

Use sa_admin to change a password

The <faircom>/tools/sa_admin.exe file is a command-line interface (CLI) program designed to be embedded into scripts. It changes a user password using command line parameters.

The following example changes the admin user password to NewPassword:

sa_admin -aADMIN -pADMIN -f"" -sFAIRCOMS -oup admin NewPassword
  • The -a parameter specifies the current value of the admin username, which is ADMIN unless you previously changed it.
  • The -p parameter specifies the current value of he admin user password, which initially is ADMIN.
  • The -f parameter is the file password, which is typically "".
  • The -s parameter is the connection name of the FairCom database, which is "FAIRCOMS" unless you previously changed it.
  • The -oup parameter tells the program to change the password.

 

Use ctadmn to change a password

The <faircom>/tools/ctadmn.exe file is an interactive tool you run from the command line, such as the DOS command prompt or the Linux BASH shell. It prompts you for information to change a user password.

This example authenticates the admin user as an authorized administrator, then changes the admin user password.

  1. Open a command prompt.
  2. Move to the <faircom>/tools folder.
  3. Run ctadmn.
  4. When prompted, enter admin for the user ID and press ENTER.
  5. Enter ADMIN for the password and press ENTER.
    (By default, FairCom products set the admin password to ADMIN, which is all uppercase characters.)
  6. Press ENTER for the next two prompts unless you have changed the File Password or Server Name.
  7. Press 1 and ENTER to open the User Operations menu.
  8. Press 4 and ENTER to change a user password.
  9. When prompted, enter admin for the User ID and press ENTER.
  10. Enter a new password and press ENTER.
  11. Enter the same new password again and press ENTER.
  12. Press ENTER.
  13. To quit
    • Press q then ENTER
    • Press q then ENTER again.

 

Docker or Podman

There are two ways to use the FairCom products inside a Docker container:

  • Use the gzipped image provided by FairCom
    or
  • Create a Docker image out of a regular package.

 A Docker image can be created using the script provided by FairCom or by manually defining your own Docker image.

To install FairCom products into a Docker or Podman container, expand the FairCom product gzipped tarball on Linux systems or a .zip file on Windows into the container.

The following examples center on Docker. However, Docker and Podman commands are interchangeable by simply replacing references to "docker" with "podman". For example, the following command stops a Docker container:

docker container stop edge

And the following command stops a Podman container: 

podman container stop edge

All the Docker commands in this document assume the user has enough permissions to run the Docker commands.

If you need assistance configuring your users and groups correctly to run Docker, see the Docker online documentation.

 

Use the provided image

FairCom provides a Docker image containing the essentials to run the server. This image uses the following naming convention:

FairCom-DB.linux.x64.64bit.v4.1.3.71.240201.DockerImage.tar.gz
FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.DockerImage.tar.gz
FairCom-RTG.linux.x64.64bit.v4.1.3.71.240201.DockerImage.tar.gz

In order to add the provided image to your host repository, you can use the Docker load command. 

docker load < FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.DockerImage.tar.gz

The FairCom-provided image uses the FairCom product version as the product tag. Optionally, you can tag the imported image with the “latest” tag in order to avoid specifying the entire version tag every time you invoke the image.

docker tag faircomedge:v4.1.3.71 faircomedge:latest

 

Create an image

When using Docker or Podman containers, some users desire to create their own containers from scratch. This section provides a few tips and best practices to create Docker or Podman containers with FairCom products.

Adding FairCom technology to an image is fairly straightforward. However, FairCom provides a script to facilitate the creation of an essential image identical to the one provided as a gzipped Docker image.

Note: This section uses the FairCom default ports. If you want to use different ports, you can change them in the services.json or ctsrvr.cfg file located in the <faircom>/config folder. Consider changing the image exposed ports accordingly.

 

Use the Docker image creation script

FairCom's provided script, named create_image.sh, helps to create a Docker image starting from a regular FairCom distribution package (gizpped tarball).

Currently create_image.sh supports x64 and ARM64 Linux flavors.

The create_image.sh script relies on some files named Dockerfile* that must reside in the same directory as the create_image.sh script.

The create_image.sh script requires Docker or Podman. Starting with Docker version 24, you may also need to install the Docker buildx plugin in order to correctly support the Docker image creation. Refer to your Docker distribution to know how to correctly install it. 

The create_image.sh script takes the following parameters in this order:

  • FAIRCOM_BUNDLE: this is the first and the only mandatory parameter. This specifies the FairCom gzipped tarball to use as base to create the docker image. The create_image.sh script will take care to select the requested components needed to run the server inside a container based on the image.
  • LICENSE: here the end user can pass a FairCom license file to replace the default license included in the FAIRCOM_BUNDLE. The parameter is optional, if any of the following parameters needs to be passed please specify an empty string “”. Please refer to the samples below.
  • quiet: By default the create_image.sh script creates a backup copy of the configuration folder before creating the image: the quiet parameter will force the create_image.sh script to skip all the questions related to configuration files backup and proceed with the image creation without asking questions. No file will be backed up if the quiet parameter is used.
  • remove: By default the create_image.sh creates a docker image in your local docker instance and saves a copy of it as a gzipped image in the current directory. The remove parameter will force create_image.sh to remove the image from the docker instance and leave only the gzipped image on disk. The gzipped image can be imported in any other docker instance using the docker load command. (Please refer to the “Use provided image section” above to know how to load a gzipped image)

Examples:

Create a simple image starting from a FairCom distribution package:

./create_image.sh FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.tar.gz

Create an image and replace the default license file with the specified second parameter:

./create_image.sh FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.tar.gz ctsrvr39481103.lic

Create an image with the default license and skip any question about the saving of the config files:

./create_image.sh FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.tar.gz "" quiet

Create an image, replace the license with the specified one, and remove the image from the local docker instance:

./create_image.sh FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.tar.gz ctsrvr39481103.lic "" remove

Create the image with the default license and remove the image from the local docker instance:

./create_image.sh FairCom-Edge.linux.x64.64bit.v4.1.3.71.240201.tar.gz "" "" remove

FairCom generated image details

As FairCom uses create_image.sh to generate the provided docker images, all the images generated with create_image.sh have similar characteristics.

The create_image.sh script takes the following directories from the specified FairCom bundle and puts them in the generated image:

config/
data/
server/
tools/
tranlogs/

Depending on the input package flavor, the script chooses between the provided Dockerfiles to ensure the image exposes the correct default TCP ports. The Dockerfile selects the proper operating system image to host and run the server and to install the required dependencies. It also specifies to start the server when a container based on the image is spawned.

Although FairCom's designed container images have a default location for configuration, data, and tranlogs inside the container, it is a good idea to take advantage of the volume mounts/maps to ensure that configuration, data, and tranlogs are produced outside the running containers to facilitate the upgrade of the image version if needed. See Map external folders into Docker.

FairCom chose the following base operating system images:

  • For X64 platforms (x86_64): Red Hat 8 universal base image
  • For ARM64 platforms: Ubuntu 24.04

 

Create your own Docker image

Some FairCom users prefer to create their own Docker image for various reasons. The most common reason is that complex applications may depend on other software components, which need to be part of the Docker image.

You can create your own Docker image by starting with any image on the Docker hub or using a FairCom-provided image. A FairCom-provided image must be loaded on the Docker host used to generate the new image.

Regardless of the selected base image, the user creating the image should define the image through a Dockerfile. Dockerfiles, together with FairCom's create_image.sh script, can be used as a starting point to create your own Dockerfile that best covers your application needs. 

Usually, a FairCom bundle includes the following:

  • <faircom>/config
  • <faircom>/data
  • <faircom>/server
  • <faircom>/tranlogs

Note: We discuss best practices for storing the configdata, and tranlogs folders in the Copying files into and out of a Docker container and Mapping external folders into Docker sections. As data, transaction logs, and configuration locations depend on your configuration, you might need to change your Dockerfile definition to define and include the correct locations. Map your data, transaction logs, and configuration locations out of Docker containers to facilitate the server binaries updates.

  • Consider adding the ctadmn (administration tool) and ctstop (scriptable command line tool for stopping the FairCom server) into this container. These are both found in the <faircom>/tools folder. FairCom prebuilt Docker images include the entire /tools FairCom distribution folder.
  • In order to take advantage of record compression, the FairCom server must be able to load the zlib library as libz.so. Many Linux-based images distribute zlib as libz.so.1. Make sure your custom image creates a symbolic link to libz.so.1 named libz.so in the same directory where libz.so.1 is hosted so that libz.so.1 is loaded correctly as libz.so. This can be done with a RUN command in your Dockerfile.
RUN ln -s /usr/lib64/libz.so.1 /usr/lib64/libz.soRUN ln -s /lib/aarch64-linux-gnu/libz.so.1 /lib/aarch64-linux-gnu/libz.so

Refer to your base image distribution to understand the name and the path of zlib.

For best performance, include the FairCom client side in the same container as the FairCom server application (faircom). It is possible to host the server and client components in separate containers. However, keep in mind you will experience about a 10-15% performance penalty. This overhead is present if both containers are running on the same machine and using the shared memory communication protocol. If the containers are not on the same machine, and therefore TCP/IP communication is in use, the overhead will be even greater.

 

 

Start a Docker container

Start the Docker container like any other container using the docker run command. If the image is configured to start the server, the server will start inside the container. FairCom prebuild images and images created with the create_image.sh script use the FairCom server executable as a CMD argument. This means that the container start will initiate the FairCom server startup.

 

Stop a Docker container

If executing FairCom’s ctstop command does not terminate the Docker container, you can stop the Docker container with the following command:

docker container stop edge

Warning: It is best to stop the FairCom server by executing FairCom’s ctstop command. If this does not work, and the FairCom COMPATIBILITY TERMINATE_ON_SIGNAL keyword is active in ctsrvr.cfg, then using Docker’s stop command works by sending a SIGTERM signal to FairCom server to shut down cleanly. It gives the server ten seconds to shut down. If this is not enough time, the server will be terminated prematurely. This should not result in data loss if your files are under transaction processing control (file mode TRNLOG), but the best practice is to use ctstop. Depending on the docker container network configuration, you might be able to use ctstop from any machine capable of connecting to the running docker container.

FairCom prebuild images and images created with the create_image.sh script use the FairCom server executable as a CMD argument. This means that the server shutdown will cause the container to stop, and restarting the same container will restart the server.

 

Kill a Docker container

If all other means of stopping the FairCom container fail, you can kill the Docker container with the following command:

docker kill edge

Warning: The warning above in Stopping a Docker container also applies to killing a Docker container.

 

Copy files into and out of a Docker container

The FairCom server uses various configuration files. It is recommended to copy and maintain these configuration files (from <faircom>/config) to a folder outside the Docker container. This ensures changes to these files are preserved when you replace the current container with a new version of the FairCom Server.

You can use the following techniques to copy any file inside the container to a folder outside the container:

  1. Before copying files, shut down the Docker container using the following command (adjust your paths accordingly):
docker exec -it edge /opt/faircom/tools/ctstop -auto
  1. Then run the following docker cp command to copy the /config folder to the /tmp folder:
docker cp edge:/opt/faircom/config /tmp

Docker copies data out of the container into the folder you specify. The command above creates one new folder on your Linux operating system named /tmp/config and copies the container files into it.

  1. After Docker copies these files, the Linux root owns them. If you want to see and work with these files without being root, you need to change the owner. Run the following command in the folder that contains these files, which in this case is /tmp. It changes the owner to desired_owner_name. Replace desired_owner_name with your login name or another login name that you want to own these files.
chown -R desired_owner_name config
  1. To use the new config folder along with any mapped data and tranlogs folders (Map external folders into Docker), you must remove the current container and run a new Docker container. Use the following commands to do this:
docker container rm edge
docker run -d -p 1883:1883 -p 5597:5597 -p 6597:6597 -p 8080:8080 -p 8081:8081 -p 8443:8443 -v /tmp/:/opt/faircom/data -v /tmp/:/opt/faircom/tranlogs -v /tmp/config/:/opt/faircom/config --name edge faircomedge:v3.0.1.206

The previous command uses these folders on your operating system as the source for configdata, and tranlogs. This ensures your configuration, data, and logs are not lost when you update the Docker container to a new image.

It is a best practice to map another folder besides /tmp to hold your configdata, and tranlogs. The section, Map external folders into Docker shows you how to do this.

 

Map External Folders into Docker

This section describes best practices for mapping Linux folders into a Docker container.

Warning: Do not run the examples in this section without first reading the entire section and thinking about which Linux folders you want to use to hold your data. Then modify the commands to use your chosen folders.

FairCom stores your data in three folders called datatranlogs, and config. As described in this guide, for containers based on FairCom prebuilt images and images created with the create_image.sh script, these folders are located inside the Docker container in a folder named /opt/faircom/.

  • Data files are stored in /opt/faircom/data
  • Transaction Logs are in /opt/faircom/tranlogs
  • Configuration files are in /opt/faircom/config

Note: Storing data inside a Docker container is not a good practice because updating or deleting the Docker container destroys these files. Further, Docker’s internal file system slows down greatly when its files change often.

You should map operating system folders into the Docker container. This stores your data in those mapped folders and preserves your data when you update the Docker image. Use the -v switch in the Docker run command to map operating system folders into Docker’s internal folders.

Example 1. The following command maps the operating system folder named /tmp/data/ into the folder inside the Docker container named /opt/faircom/data/

docker run -d -p 1883:1883 -p 5597:5597 -p 6597:6597 -p 8080:8080 -p 8081:8081 -p 8443:8443 -v /tmp/data/:/opt/faircom/data/ --name edge faircomedge:v3.0.1.206

The -v outside_folder:inside_folder option maps an operating system folder into a Docker container folder. Docker will create the operating system folder if it does not exist. After the command runs, the files and folders in the operating system folder are the only ones visible inside the mapped Docker container folder. Preexisting files and folders stored inside the Docker container’s folder are no longer visible to the applications running inside the Docker container.

FairCom recommends you create your own folders for data, logs, and config files outside the container. After creating these "external" folders, you need to ensure the Docker process has access to these folders. You may need to modify the ownership of these folders to give Docker permission to access them.

chown -R desired_owner_name folder_name

The following folders are possibilities:

  • /var/lib/faircom/data
  • /var/lib/faircom/tranlogs
  • /var/lib/faircom/config

When creating your own folder for config files, you need to copy a set of FairCom’s config files into /var/lib/faircom/config because the FairCom server will not run without them. For an example of how to do this, see the section, Copying files into and out of a Docker container.

Once these operating system folders are created and the config folder contains FairCom’s config files, you can modify the docker run command with new -v mappings to use those folders. The command below is an example:

docker run -d -p 1883:1883 -p 5597:5597 -p 6597:6597 -p 8080:8080 -p 8081:8081 -p 8443:8443 -v /var/lib/faircom/data/:/opt/faircom/data -v /var/lib/faircom/tranlogs/:/opt/faircom/tranlogs  -v /var/lib/faircom/config/:/opt/faircom/config --name edge faircomedge:v3.0.1.206

To find more details about the Docker run command and its parameters, see the Docker online documentation.

Warning: Do not configure two Docker containers to use the same operating system folders for data and tranlogs. If you do, the two instances of the FairCom server will write to the same data files. This can irreparably corrupt the data.

When mapping a configuration folder, always make sure that the config folder on the host machine contains the proper configuration files. If no configuration file is found in the mapped configuration folder the server will start in default mode without most of the additional services such as the http services and data produced in the server executable directory.

 

Troubleshoot TCP/IP port conflicts

If you cannot connect to the FairCom server over TCP/IP, you may have port conflicts. Perform the following checks to troubleshoot:

  1. When the FairCom server is not running, run the following command to list the ports currently in use on Linux.
netstat – an

Note: The netstat command is part of net-tools. If it is not already installed, you can install it using the following command:

yum install net-tools

The command above is for Red Hat-based Linux distribution images. Refer to your distribution documentation to learn how to install netstat correctly.

  1. Compare the output of netstat to the list provided in FairCom ports. If any of these ports are being used by other applications, then the FairCom server will not run properly. You can modify FairCom's configuration files to configure it to use another port. 
  2. If you have copied the config folder outside the container and mapped that folder back into the container, you can directly edit the config files using your favorite editor, see Copying files into and out of a Docker container and Map external folders into Docker.

 

Run a container using -P

If you cannot connect to the FairCom server over TCP/IP, you may have run the Docker container with the -P (upper case P) switch. This switch causes Docker to map the fixed ports inside the Docker container to randomly available ports on the outside of the container.

Example 2. Running a Docker with the -P switch

docker run -d -P --name edge faircomedge:v3.0.1.206

Note: If you use the -P switch, you must use Docker’s dynamically assigned port numbers to connect to the FairCom server. This is a convenient way to quickly run multiple containers of the FairCom server on the same computer without port conflicts. On the other hand, it makes it more complicated to connect to FairCom services.

You can run the following command to get the port mappings of a Docker container:

docker port edge

After executing the Docker run command with the -P (uppercase P) example shown above, the Docker container returns port mappings like the following. The results show the mapping of ports from inside the Docker container to the outside.

Example 3. Return

Inside to outside

1883/tcp -> :::55005

5597/tcp -> :::55004

6597/tcp -> :::55003

8080/tcp -> :::55002

8081/tcp -> :::55001

8443/tcp -> :::55000

For example, FairCom uses TCP/IP ports for the following protocols.

  • MQTT uses port 1883 by default.
    In the -P example above, Docker maps it to 55005.
  • Browser-based apps uses port 8443 by default.
    In the -P example above, Docker maps it to 55000.
  • MQTT WebSocket uses port 8081 by default.
    In the -P example above, Docker maps it to 55001.
  • SQL ODBC uses port 6597 by default.
    In the -P example above, Docker maps it to 55003.
  • ISAM, CTDB, and NAV APIs use port 5597 by default.
    In the -P example above, Docker maps it to 55004.
  • Port 8080 is the insecure HTTP port. Use port 8443 instead.
    In the -P example above, Docker maps it to 55002.

You can use FairCom’s config files to change the default ports.

 

Connect to FairCom's browser-based applications

Note: Use the Google Chrome browser for FairCom browser-based tools. Other browsers may cause unexpected behavior

To connect to FairCom’s browser-based applications, use a URL like the following in your web browser:

https://localhost:8443/

Putting this URL in the web browser brings up the landing page for FairCom’s browser-based applications. On this landing page, you can click on the links to run MQTT Explorer, SQL Explorer, and Monitor.

If there are issues:

  • Try changing localhost in the URL to the hostname or IP address of the computer running the Docker container containing FairCom. You may also consider using the following URL if localhost is not working:
https://127.0.0.1:8443/
  • Try changing 8443 in the URL to the port number that Docker maps to port 8443. In the -P example above, the Docker container maps 8443 to 55000.

Note: SQL Explorer and Monitor applications work properly when using their default ports. Do not change these ports to Docker’s newly mapped ports.

When you launch MQTT Explorer (available in FairCom EDGE), it opens a connection page where you can specify ports for connecting to the application. If you use the -p switch (lowercase p) to run the Docker container, the default ports work without change.

If you use -P switch (uppercase P) to run the Docker container, you need to determine the port that Docker assigned to port 8081, which is the WebSocket port used by MQTT Explorer. In Running a container using -P, its example shows that Docker assigned the external port 55001 to FairCom’s internal MQTT/WS port of 8081. When you log into MQTT Explorer, you must use Docker’s newly assigned external port for the MQTT/WS Port. Do not change the default value for the SQL port.

For the field named MQTT/WS Port, use the port number that the Docker container maps to 8081. This is FairCom’s MQTT WebSocket port, which allows a web browser to send and receive MQTT messages. In the -P example above, Docker maps this port to 55001.Do not change the SQL Port, which defaults to 6597. This port is used inside the Docker container by FairCom’s app server to connect to the Database Server. Because FairCom’s app server and database server run inside the container, they communicate using their original internal port numbers.

 

Troubleshoot

Windows issues

Problems connecting to the FairCom DB service

If client applications are unable to connect to the FairCom DB service, verify that FairCom DB service is running.

If the FairCom DB service is running, check the FairCom DB status log file (CTSTATUS.FCS, typically located in the directory in which the FairCom DB executable resides) for the following information:
  1. Are there any error messages logged to CTSTATUS.FCS?
  2. Is the Server Name displayed in CTSTATUS.FCS the same server name your client applications are using?
  3. Are the protocols displayed in CTSTATUS.FCS the same as those your client applications are using?
To check the current status of the FairCom DB service:
  1. Using sc.exe, run the following (where "ctreeace.exe" is the name of the FairCom DB service).
sc query ctreeace.exe

  1. Using the Windows Services Control Panel applet, open the Control Panel and select the Services applet.
    1. If the FairCom DB service is running, the Status field shows Started.
    2. Otherwise the Status field is blank.

 

Problems starting the FairCom DB service

If the FairCom DB service fails to start, it returns a service-specific error, and logs a message to the Windows application event log. This information can be used to determine the reason the FairCom server service failed to start. Below is the output of a failed startup when starting the FairCom DB service using FairCom’s SCP. The service-specific error is displayed as the Service Exit code.

Starting the c-tree Server service...

c-treeServer start unsuccessful:

Current State: STOPPED

Win32 Exit:    1066

Service Exit:  6

Checkpoint:    0x0

WaitHint:      0x0

The Table 1, “FairCom's service errors” shows possible service-specific errors returned by the FairCom server service, the corresponding message, and possible causes for each of these errors.

Table 1. FairCom's service errors

Error code Error message Possible causes
2 (Varies) An operating system function call failed. See the event log for a detailed error message.
4 The FairCom DB settings file is missing. It is required to operate this server. FairCom DB service requires a settings file, but it was not found.
5 The current settings file are invalid. FairCom DB requires a settings file, and the settings file that was found was not valid. Contact your application developer for assistance.
6 FairCom DB must be activated with a FairCom activation key to operate, see the FairCom DB activation key card within your package for more information. FairCom DB has not yet been activated.
Use the Windows Event Viewer to list events reported by the FairCom DB service:
  1. Start the Event Viewer.
  2. Select the Application log option from the Log menu.
    Events logged by the FairCom DB service have the Source field set to the service name (“c-treeACE Database Engine" or "c-treeEDGE Database Engine" by default).
  3. Double-click an event to display the event detail.
    Event Viewer displays events that are logged by the FairCom DB service

 

Problems stopping the FairCom DB service

If you are unable to stop the FairCom DB service:
  1. Check the event log for an error message.
  2. Check for error messages in the FairCom DB status log file (CTSTATUS.FCS, typically located in the directory in which FairCom DB executable resides).
  3. FairCom’s ctadmn utility (provided with the FairCom server) can also be used to stop the FairCom DB service.

 

Linux issues

FairCom server not running

If your server quits immediately after you try to launch it, you may already have a server running in the background with the same port settings. Or you may have another application already using ports required by the FairCom server, see Configure ports for v12.x.

The evaluation version of the product times out after three hours and shuts down the server. Therefore, the server needs to be restarted every three hours.

 

Web browser issues

Problem: Web browser cannot connect to locally running FairCom Server

Figure 1. Error

The error that is received when there are issues connecting to FairCom's browser-based applications

Solution: Use 127.0.0.1 instead of localhost

Tips for using 127.0.0.1 instead of localhost:

  • To test FairCom database web tools use use http://127.0.0.1:8080/ or https://127.0.0.1:8443/ instead of http://localhost:8080/ or https://localhost:8443/.
  • It is best practice to use 127.0.0.1 instead of localhost to ensure you connect to your local computer because localhost does not work reliably in some languages, such as Python. Also, your computer's hosts files and/or DNS settings may be configured to redirect the localhost domain name to another computer besides your local computer.
  • If you use 127.0.0.1 you do not have to worry about the behavior of localhost and the hosts file.
  • If you want to verify how your hosts file modifies the behavior of localhost, you can open it in any editor to see what IP address it maps to localhost.
  • In Windows, the hosts file is located in C:\Windows\System32\drivers\etc.
    By default, it uses DNS to map localhost. Your DNS server typically maps localhost to 127.0.0.1, but it can map it anywhere and this can cause problems.
  • In Linux (Unix), the hosts file is located in the /etc folder.
  • By default, Linus maps localhost to 127.0.0.1.

Use the Google Chrome browser for FairCom browser-based tools. Other browsers may cause unexpected behavior.

 

Install Python
How to install Python

Some FairCom Scripts require Python 3.

If a FairCom script requires Python 3, you might need to install it. This document shows how to install Python 3 on Windows.

Python 3 comes preinstalled on most MacOS and Linux distributions.

  1. Use the command line to determine if Python is already installed. Open a command prompt (Start+R cmd).
    py --version

    If the current version of Python is at least Python 3.7.9, you do not need to install Python.
  2. Uninstall previously installed versions of Python. This ensures you can run only the newly installed version of Python.
    1. Open the Apps & Features dialog to add or remove programs. 
    2. Search for Python.
    3. Uninstall existing versions
    4. Verify no instances of Python are installed by running the following command and ensuring it returns no files:
      where.exe python
    5. Remove all Python programs from the path.
      1. Open System Properties -> Environment Variables -> System Variables -> Path
      2. Click each path containing a reference to Python and click the delete button.
      3. Click OK.
  3. Download a Windows x86-64 executable installer for Python, such as Python 3.12.3
    1. Download the Windows installer (64-bit) for an Intel-based PC or the Windows installer (ARM64) for the less common ARM-based PC.
    2. This downloads an executable with a name like python-3.12.3-amd64.exe
  4. Run the downloaded executable.
    1. Click Add python.exe to PATH
    2. Click Customize installation
    3. Click Next
  5. Configure install options.
    1. Check the box: Install for all users
    2. Ensure Add Python to environment variables is checked.
    3. Click Install
    4. Wait for the following screen to appear.
  6. Verify the path environment variables are correct.
    1. There should be two paths for the specific version of Python you installed: one for Python itself and another for Python scripts.
    2. Click OK.
  7. Using the command line, verify the version of Python matches the version you installed.
    py --version
    where.exe python

 

Connectivity issues

The FairCom server adds a log entry to ctstatus.fcs whenever it disconnects a MQTT client, terminates a JSON API session, refuses a connection attempt, or fails to process certain requests because of a limit violation.

To prevent the log from overflowing with log entries, the server implements an internal in-memory counter for each subsequent limit violation of the same type. For every 10 violations up to 100 violations, the server writes another log entry. For every 100 violations up to 1000 violations, the server writes another log entry. For every 1000 violations from then on, the server writes another log entry. For every 10,000 violations, reset the counter to zero to ensure the server adds another round of log messages to the log file. This functionality keeps the issue visible in the log without overflowing it. 

Limits set by your license file or by the following properties can cause these to happen:

Property Notes

maxConnectionsPerIpAddress
 

(config/services.json file)

This property limits the number of simultaneous TCP/IP connections each IP Address/host computer can make to the FairCom server on a "per listener" and/or "global" basis. When exceeded, the server will not accept additional TCP/IP connections from that host. This affects HTTP, HTTPS, MQTT, MQTTS, WS, and WSS connections.

jsonActionApiDefaults.maxJsonApiSessions
 

(config/services.json file)

This property limits the number of simultaneous JSON API sessions the FairCom server will allow at any given time, up to the number allowed by your license. When exceeded, "createSession" actions will fail. The "deleteSession" action can be used to make room for more sessions. The "idleConnectionTimeoutSeconds" parameter in "createSession" or "alterSession" can be used to make idle sessions time out faster.

jsonActionApiDefaults.maxJsonApiSessionsPerIpAddress
 

(config/services.json file)

This property limits the number of simultaneous JSON API sessions the FairCom server will allow per IP Address/host computer. When exceeded, "createSession" actions will fail. The "deleteSession" action can be used to make room for more sessions. The "idleConnectionTimeoutSeconds" parameter in "createSession" or "alterSession" can be used to make idle sessions time out faster.

jsonActionApiDefaults.maxJsonApiSessionsPerUsername
 

(config/services.json file)

This property limits the number of simultaneous JSON API sessions the FairCom server will allow per username. Usernames are created by setting the "params.username" property in the "createSession" action. When exceeded, "createSession" actions will fail. The "deleteSession" action can be used to make room for more sessions. The "idleConnectionTimeoutSeconds" parameter in "createSession" or "alterSession" can be used to make idle sessions time out faster.

retrySeconds
 

(configureTopic action)

This property specifies how long the MQTT broker is willing to wait for the next packet from the client during a QoS 1 or 2 PUBLISH handshake. If this limit is exceeded, the broker will disconnect the client. Slow or overloaded servers might benefit from increasing this number. If that does not help, reduce MQTT message traffic or use a more powerful server.

idleConnectionTimeoutSeconds
 

(createSession & alterSession actions)

This property specifies how long a JSON API session (created with the "createSession" action) can remain idle before the server closes/deletes that session. This is used to limit how much memory is consumed by idle JSON API sessions. When you are done using a session, delete it with the "deleteSession" action.