This section defines how to configure the services of a FairCom server. It shows how to configure services with specific protocols and ports.
The FairCom default configuration matches common industry settings for the protocols, ports, and services it offers. All additional services are also configured at startup using the services.json file (previously called cthttpd.json). The services.json file is located in the <faircom>\config folder.
You may want to change ports:
- To avoid colliding with a port used by an existing application.
- To avoid a port blocked by a firewall.
- To run multiple instances of the FairCom server on the same computer.
How to use services.json
This section outlines the properties included in services.json.
"result" property summaries| Property | Description | Default | Type | Limits (inclusive) | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| apiRoot |
The Each API is a service provided by the FairCom server. Do not change the settings of the object properties unless you disable an unused API. |
|
string | |||||||||||||
| apis | Describes and controls FairCom's jsonAction APIs | [] |
array of objects | |||||||||||||
| applicationRoot |
The The default value of There is rarely a reason to change the For information on how to add your own web applications, which can use any of FairCom's jsonAction APIs, contact FairCom. |
|
string | |||||||||||||
| applications |
The optional FairCom and other custom web applications are single-page, browser-based applications served from folders in the default An app server is a backend service used by one or more web applications. It listens to HTTP and/or WebSocket requests and then returns results. Contact FairCom for information on how to build and add your own app servers using C or C++. The following
|
[] |
array of objects | |||||||||||||
|
applications .enabled |
(optional) Enables or disables a web application | false |
Boolean |
|
||||||||||||
|
applications .folderName |
The Only when the
In this example, the web application will be stored in the
|
Required - No default value | string | 1 to 64 bytes | ||||||||||||
|
applications .serviceLibrary |
The optional Library files are located in the The full path includes the |
"" |
string | 1 to 64 bytes | ||||||||||||
|
applications .serviceName |
(optional) specifies a friendly name for the web application. The FairCom server ignores this property | "" |
string | 1 to 64 bytes | ||||||||||||
|
applications .uriPath |
The "uriPath" property is optional. It is a string that indicates the path where the "serviceLibrary" file is stored. If specified, this value is appended to the default <faircom>/server/web/ folder path. |
"" |
string | 1 to 64 bytes | ||||||||||||
| approvedCorsConnections |
The services.json example:
When FairCom's App server receives an API request that includes an Origin header with a URL that is in the
When an API call does not include an Origin header or the specified URL in the Origin header does not match a URL in this array, the server does not add these headers to the response. This denies the CORS request. |
[] |
array | 0 or more strings | ||||||||||||
| authenticationMethods |
FairCom MQ and FairCom Edge let you enforce secure MQTT communications with the broker by letting you control how MQTT clients authenticate. Use the "authenticationMethods" property in the
Define the allowed MQTT authentication methods by including any combination of Examples To allow MQTT clients to connect with or without authentication, include To require MQTT clients to connect only with certificate authentication, include only To require MQTT clients to connect only with a username and password authentication, include only To require MQTT clients to connect with a client certificate or a password, include Best Security Practice Remove |
|
array of objects |
|
||||||||||||
| codeServices | specifies which programming languages are available in the product | [] |
array of objects |
|
||||||||||||
|
codeServices .enabled |
The
|
true |
Boolean |
|
||||||||||||
|
codeServices .serviceLibrary |
The Library files are located in the The full path includes the |
"" |
string | |||||||||||||
|
codeServices .serviceName |
The The
In Each service may use the same or different dynamic libraries (.dll, .so, or .dylib) to provide the programming language runtime. The same dynamic library may also be reused in other services, such as transform services. |
"javascript" |
string | |||||||||||||
| connectionPoolFileIdleCloseSeconds |
The
|
10 | integer | -1 to 2147483647 | ||||||||||||
| defaultDatabaseName | defines the default value of the "databaseName" property |
|
string | 1 to 64 bytes | ||||||||||||
| defaultOwnerName |
The
|
"admin" |
string | 1 to 64 bytes | ||||||||||||
| integrationServices |
The
|
{} |
object | |||||||||||||
| jsonActionApiDefaults |
The default settings for the FairCom jsonAction APIs and browser-based applications are specified in the
Example 1. Default settings for jsonAction APIs
The property names and values in You can change the values of the properties in
Example 2. Keeping
|
{} |
object | |||||||||||||
| listeners |
The
|
[] |
array of objects | |||||||||||||
|
listeners .tls |
The |
{} |
object | |||||||||||||
|
listeners .tls .allowedCipherSuites |
The
|
"" |
string | |||||||||||||
|
listeners .tls .caCertificateFilename |
The
|
"" |
string | |||||||||||||
|
listeners .tls .clientCertificateFilename |
The
|
"" |
string | |||||||||||||
|
listeners .tls .clientPrivateKeyFilename |
The
|
"" |
string | |||||||||||||
|
listeners .tls .requireClientCertificate |
The
|
false |
Boolean |
|
||||||||||||
| maxConnectionsPerIpAddress |
The This feature is implemented at the FairCom App Server level to prevent the app server from being overwhelmed by a DoS attack. It protects against simultaneous DoS attacks across multiple protocols: HTTP, HTTPS, MQTT, MQTTS, WS, and WSS. The default is A value of This property can be added to the top level of the In the case that your connections are routed through a firewall or load balancer, you may need to disable this feature since the connections will come from the same IP address. |
25 |
integer | |||||||||||||
| maxJsonApiSessions |
The The default value is the maximum number of JSON API connections allowed by the license. A value of This property is added to the |
The max number of JSON API connections allowed by the license | integer | |||||||||||||
| maxJsonApiSessionsPerIpAddress |
The The default value is The maximum possible number of connections is determined by the license file. A value of This property is added to the In the case that your connections are routed through a firewall or load balancer, you may need to disable this feature since the connections will come from the same IP address. |
50 |
integer | |||||||||||||
| maxJsonApiSessionsPerUsername |
Accordion BodyThe The default value is The maximum possible number of connections is determined by the license file. A value of If your application uses one account for all JSON API sessions, this feature will need to be disabled. This property is added to the "jsonActionApiDefaults":
{
"maxJsonApiSessions": 500,
"maxJsonApiSessionsPerIpAddress": 20,
"maxJsonApiSessionsPerUsername": 20,
"defaultApi": "hub",
"defaultBinaryFormat": "hex",
"defaultDatabaseName": "faircom",
"defaultDebug": "max",
"defaultOwnerName": "admin",
"defaultResponseOptions":
{
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "number"
},
"idleConnectionTimeoutSeconds": 3600,
"idleCursorTimeoutSeconds": 600,
"defaultRetentionPolicy": "autoPurge",
"defaultRetentionUnit": "week",
"defaultRetentionPeriod": 4
} |
50 |
integer | |||||||||||||
| mqtt | The "mqtt" property is an optional object that defaults to {} and groups the MQTT default values together. |
{} |
object | |||||||||||||
|
mqtt .authenticationMethods |
The optional The broker supports the following authentication techniques:
|
[ "none", "password", "clientCertificate" ] |
array |
|
||||||||||||
|
mqtt .defaultDowngradeQoS |
The "defaultDowngradeQoS" property sets the default value of the "downgradeQoS" property in "configureTopic". It is optional and defaults to false. The MQTT broker uses this value when a topic does not include the "downgradeQoS" property. Use the "downgradeQoS" property to set each topic to a different setting. When false, it enables FairCom MQ's unique ability to deliver messages using the QoS requested by subscribers regardless of the QoS provided by publishers. When true, the MQTT broker lowers the quality of service (QoS) of outgoing MQTT messages to match the QoS of incoming messages. |
false |
Boolean |
|
||||||||||||
|
mqtt .defaultMaxDeliveryRatePerSecond |
The "defaultMaxDeliveryRatePerSecond" property sets the default value of the "maxDeliveryRatePerSecond" property in "configureTopic". It is optional and defaults to 0, which causes the broker to send messages as fast as possible. A value between 1 and 1000 helps keep a client from being overwhelmed with too many messages sent too quickly. It must be a value between 0 and 2147483647. The MQTT broker uses this value when a topic does not include the "maxDeliveryRatePerSecond" property. Use the "maxDeliveryRatePerSecond" property to set each topic to a different setting. |
0 |
integer | |||||||||||||
|
mqtt .defaultMaxInflightMessages |
The "defaultMaxInflightMessages" property sets the default value of "maxInflightMessages" in "configureTopic". It is optional and defaults to 20. It causes the broker to send up to 20 messages without waiting for subscribers to acknowledge published packets. Setting this property to a larger number increases performance but may overwhelm some subscribers. The MQTT broker uses this value when a topic does not include the "maxInflightMessages" property. Use the "maxInflightMessages" property to set each topic to a different setting. |
20 |
integer | |||||||||||||
|
mqtt .defaultMessageCommitFrequencyForQoS1 |
The optional When most messages are QoS 0 or 1, in When most messages are QoS 2, you can add |
1000 |
integer | |||||||||||||
|
mqtt .defaultMillisecondCommitFrequencyForQoS1 |
The optional When most messages are QoS 0 or 1, in When most messages are QoS 2, you can add |
1000 |
integer | |||||||||||||
|
mqtt .defaultMqttPayloadType
|
(optional) defines the default type of MQTT message payloads published to all topics. | "json" | string enum |
|
||||||||||||
|
mqtt .defaultOptimizeForQoS2 |
The optional "defaultOptimizeForQoS2" property sets the default value for the "optimizeForQoS2" property. It defaults to false for maximum performance. Set to false in the "mqtt" section of the services.json file when you expect most messages to use QoS 1 for the fastest performance. Set to true in the "mqtt" section of the services.json file when you expect most messages to use QoS 2, which is appropriate for mission-critical applications that cannot receive messages more than once, such as MQTT command messages and the data change messages from FairCom DB Notify. You can override this default value in each topic by using the "configureTopic" action to assign a different value to the "optimizeForQoS2" property. QoS 0 messages are unaffected by this property and always run at maximum performance. |
false |
Boolean |
|
||||||||||||
|
mqtt .defaultRetrySeconds |
The "defaultRetrySeconds" property is an optional integer that sets the global default value of the "retrySeconds" property. This property defaults to 20 (seconds). |
20 |
integer |
1 to 65535
|
||||||||||||
|
mqtt .defaultValidateMqttPayload
|
(optional) when true, the broker validates the MQTT message payload published to all topics to verify it matches the type specified by the "defaultMqttPayloadType" or "mqttPayloadType" properties. | true | Boolean |
|
||||||||||||
|
mqtt .disableThroughputStats |
The optional "disableThroughputStats" property controls how the MQTT broker tracks the number of inbound and outbound messages per second. Set to true to stop the MQTT Broker from tracking the average number of inbound and outbound messages per second. It defaults to false. When set to false, the broker tracks the throughput of all incoming and outgoing messages, which is helpful in troubleshooting usage spikes. Throughput tracking slightly slows down MQTT performance. Disable throughput tracking by omitting the property or setting it to null or false. |
false |
Boolean |
|
||||||||||||
|
mqtt .enforceQos2DuringRecovery |
The optional "enforceQos2DuringRecovery" property guarantees the MQTT broker will not publish a QoS 2 message a second time after a broker recovers from an unexpected downtime. To do this, the broker must persist the packet transfer state of each QoS 2 message, which slows the speed of message delivery to QoS 2 subscribers. This feature works at the broker level. It is configured once for the broker and applies to all topics and subscribers. The default value is false. |
true |
Boolean |
|
||||||||||||
|
mqtt .eventuallyPersistDeliveryInfo |
The Set it to In more technical terms, this setting controls whether the broker commits the delivery status of MQTT packets to the transaction log on disk or commits delivery status to volatile RAM using FairCom's PREIMG technology, where the server eventually writes the changes to disk. |
false |
Boolean |
|
||||||||||||
|
mqtt .historyRetentionPeriod |
The optional |
30 |
integer | |||||||||||||
|
mqtt .historyRetentionUnit |
The optional These records are in the following tables in the FairCom database:
You may set
|
"day" |
string |
|
||||||||||||
|
mqtt .messageCommitFrequencyForQoS1 |
The optional When it is set to When the When the When a topic only supports QoS 0 and 1 messages, you may set the value to an integer number greater than The |
1 |
integer | |||||||||||||
|
mqtt .millisecondCommitFrequencyforQoS1 |
The optional When it is set to When the When the When a topic only supports QoS 0 and 1 messages, you may set the value to an integer number greater than The |
1 |
integer | |||||||||||||
|
mqtt .optimizeForQoS2 |
The optional When When When
QoS 0 messages are unaffected by this property and always run at maximum performance.
|
false |
Boolean |
|
||||||||||||
|
mqtt .ownerName |
The optional "ownerName" property sets the account name that owns the tables created by the MQTT broker. It defaults to "admin". You can set it to any valid account name. It is a security best practice to set the owner name to an account with limited privileges. |
"admin" |
string | |||||||||||||
|
mqtt .pollingFrequencyMilliseconds |
The optional "pollingFrequencyMilliseconds" property controls the polling frequency of all incoming requests over MQTT, HTTP, HTTPS, WS, and WSS. Thus, it affects the latency and throughput of all MQTT, JSON action APIs, and Web applications. It defaults to 1, which causes the server to poll for an incoming event every millisecond. This setting provides the lowest latency and maximum throughput performance. This setting works well on all but the slowest computers, such as old Raspberry PI computers. A higher number decreases CPU usage and power consumption and increases the latency for detecting incoming messages and API requests. |
1 |
integer | |||||||||||||
|
mqtt .statsCollectionFrequencySeconds |
The optional "statsCollectionFrequencySeconds" property sets the frequency in seconds for the MQTT broker to collect statistics in the mqtt_stats table, which is required for the MQ Dashboard to work. The default value is 12 seconds. The following values turn off the insertion of statistics records into the mqtt_stats table: omitting the property, setting it to null, or setting it to a value <= 0. A smaller value increases the accuracy of the MQ Explorer dashboard, but it slightly slows down the overall performance of the MQTT broker. |
12 |
integer | |||||||||||||
|
mqtt .statsPublishFrequencySeconds |
The optional "statsPublishFrequencySeconds" property sets the frequency in seconds for the MQTT broker to publish MQTT messages containing statistics about connections, subscribers, and topics. Each message is a JSON object that includes extensive information about the current state of the MQTT broker. Do the following to turn off publishing these messages: omit the property, set it to null, or set it to a value <= 0. A smaller value increases the number of messages sent per second and slightly slows down the overall performance of the MQTT broker.
|
30 |
integer | |||||||||||||
|
mqtt .statsRetentionPeriod |
The optional This property applies to the See |
14 |
integer | |||||||||||||
|
mqtt .statsRetentionUnit |
The optional You may set it to:
|
"day" |
string |
|
||||||||||||
| otherServices |
The
|
The services connected when the server last started up. | array of objects | |||||||||||||
| transformServices |
The
|
The services connected when the server last started up. | array of objects |
Example services.json configuration file
{
"maxConnectionsPerIpAddress": 5,
"listeners": [
{
"serviceName": "http8080",
"description": "Port 8080 using insecure HTTP protocol for REST and Web Apps on all TCP/IP addresses bound to this server",
"port": 8080,
"protocol": "http",
"enabled": false
},
{
"serviceName": "https8443",
"description": "Port 8443 using TLS-secured HTTPS protocol for REST and Web Apps on all TCP/IP addresses bound to this server",
"port": 8443,
"protocol": "https",
"enabled": true,
"tls": {
"serverCertificateFilename": "./web/fccert.pem",
"allowedCipherSuites": "",
"caCertificateFilename": "",
"clientCertificateFilename": "",
"clientPrivateKeyFilename": "",
"requireClientCertificate": false
}
},
{
"serviceName": "mqtt1883",
"description": "Port 1883 using insecure MQTT protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"port": 1883,
"protocol": "mqtt",
"enabled": true
},
{
"serviceName": "mqtts8883",
"description": "Port 8883 using TLS-secured MQTTS protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"port": 8883,
"protocol": "mqtts",
"enabled": true,
"tls": {
"serverCertificateFilename": "./web/fccert.pem"
}
},
{
"serviceName": "mqttws9001",
"description": "Port 9001 using WebSocket protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"port": 9001,
"protocol": "mqttws",
"enabled": true
},
{
"serviceName": "mqttwss9002",
"description": "Port 9002 using TLS-secured WebSocket protocol for the MQTT broker on all TCP/IP addresses bound to this server",
"port": 9002,
"protocol": "mqttwss",
"enabled": true,
"tls": {
"serverCertificateFilename": "./web/fccert.pem"
}
}
],
"jsonActionApiDefaults":
{
"defaultApi": "hub",
"defaultBinaryFormat": "hex",
"defaultDatabaseName": "faircom",
"defaultDebug": "max",
"defaultOwnerName": "admin",
"defaultResponseOptions":
{
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "number"
},
"idleConnectionTimeoutSeconds": 3600,
"idleCursorTimeoutSeconds": 600,
"defaultRetentionPolicy": "autoPurge",
"defaultRetentionUnit": "week",
"defaultRetentionPeriod": 4,
"maxJsonApiSessions": 1024,
"maxJsonApiSessionsPerIpAddress": 50,
"maxJsonApiSessionsPerUsername": 50,
"enablePermanentJsonApiSessions": true
},
"applicationRoot": "./web/apps/",
"approvedCorsConnections": [ "https://faircom.github.io" ],
"pollingFrequencyMilliseconds": 1,
"requestMaxThreads": 1024,
"maxConnectionsPerIpAddress": 25,
"connectionInactiveTimeout": 30,
"connectionRequestTimeout": 10,
"maxDatabaseConnectionCount": 2048,
"connectionPoolFileIdleCloseSeconds": 10,
"mqtt": {
"authenticationMethods": [ "none", "password", "clientCertificate" ],
"defaultDowngradeQoS": false,
"defaultMaxInflightMessages": 20,
"defaultMaxDeliveryRatePerSecond": 0,
"statsRetentionUnit": "day",
"statsRetentionPeriod": 14,
"disableThroughputStats": false,
"historyRetentionUnit": "day",
"historyRetentionPeriod": 30,
"enableMqttLogging": false,
"defaultRetrySeconds": 20,
"statsCollectionFrequencySeconds": 12,
"statsPublishFrequencySeconds": 30,
"disablePersistence": "no",
"defaultMessageCommitFrequencyForQoS1": 100,
"defaultMillisecondCommitFrequencyForQoS1": 1000,
"defaultOptimizeForQoS2": false,
"enforceQos2DuringRecovery": true,
"eventuallyPersistDeliveryInfo": false,
"messageCommitFrequencyForQoS1": 1,
"millisecondCommitFrequencyForQoS1": 1,
"optimizeForQoS2": false,
"ownerName": "admin",
"defaultMqttPayloadType": "json",
"defaultValidateMqttPayload": true,
"defaultMqttPayloadType": "json",
"defaultValidateMqttPayload": true
},
"storeAndForward":
{
"controlSentPosition": false,
"transactionLog": true
},
"applications": [
{
"serviceName": "Ace Monitor",
"uriPath": "AceMonitor",
"serviceLibrary": "ctmonitor.dll",
"enabled": true
},
{
"serviceName": "Data Explorer",
"uriPath": "SQLExplorer",
"serviceLibrary": "ctsqlexplorer.dll",
"enabled": true
},
{
"serviceName": "ISAM Explorer",
"uriPath": "ISAMExplorer",
"serviceLibrary": "ctisamexplorer.dll",
"enabled": true
}
],
"apiRoot": "./api",
"apis": [
{
"serviceName": "hub",
"enabled": true
},
{
"serviceName": "mq",
"enabled": true
},
{
"serviceName": "db",
"enabled": true
},
{
"serviceName": "transform",
"enabled": true
}
],
"integrationServices": [
{
"serviceName": "opcua",
"serviceLibrary": "opcservice.dll",
"schemaName": "opcua",
"enabled": true
},
{
"serviceName": "modbus",
"serviceLibrary": "modbusservice.dll",
"schemaName": "modbus",
"enabled": true
},
{
"serviceName": "ab",
"serviceLibrary": "abservice.dll",
"schemaName": "ab",
"enabled": true
},
{
"serviceName": "siemensS7",
"serviceLibrary": "siemenss7service.dll",
"schemaName": "siemensS7",
"enabled": true
},
{
"serviceName": "rest",
"serviceLibrary": "restservice.dll",
"schemaName": "rest",
"enabled": true
}
],
"transformServices": [
{
"serviceName": "siemensUDT2JSON",
"serviceLibrary": "siemensudtservice.dll",
"enabled": false
},
{
"serviceName": "v8TransformService",
"serviceLibrary": "v8transformservice.dll",
"enabled": false
}
],
"codeServices": [
{
"serviceName": "javascript",
"serviceLibrary": "v8transformservice.dll",
"enabled": true
}
],
"otherServices": [
{
"serviceName": "dbnotify",
"serviceLibrary": "./dbnotify/fcdbnotify.dll",
"enabled": false
},
{
"serviceName": "ctagent",
"serviceLibrary": "./agent/ctagent.dll",
"enabled": false
},
{
"serviceName": "thingworx",
"serviceLibrary": "./thingworx/ctthingworx.dll",
"enabled": false
},
{
"serviceName": "aggregation",
"serviceLibrary": "./aggregation/cttimestamp.dll",
"enabled": false
}
]
}
Default protocols, ports, and services
The table shows FairCom’s default mapping of each protocol to a TCP/IP port protocol. You can use services.json to configure how a FairCom server maps ports to protocols. You can assign any port to any protocol, and you can assign different ports to the same protocol. You can disable any configured port and service or remove them.
When FairCom provides multiple services over the same protocol, they are listed together in the same row.
Table 2. Default mapping of each protocol to a TCP/IP port and one or more services
| Service | Default port | Protocol | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
|
8080 | HTTP & WebSocket | FairCom's app server listens to this TCP/IP port to process HTTP and WebSocket requests. It is not secured by TLS. | ||||||
|
8443 | Secure HTTP & WebSocket |
FairCom's app server listens to this TCP/IP port to process HTTP and WebSocket requests. It is secured by TLS. The HTTP header returned by all JSON actions sets the content type to application/json ( |
||||||
| MQTT | 1883 | MQTT |
FairCom's MQTT broker listens to this TCP/IP port to process MQTT messages. It is not secured by TLS. All MQTT brokers default to this port. If you have installed another MQTT broker, MQTT messages will go to it, and FairCom's broker will likely get a port conflict error. |
||||||
| MQTTS | 8883 | Secure MQTT | FairCom's MQTT broker listens to this TCP/IP port to process MQTT messages. It is secured by TLS. | ||||||
| MQTTWS | 1884 | MQTT over WebSocket | FairCom's MQTT broker listens to this TCP/IP port to process MQTT messages over the WebSocket protocol. It is not secured by TLS. | ||||||
| MQTTWSS | 8884 | MQTT over Secure WebSocket | FairCom's MQTT broker listens to this TCP/IP port to process MQTT messages over the WebSocket protocol. It is secured by TLS. | ||||||
|
5597 | TCP/IP | FairCom's ISAM server listens to this TCP/IP port to process ISAM and CTDB function calls over FairCom’s wire protocol. It is optionally secured by TLS using the configuration file, ctsrvr.cfg. |
||||||
|
6597 | TCP/IP | FairCom's SQL server listens to this TCP/IP port to process SQL requests over FairCom’s SQL wire protocol. It is optionally secured by TLS using the configuration file, ctsrvr.cfg. |
||||||
|
FAIRCOMS or FCEDGEMQ |
Shared Memory |
FairCom's ISAM and SQL servers listen to a shared memory channel to process ISAM, CTDB, and SQL calls. Shared memory only works when the calling application runs on the same computer as the FairCom server. Because shared memory is faster, client libraries for FairCom ISAM, CTDB, and SQL APIs automatically use Shared Memory instead of TCP/IP when the client and server are on the same computer. The Shared Memory channel name is " |
- FairCom's JSON Action APIs support most server features, including creating databases, tables, indexes, inserting/updating/deleting records, querying data using JSON and SQL, sending and receiving MQTT messages, configuring the server, managing accounts and access rights, configuring data connectors to retrieve and push data to devices and software, transforming inserted data automatically, running server-side JavaScript code, managing data change streaming, and so forth.
- FairCom's connectors, such as OPC UA and Modbus, are not included in the table because they do not listen for incoming requests; instead, they connect to other servers to retrieve or push data.
- You can use services.json to configure the FairCom server to provide the same service over multiple ports, such as listening for JSON Action API calls over multiple ports.
- Shared Memory is not a TCP/IP protocol. Thus, it is not configured in
services.json. Instead, it is configured inctsrvr.cfg. - Since FairCom's ISAM and SQL protocols may use shared memory or TCP/IP, they are configured in
ctsrvr.cfg.
Configure ISAM ports for TCP/IP broadcast
The following information increases security risk.
Your vendor can create client applications that listen for an available FairCom server without knowing the server name in advance. A FairCom server can be configured to broadcast its server name and IP address over a TCP/IP port.
With this method, a client can detect the various FairCom servers operating on the network and obtain their server names, including IP addresses.
These server keywords support the broadcast features BROADCAST_PORT, BROADCAST_INTERVAL, and BROADCAST_DATA. See the examples in FairCom DB configuration options.
Broadcast features:
-
BROADCAST_PORTspecifies the TCP/IP port used for the broadcast. The default value is0, which means the broadcast is off. IfDEFAULTis specified, the broadcast is on, and the default port,5595, is used. Any valid four-byte integer greater than5000that is not in use by another process may be specified. This should NOT be the port for the FairCom server, which is displayed at startup and is based on the server name, see examples. -
BROADCAST_INTERVALdetermines the number of seconds between broadcasts. The default is10seconds, otherwise the token should be a number.
If the number is negative, each broadcast is also sent to the FairCom server's standard output.
The maximum value allowed is set to 86,400 seconds, once per day, to prevent unreasonable values.
-
BROADCAST_DATAspecifies a token to be broadcast following the server name. The token must not contain spaces. The server name will be followed by a vertical bar character, "|", which is followed by the token. There is no default token.
Using the following sample keywords and assuming the host IP address was 127.0.0.1, the FairCom server broadcasts “SAMPLE | 127.0.0.1 | 5451| FAIRCOM_SERVER” on port 6329 every 90 seconds:
Table 3. Sample keywords
| Broadcast feature | Token |
|---|---|
SERVER_NAME |
SAMPLE |
BROADCAST_PORT |
6329 |
BROADCAST_INTERVAL |
90 |
BROADCAST_DATA |
FAIRCOM_SERVER |
Enable and disable permanent sessions
To enable permanent sessions under "jsonActionApiDefaults" add "enablePermanentJsonApiSessions": true.
To disable permanent sessions under "jsonActionApiDefaults" add "enablePermanentJsonApiSessions": false or omit this property because it defaults to false.
"jsonActionApiDefaults":
{
"defaultApi": "hub",
"defaultBinaryFormat": "hex",
"defaultDatabaseName": "faircom",
"defaultDebug": "max",
"defaultOwnerName": "admin",
"defaultResponseOptions":
{
"binaryFormat": "hex",
"dataFormat": "objects",
"numberFormat": "number"
},
"idleConnectionTimeoutSeconds": 3600,
"idleCursorTimeoutSeconds": 600,
"defaultRetentionPolicy": "autoPurge",
"defaultRetentionUnit": "week",
"defaultRetentionPeriod": 4,
"maxJsonApiSessions": 1024,
"maxJsonApiSessionsPerIpAddress": 50,
"maxJsonApiSessionsPerUsername": 50,
"enablePermanentJsonApiSessions": true
},
Enable and disable web applications
Edit the <faircom>/config/services.json file to enable or disable the FairCom server from running all web applications or specific web applications.
All applications
To enable all web applications to run, set the "applicationRoot" property value to <faircom>/server/web/apps.
To disable all web applications from running set the "applicationRoot" property to an empty string (""), null, or omit it from services.json.
Examples
Allow applications to run
"applicationRoot": "<faircom>/server/web/apps",
"applications": []
Do not allow any applications to run
"applicationRoot": "",
"applications": []
Specific applications
Use the "applications" property in services.json to control when the FairCom server allows specific web applications to run. The FairCom server rejects all HTML page requests for an application unless it is properly enabled and configured in the "applications" property.
The
"applicationRoot"property value must also be set to enable web applications.
If these conditions are met, the FairCom server will return files found in the designated folder and its subfolders.
Examples
Allow the Ace Monitor application to run.
"applications":[
{
"serviceName": "Ace Monitor",
"folderName": "AceMonitor",
"uriPath": "AceMonitor",
"serviceLibrary": "ctmonitor.dll",
"enabled": true
}
]
Do not allow the Ace Monitor application to run.
"applications": [
{
"serviceName": "Ace Monitor",
"folderName": "AceMonitor",
"uriPath": "AceMonitor",
"serviceLibrary": "ctmonitor.dll",
"enabled": false
}
]
Configure ports for FairCom DB servers prior to version 12
The FairCom DB server for Windows is named ctreeace.exe (or ctsrvr.exe). FairCom DB servers prior to and including V11.0 were distributed with support for the communication protocols listed in the Communications protocols table.
Table 4. Communication protocols
| Protocol |
COMM_PROTOCOL keyword |
|---|---|
| TCP/IP | F_TCPIP |
| TCP/IP (using an IPv6 socket) | F_TCPIPV6 |
| Shared Memory | FSHAREMM |
| TCP/IP (Data Camouflage support - Deprecated) |
FETCPIP
|
The FairCom server for Windows defaults to the TCP/IP protocol. To activate any other protocol, use the COMM_PROTOCOL keyword in a ctsrvr.cfg file, discussed in Advanced configuration keywords. Use the name shown in the table above under COMM_PROTOCOL keyword as the token following the COMM_PROTOCOL keyword in ctsrvr.cfg.
The
COMM_PROTOCOLoption specifies the protocol used for ISAM connections. By default, local SQL connections use shared memory unless theSQL_OPTION NO_SHARED_MEMORYkeyword is specified. See theCOMM_PROTOCOLfor more information about the communication protocol for SQL connections.
The COMM_PROTOCOL keyword disables the default protocol, so if you want to load the default and another protocol, each must have a COMM_PROTOCOL entry in ctsrvr.cfg.
Example 3. Load all supported communication protocols for the FairCom server on Windows
COMM_PROTOCOL F_TCPIP
COMM_PROTOCOL FSHAREMM
COMM_PROTOCOL FETCPIP
If
COMM_PROTOCOLis specified for one protocol, all protocols to be used must be specified. If noCOMM_PROTOCOLis specified, the FairCom server uses the default, F_TCPIP.
The shared memory protocol eliminates the overhead of the TCP/IP protocol stack resulting in very fast communications. The only drawback is the client and server must reside in the same physical memory space. For client server applications running on the same machine, this can result in communications performance increases of almost 500% over TCP/IP in some instances.
Configure ports for FairCom DB server V12.0 through V12.5
Versions 12 through 12.5 of the FairCom DB server used the cthttpd.json file to manage ports. This section explains how that configuration file works. Newer versions of FairCom services use the services.json configuration file.
Modifying
- To modify
cthttpd.json, see Configuring the application server. - To modify
ctsrvr.cfg, see Configuring FairCom DB.
Example 4. Version 12 of cthttpd.json
{
"listening_http_port": 8080,
"listening_https_port": 8443,
"ssl_certificate": "./web/fccert.pem",
"document_root": "./web/apps",
"applications": [
"ctree;ctrest.dll",
"AceMonitor;ctmonitor.dll",
"SQLExplorer;ctsqlexplorer.dll",
"ISAMExplorer;ctisamexplorer.dll",
]
}
Example 5. Version 12.5 of cthttpd.json
{
"tls_certificate": "./web/fccert.pem",
"http_port": 8080,
"http_enabled": true,
"https_port": 8443,
"https_enabled": true,
"websocket_port": 8081,
"websocket_tls_connections_only": true,
"websocket_enabled": true,
"mqtt_port": 1883,
"mqtt_tls_connections_only": false,
"mqtt_enabled": true,
"app_root": "./web/apps",
"http_url_to_appserver_map": [
"mqtt;ctmqtt.dll",
"ctree;ctrest.dll",
"AceMonitor;ctmonitor.dll",
"SQLExplorer;ctsqlexplorer.dll",
"ISAMExplorer;ctisamexplorer.dll"
],
"websocket_url_to_appserver_map": [
"json_nav;json_nav.dll"
]
}
Table 5. Port descriptions
| Service | Port | Config file | Setting | Examples/Notes | ||||
|---|---|---|---|---|---|---|---|---|
| FairCom Web Applications | 8443 | services.json |
|
https://localhost:8443/ |
||||
| MQTT Explorer - SSL | 8443 | services.json |
|
|
||||
| SQL Explorer - SSL | 8443 | services.json |
|
|
||||
| ACE Monitor - SSL | 8443 | services.json |
|
|
||||
| REST API - SSL | 8443 | services.json |
|
https://localhost:8443/ctree/api/v1/openapi |
||||
| Insecure HTTP Port | 8080 | services.json |
|
The apps and REST API above can use this port when a secure connection is NOT required — for example, in a development lab | ||||
| Replication Manager | 7000 | ctagent.json |
"memphis_sql_port": 7000 |
FairCom’s Replication Manager web application | ||||
| MQTT | 1883 | services.json |
|
Publish and subscribe to MQTT messages | ||||
| WebSocket for JSON NAV API & MQTT protocol | 8081 | services.json |
|
Used by FairCom’s MQTT Explorer for MQTT messages | ||||
| c-treeDB, FairCom DB ISAM, FairCom Low-Level APIs | 5597 | ctsrvr.cfg |
SERVER_PORT 5597 |
Used by FairCom’s client driver to communicate with the server | ||||
| SQL API | 6597 | ctsrvr.cfg |
SQL_PORT 6597 |
Used by FairCom’s Server for SQL communications
|
||||
| Node‑RED | 1880 | settings.js |
"uiPort": 1883 |
Node-RED is an open-source project that can use the FairCom server. It is not a FairCom product. Its configuration file,
|
FairCom ports are configured in configuration files located in <faircom>/config. You can change them using any text editor.
Rules:
- Files with the
.jsonextension must follow the syntax rules of JSON files. - Files with the
.cfgextension are FairCom’s configuration files.- One property per line
- The property name is followed by white space and the property value.
- A semi-colon at the beginning of the line comments out the line.
As always, be security conscious of which database services are running and listening on ports. Less access is better. You can turn off services by disabling plug-ins.
If the
localhostdomain name does not work, use the IP Address127.0.0.1.
Memory usage
Memory usage in a FairCom server can be adjusted to match the capabilities of your hardware.
The defaults are 100 MB Data Cache, 100 MB of Index Cache, 100 MB of Sort Cache, 1024 maximum files (tables plus indexes), and 32 simultaneous connections. This configuration is designed for medium-sized environments, such as edge gateways.
Increasing the values for files, connections, and caches causes the FairCom server to use additional RAM. Conversely, decreasing these values reduces the RAM consumed.
The number of connections and files is the greatest factor in determining RAM because each connection consumes RAM for each file that is opened.
See Server Memory Calculations to help estimate your memory footprint for a given configuration.
Default memory settings
You can manage the RAM consumed by the FairCom server by changing the settings in the ctsrvr.cfg file. The following default settings consume approximately 8 GB RAM when all connections and files are open.
Table 1. Default memory settings
| Setting | RAM |
|---|---|
| CONNECTIONS | 32 |
| FILES | 1024 |
| DAT_MEMORY | 100 MB |
| IDX_MEMORY | 100 MB |
| SORT_MEMORY | 100 MB |
Example 1. Small device example
On a small device, you can reduce RAM usage to a maximum of around 60 MB using the following settings:
Table 2. Small device example
| Setting | RAM |
|---|---|
| CONNECTIONS | 5 |
| FILES | 60 |
| DAT_MEMORY | 10 MB |
| IDX_MEMORY | 10 MB |
| SORT_MEMORY | 10 MB |
Example 2. Large hub example
On a large computer, you can increase the settings to handle many more tables, indexes, and concurrent connections. The settings below are an example for a larger integration hub that consumes a maximum of around 30 GB RAM when all connections and files are open:
Table 3. Large hub example
| Setting | RAM |
|---|---|
| CONNECTIONS | 300 |
| FILES | 600 |
| DAT_MEMORY | 500 MB |
| IDX_MEMORY | 500 MB |
| SORT_MEMORY | 500 MB |
Example 3. Large data center example
On a high-end server, you can increase the settings to handle very large numbers of tables, indexes, concurrent connections, and cache. The upper limits are 1 million files and 4096 connections.
The settings below are an example for a huge server that consumes a maximum of around 2 TB RAM when all connections and files are open:
Table 4. Large data center example
| Setting | RAM |
|---|---|
| CONNECTIONS | 1000 |
| FILES | 2500 |
| DAT_MEMORY | 50000 MB |
| IDX_MEMORY | 50000 MB |
| SORT_MEMORY | 50000 MB |
To learn more about these settings, see:
In addition to the number of files and users, many parameters, such as those that affect cache sizes, can be adjusted to further tailor the FairCom Server to your needs.
For more details, see Caching and data integrity recommendations.
Server memory calculations
This document provides information about the memory that the FairCom Server uses, including formulas to calculate the server's expected memory use based on the configuration options and usage patterns.
The FairCom Knowledgebase has a memory use calculator spreadsheet that can help you evaluate the best memory usage.
Baseline server memory use
The FairCom Server startup memory requirements are calculated using the following equation:
Baseline Memory =
Server binary size +
Data cache size +
Index cache size +
System file control blocks +
Lock wait-for graph +
Global array sizes
Server binary size:
Calculate the server binary size by adding the size of the executable on disk and the sizes of all the shared libraries that the server process loads.
Data cache size:
The data cache size is set using the DAT_MEMORY configuration option. It defaults to 100 MB.
Index cache size:
The data cache size is set using the IDX_MEMORY configuration option. It defaults to 100 MB.
System file control blocks:
At startup, the server allocates an array of pointers to hold the system file control blocks. The number of entries in the array is set to the FILES configuration option. Each time a file uses a previously unused system file number, the server allocates a system file control block for that system file number and memory use increases by the size of the system file control block structure (CTFILE).
Initial allocation size:
FILES * sizeof(CTFILE *)
Size when fully used:
FILES * sizeof(CTFILE *) + FILES * (sizeof(CTFILE) + alignment)
Example structure size for 64-bit Windows server:
sizeof(CTFILE) + alignment = 4720
Lock wait-for graph:
The server allocates a two-dimensional array that it uses to detect that a blocking lock request would cause a deadlock. The array uses two bits per entry and uses the maximum number of connections set by the CONNECTIONS configuration option for both dimensions of the array.
Allocation size in bytes:
CONNECTIONS * CONNECTIONS / 4
Global array sizes:
The server allocates a number of global arrays. Many of these arrays are sized based on the maximum number of supported connections that is set in the server binary at compile time. This value, MXU2, is currently set to 10287 for a 64-bit server and to 4143 for a 32-bit server.
Some of the sizes of the global arrays depend on the CACHE_LINE configuration option, since this option causes those array elements to be aligned on a multiple of the specified cache line size. Supported CACHE_LINE values are: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, and 1024. If an invalid CACHE_LINE option is specified in the configuration file, the server logs a warning message to CTSTATUS.FCS and uses the default value.
The total global array size for a 64-bit server is approximately 74 MB when using the default CACHE_LINE size of 128.
Memory use for each ISAM connection
Base memory use for each ISAM connection is approximated as follows. <fils> is the fils parameter value specified by the client when connecting to the server.
Thread stack size +
Communication buffer size +
Record compression buffer size +
Schema conversion buffer size +
Connection level state information +
ISAM level state information +
Block encryption buffer +
User file control blocks +
Transaction mark list buffer +
Preimage space hash bins +
ISAM context hash bins +
ISAM context state +
User level lock hash bins+
Preimage space entries +
Lock table entries
Thread stack size:
Each thread allocates a stack. The thread stack size is set as follows:
On Windows systems:
- For ISAM threads, the stack size is set to 64 KB and cannot be changed.
- For SQL threads, the stack size defaults to 1 MB for servers that don't support Unicode and to 1.5 MB for servers that support Unicode.
- The stack size for SQL threads can be changed by using the server configuration option
SETENV DH_THREAD_STACK_SZ_KB=<stack_size_in_kilobytes>
On Unix systems:
- For ISAM threads, the stack size defaults to 64 KB.
- For SQL threads, the stack size defaults to 1.5 MB for servers that don't support Unicode and to 3.5 MB for servers that support Unicode.
- The stack size for ISAM and SQL threads can be changed by using the server configuration option
SETENV DH_THREAD_STACK_SZ_KB=<stacksize_in_kilobytes>
Communication buffer size:
The communication buffer is initially 4 KB. When the client reads or writes a record that exceeds the current communication buffer size, the server allocates a sufficiently-sized communication buffer to hold the record. The communication buffer remains allocated at that larger size until the client disconnects.
The server configuration option
TRIM_USER_MEMORY YEScan be used to cause the server to periodically check if the communication buffer exceeds 1 MB, and if so it reduces the communication buffer to its default size of 4 KB.
Record compression buffer size:
A connection that reads or writes records that use data record compression allocates a buffer to hold the uncompressed record image. This buffer remains allocated until the client disconnects.
The server configuration option
TRIM_USER_MEMORY YEScan be used to cause the server to periodically check if the communication buffer exceeds 1 MB, and if so it reduces the communication buffer to its default size of 4 KB.
Schema conversion buffer size:
A connection that reads records from a table that has had a hot alter operation performed on it might need to convert records from an older version of the record schema to the current schema version. As a performance enhancement, the server allocates a schema conversion buffer to hold the converted record image. This buffer remains allocated until the client disconnects.
The server configuration option
TRIM_USER_MEMORY YEScan be used to cause the server to periodically check if the communication buffer exceeds 1 MB, and if so it reduces the communication buffer to its default size of 4 KB.
Connection level state information:
The server allocates memory to hold connection level state information in the format of a CTGV structure.
Example CTGV structure size for 64-bit Windows: 14736 bytes
ISAM level state information:
The server allocates memory to hold ISAM state information. The amount of memory depends on the sizes of the CTIS, CTIS1, and CTIS2 structures, the size of the FILNO data type, and the maximum number of files requested by the client when it connects to the server. The server automatically increases the file number limit as needed when the client requests using a file number that exceeds the current file number limit, up to the MAX_FILES_PER_USER server configuration option.
The formula for calculating ISAM memory use is as follows, where <fils> is the maximum number of files requested by the client:
sizeof(CTIS) +
<fils> * sizeof(CTIS1) +
<fils> * sizeof(CTIS2 *) +
2 * <fils> * sizeof(FILNO *) +
<fils> * MAX_KEY_SEG * sizeof(CTIS2) +
2 * <fils> * MAX_DAT_KEY * sizeof(FILNO)
Typical values for 64-bit Windows are:
sizeof(CTIS) = 3160
sizeof(CTIS1) = 80
sizeof(CTIS2 *) = 8
sizeof(FILNO) = 4
sizeof(CTIS2) = 12
MAX_KEY_SEG = 16
MAX_DAT_KEY = 64
Block encryption buffer:
For each connection the server allocates a buffer for encrypting data in blocks of size 32768 rounded up to a multiple of the LOG_PAGE_SIZE server configuration option (which defaults to 8192).
User file control blocks:
The server allocates memory to hold connection level state information about each file that a connection has opened. The amount of memory depends on the size of the FUSR structure and the maximum number of files requested by the client when it connects to the server. The server automatically increases the file number limit as needed when the client requests using a file number that exceeds the current file number limit, up to the MAX_FILES_PER_USER server configuration option, which defaults to 32767.
The formula for calculating user file control block memory use is as follows, where <fils> is the maximum number of files requested by the client:
<fils> * sizeof(FUSR)
A typical value for 64-bit Windows is:
sizeof(FUSR) = 504
Transaction mark list buffer:
The server allocates a buffer to manage transaction marks in index nodes. The buffer size is given by the following formula:
PAGE_SIZE / 128 * 16 * 6
PAGE_SIZE defaults to 32768.
Preimage space hash bins:
The server allocates hash bins for efficiently searching preimage space. The memory use is given by the following formula:
PREIMAGE_HASH * sizeof(SHADLST *)
PREIMAGE_HASH defaults to 128.
sizeof(SHALST *) is 8 for 64-bit systems and 4 for 32-bit systems.
ISAM context hash bins:
The server allocates hash bins for efficiently searching ISAM contexts. The memory use is given by the following formula:
CONTEXT_HASH * sizeof(ctICON *)
CONTEXT_HASH defaults to 6.
sizeof(ctICON *) is 8 for 64-bit systems and 4 for 32-bit systems.
ISAM context state:
Each ISAM context allocates memory for each index whose state is stored in the ISAM context. The formula to calculate the memory use is as follows:
(sizeof(ctCONBUF) + key length) rounded up to multiple of sizeof(ctCONBUF)
sizeof(ctCONBUF) is 24 for 64-bit systems and 16 for 32-bit systems.
User level lock hash bins:
The server allocates hash bins for efficiently searching the user lock table. The memory use is given by the following formula:
LOCK_HASH * sizeof(ULOKHSH)
LOCK_HASH defaults to 16.
sizeof(ULOKHSH) is 16 for 64-bit systems and 8 for 32-bit systems.
Preimage space entries:
Each operation on a transaction controlled file creates a preimage space entry, which contains information about the operation. This information can include a data record image or a key value.
Memory used for each preimage space entry:
sizeof(SHADLST) + data length
data length is the size of the record image or a key value
Example structure size for 64-bit Windows server:
sizeof(SHADLST) = 128
Lock table entries:
Each record that is locked has a system lock table entry (RECLOK). Each record lock request creates a user lock table entry (LOKS). Because more than one read lock can be held on a particular record, when using read locks more than one user level lock entry can exist for a system lock table entry.
Table read locks and table write locks can be used to reduce memory use by locking the entire table rather than locking a large number of individual records.
Memory used for each record that is locked:
sizeof(RECLOK) + alignment
Memory used for each record lock that a connection has acquired:
sizeof(LOKS) + alignment
Example sizes for 64-bit Windows server:
sizeof(RECLOK) + alignment = 88
sizeof(LOKS) + alignment = 40
Manage FairCom DB plug-ins
Beginning with FairCom V12 a new ability to extend functionality with advanced modular capabilities is provided. Using a new plug‑in architecture, advanced features can be quickly dropped in using independently configured plug-ins that are provided as a shared object with companion configuration file entries. Each plug-in is usually self-contained in its own folder. All plug-in configurations are stored in the <faircom>\config folder.
Several plug‑ins are provided by default. The following plug-ins are provided beginning with V12:
- HTTP web services
- MQTT message services
- REST API services
- OPC communication protocols for Industrial IoT (IIoT) services
- UA communication interface for IIoT services
- PTC ThingsWorx® IIoT integration
- PTC ThingWorx® AlwaysOn IIoT protocols
Most of the provided plug-ins are not enabled by default to maximize security and minimize memory usage. FairCom plug‑ins are securely implemented but they can increase the attack surface by possibly opening additional network ports and listening across alternative communication protocols.
Plug-ins are enabled as needed in the standard FairCom ctsrvr.cfg and services.json files. Each plug-in is individually enabled using a configuration line that includes its configured name and shared object location.
Example
; Plugins
PLUGIN cthttpd;./web/cthttpd.dll
PLUGIN ctagent;./agent/ctagent.dll
The ctsrvr.cfg configuration file is now located in <faircom>\server\config (this location is optional and existing locations are supported for full backward compatibility).
Dynamic plug-ins
Interface for Managing Plug-ins on the fly
Beginning with V13, FairCom plug-in support has been enhanced by providing multiple interfaces for loading, starting, and stopping FairCom plug-ins on the fly. Previously, all plug-ins had to be configured and enabled at server launch. Now plug-ins can be loaded, started, and stopped on demand without restarting the server.
Loading, starting, and stopping plug-ins can be accomplished by either uncommenting them in the ctsrvr.cfg server configuration file, using the ctadmn command-line utility, or calling C API functions. A plug-in must first be loaded then it can be started and stopped.
Command-Line Administrator Utility
You can call ctadmn as a command-line utility to start and stop a plug-in using the following syntax:
ctadmn -s <server name> -u <user name> -p <password> -c "<command>"
where the <command> is enclosed in quotes as in the following format:
"plugin <plug-in name> start|stop"
ctadmn can execute any generic operation from the plug-in using the following syntax:
ctadmn -s <server> -u <user> -p <password> -c "plugin <plug-in name> <command> <arguments>"
Example 1 - Execute the ctadmn command-line utility with direct arguments and start the web services plug-in:
ctadmn -s FAIRCOMS -u ADMIN -p ADMIN -c "plugin cthttpd start"
Example 2 - Execute the ctadmn command-line utility interactively using option 10 to load and start the web services plug-in:
- Execute the
ctadmnutility. - Select option 10 - "Change Server Settings."
- Again select option 10 - "Change the specified configuration option."
- Enter the configuration option and its value:
>> PLUGIN cthttpd;./web/cthttpd.dll
Successfully changed the configuration option.
Example 3 – Use the ctadmn command-line utility to restart the OPC/UA plug-in after changing the settings:
- Edit the ctopc.json file to add a device or change the connection details to a device.
- Stop the OPC plug-in via ctadmn: ctadmn -s FAIRCOMS -u ADMIN -p ADMIN -c "plugin ctopc stop"
- Restart the plug-in via ctadmn: >ctadmn -s FAIRCOMS -u ADMIN -p ADMIN -c "plugin ctopc start"
- The OPC/UA plug-in will now load the modified configuration file and use the new settings.
Control plug-ins using C API functions
Control plug-ins using the ctSETCFG() and ctPlugin() functions. Use ctSETCFG() to load a plug-in, and use ctPlugin() to start or stop a loaded plug-in.
Example 1 - Load the web services plug-in:
ctSETCFG(setcfgCONFIG_OPTION, "PLUGIN cthttpd;./web/cthttpd.dll");
Where:
-
setcfgCONFIG_OPTIONis a general-purpose option used for passing a string value. -
"PLUGIN cthttpd;./web/cthttpd.dll"(in quotes) is a string containing the same plug-in name and path as shown in yourctsrvr.cfgserver configuration file.
Example 2 - Start the web services plug-in:
NINT ctPlugin(ctPLUGIN_COMMAND command, pTEXT inputBuffer, pTEXT outputBuffer, pVRLEN pOutputBufferSize);
Where:
- command: currently, the options are ctPLUGIN_START or ctPLUGIN_STOP (defined by the ctPLUGIN_COMMAND enum type)
- inputBuffer is flexible; currently, it expects only the plug-in name (loaded in the server by the PLUGIN keyword in
ctsrvr.cfg) - outputBuffer: Starting and stopping plug-ins does not have any output, so this is unused. Pass a pointer to a TEXT string.
- pOutputBufferSize: Starting and stopping plug-ins does not have any output, so this is unused. Pass a pointer to a VRLEN number set to the length of the string passed to
outputBuffer.
Example 3 - Stop the web services plug-in:
ctPlugin(ctPLUGIN_STOP, " cthttpd ",outBuff,&outBuffLen);
Multiple server instances
Prerequisites for running multiple servers on one computer:
Separate instances of the FairCom server cannot share any files, server names, licenses, or ports.
- Each instance must be individually licensed with its own license file.
- Each instance must be installed in a separate folder so that each has a unique set of server, configuration, and data files.
- Each instance must have a unique server name.
- Each instance must have unique communications ports.
- Each server UUID must, in fact, be unique.
Give the FairCom server a unique name
FairCom's default server names
- On most FairCom products, the default server name is
FAIRCOMS. - On FairCom MQ, the default server name is
FCEDGEMQ.
Change the server name:
- Navigate to and open the
ctsrvr.cfgfile. - Update the
SERVER_NAMEvalue to the server name of your choice.
; Server Name
SERVER_NAME FAIRCOMS
- Save your changes to the
ctsrvr.cfgfile.
Configure each server with unique ports
See Configure ports to change the ports you are using for each instance of the FairCom server.
Port conflicts are the most common problem with running multiple instances of FairCom on the same computer. The FairCom server has many ports that are changed in several different configuration files. Be sure to change all ports that you are using and to use ports that are not in use; otherwise, port conflicts can prevent you from communicating with the FairCom server.
Assign a unique UUID
Delete the metadata.json file located in the <faircom>/data folder.
When you start the FairCom server it will be assigned a unique UUID.
When a server starts up, if it does not already have a UUID, one is assigned that uniquely identifies it.
The UUID is stored by default in the
<faircom>/datafolder in a file calledmetadata.json. Deletingmetadata.jsonand restarting the server resets the server UUID by creating a new one.If you duplicate a server folder or copy the data folder from one server to another without deleting the
metadata.jsonfile, this will result in a duplicate UUID, causing unpredictable results. In particular, if you are using the Replication Manager, the two servers will be seen as the same server.To remove a duplicate server UUID, delete
metadata.jsonin the data folder of one of the servers, then restart the server to reset the UUID.
Parameter limits
FairCom APIs use required and optional parameters to complete specific operations. The following table shows the limits of these parameters.
Table 1. General limits (FairCom database engine)
| Attribute | Description | Limits |
|---|---|---|
| field length |
Length of a column for CHAR, VARCHAR, BINARY, and VARBINARY field types. NCHAR and NVARCHAR fields have different limits because they specify the number of two-byte characters instead of bytes. |
1 to 65,500 bytes 1 to 32,752 two-byte characters |
| fields per table | Number of fields or columns in a table | 1 to 2,500 |
| group | Number of users in a group | 0 to 16 per user |
| indexes | Number of indices per data file | 0 to 64 (configurable) |
| indexed columns per table | Maximum number of SQL columns used in all of a table's indexes | 2,048 (configurable) |
| index key size | Number of bytes in one index key | 1 to 1,024 |
| index segments | Number of ISAM segments per index | 1 to 16 (configurable) |
| memory files | Memory file limitations | See Memory File Limitations |
| name length | Length of an identifier, including the name of a database, table, index, field, sequence, stored function, stored procedure, etc. | 1 to 64 bytes |
| open file number | The file number (filno) returns when the server opens a data file |
1 to 4,294,963,200 |
| open files | Number of concurrently opened files | 1 to 1 million |
| password | Length of a password | 1 to 1024 bytes |
| record, fixed-length | Size of a fixed length record | 1 to 64KB |
| record, variable-length | Size of a variable length record | 1 to 2GB |
| records per table | Number of records per table or data file | 0 to 1 quintillion |
| table name | A table name has a limited length. In SQL, a table name is case insensitive and is limited to the following characters: A-Z, a-z, 0-9, ., _, and - unless the name is enclosed double quotes | 1 to 64 bytes |
| table size | Size of a data file | 0 to 16 exabytes |
| user name | User name has a limited length and is limited to the following characters: A-Z, a-z, 0-9, ., _, and - | 1 to 31 bytes POSIX standard |
Table 2. FairCom SQL limits
| Attribute | Description | Limits |
|---|---|---|
| SQL check constraint clause | Length of a SQL CHECK constraint clause | 20,000 bytes |
| SQL check constraints per table | Number of check constraints in a table | 0 to 4,000 |
| SQL connection string | Length of a SQL connection string | 0 to 100 bytes |
| SQL column's default value | Maximum length of a field's default value | 0 to 8,192 bytes |
| SQL error message | Length of a SQL error message | 0 to 511 bytes |
| SQL foreign constraints per table | Number of foreign constraints in a SQL table | 0 to 4,000 |
| SQL procedure arguments | Number of arguments in a SQL CALL statement | 0 to 50 |
| SQL recursion level | Number of SQL recursion levels for stored procedures | 0 to 10 |
| SQL statement input parameters | Number of input parameters in a SQL statement | 0 to 512 |
| SQL statement length | Length of a SQL statement | 1 to 32MB (before V10.2, 35,000 characters) |
| SQL statement nested levels | Number of nested levels in a SQL statement, such as nested view references | 0 to 25 |
| SQL statement outer references | Number of outer references in a SQL statement | 0 to 250 to 25 |
| SQL statement table references | Number of table references in a SQL statement | 1 to 250 |
| SQL storage attribute clause | Length of a SQL storage_attribute clause |
0 to 2,000 bytes |
| SQL view statement | Length of the SQL statement that creates a view | 1 to 65,000 bytes |
Disk reads/writes
A large variable-length record read or write operation could fail with Windows error 1450. To avoid this Windows error, see Enforce Maximum Disk Read/Write Sizes on Windows to set the maximum read/write size.
File ID
The file ID number of a transaction-controlled file is incremented each time the file is opened. If error 534, Pending File ID overflow: 534 is written to CTSTATUS.FCS see File ID Overflow.
File size
The file size limit is 16 Exabytes (18 million terabytes). See File Size and Operating System Limits for more information.
Group
The System Administrator can create one or more Groups. Each group is assigned a unique Group ID that is a 32-byte ASCIIZ string.
To provide a convenient way for users with related needs to share information, each user is assigned membership in one to 16 groups. The Administrator adds the groups to the system and assigns users to them. Each user has a default group, which counts as one of the user's 16 groups. If a user is not assigned to a group, the user's default group is the GUEST group.
When an application program logs on to the FairCom Server with one of the extended functions, it sends a User ID and user password to the FairCom Server. Logging on with one of the equivalent standard functions or sending a NULL User ID with one of the extended functions automatically assigns the User ID of GUEST and membership in the GUEST group. If a User ID or password that does not exist is sent, the initiating call to the FairCom Server returns an error code, and the program is not connected to the FairCom Server.
Index
The index limit defaults to 64 but can be increased using MAX_DAT_KEY in ctsrvr.cfg to a theoretical limit of 32767, although a practical limit exists well before this value.
Password
Each User can have an optional user password. The password limit is 15 to 1024 bytes. For more information about passwords, see Automatically Enforce Password Strength and Setting password requirements.
Segment
The segment limit defaults to 16 but can be increased using MAX_KEY_SEG in ctsrvr.cfg to a theoretical limit of 32767, although a practical limit exists well before this value.
SQL Table index component
The limits of the table index components are configurable in ctsrvr.cfg by MAX_DAT_KEY (default 64) and MAX_KEY_SEG (default 32).
Table name
Table names must meet the following requirements:
- Must be 64 bytes or less in length
- Must start with an upper or lowercase letter
- Must not contain special characters other than underscore "_"
- Can include a mix of upper-lower case characters, but are treated as case-insensitive.
Actions that take a
“tableName”will return an Error 4054 if the table name does not meet these requirements. If this error is returned by"createTable","createIntegrationTable","createInput", or"createTransform", check the supplied"tableName"property to ensure it meets requirements.
User
A user name, user ID, or account name is a 32-byte null-terminated ASCII string, which implies 31 bytes are available. The following characters are allowed in the name:
- ABCDEFGHIJKLMNOPQRSTUVWXYZ
- abcdefghijklmnopqrstuvwxyz
- 0123456789
- ._-
- A hyphen character (-) cannot be used as the first character.
The server ignores the case of the ASCII characters. Therefore, the server considers TEST_1.FairCom-4 to be the same as test_1.faircom-4.
FairCom based these limitations on the POSIX standard for the Portable Filename Character Set.