Apache Geode Native C++ CHANGELOG

System Level Configuration

Attribute Definition Priority

You can specify attributes in different ways, which can cause conflicting definitions. Applications can be configured programmatically, and that has priority over other settings.

In case an attribute is defined in more than one place, the first source in this list is used:

  • Programmatic configuration
  • Properties set at the command line
  • current-working-directory/geode.properties file
  • native-client-installation-directory/defaultSystem/geode.properties file
  • defaults

The geode.properties files and programmatic configuration are optional. If they are not present, no warnings or errors occur. For details on programmatic configuration through the Properties object, see Defining Properties Programmatically.

Search Path for Multiple Properties Files

The client and cache server processes first look for their properties file in the native-client-installation-directory/defaultSystem directory, then in the working directory.

Any properties set in the working directory override settings in the native-client-installation-directory/defaultSystem/geode.properties file.

The geode.properties file provides information to the client regarding the expected server configuration. Properties set in this file (in the client environment) do not have any effect on the server itself. Its main purpose is to inform the client application as to how to communicate with the server.

Defining Properties Programmatically

You can pass in specific properties programmatically by using a Properties object to define the non-default properties.

Example:

auto systemProps = Properties::create();
systemProps->insert("statistic-archive-file", "stats.gfs");
systemProps->insert("cache-xml-file", "./myapp-cache.xml");
systemProps->insert("stacktrace-enabled", "true");
auto cache = CacheFactory(systemProps).create();    

About the geode.properties Configuration File

The geode.properties file provides local settings required to connect a client to a distributed system, along with settings for licensing, logging, and statistics. See System Properties.

Configuration File Locations

A client looks for a geode.properties file first in the working directory where the process runs, then in native-client-installation-directory/defaultSystem. Use the defaultSystem directory to group configuration files or to share them among processes for more convenient administration. If geode.properties is not found, the process starts up with the default settings.

For the cache.xml cache configuration file, a client looks for the path specified by the cache-xml-file attribute in geode.properties (see System Properties). If the cache.xml is not found, the process starts with an unconfigured cache.

Using the Default Sample File

A sample geode.properties file is included with the Apache Geode native client installation in the native-client-installation-directory/defaultSystem directory.

To use this file:

  1. Copy the file to the directory where you start the application.
  2. Uncomment the lines you need and edit the settings as shown in this example:

    cache-xml-file=test.xml
    
  3. Start the application.

Default geode.properties File

# Default C++ distributed system properties
# Copy to current directory and uncomment to override defaults.
#
## Debugging support, enables stacktraces in  apache::geode::client::Exception.
#
# The default is false, uncomment to enable stacktraces in exceptions.
#stacktrace-enabled=true
#crash-dump-enabled=true
#
#
## Cache region configuration
#
#cache-xml-file=cache.xml
#
## Log file config
#
#log-file=gemfire_cpp.log
#log-level=config
# zero indicates use no limit.
#log-file-size-limit=0
# zero indicates use no limit. 
#log-disk-space-limit=0 
...

Configuring System Properties for the Client

The typical configuration procedure for a client includes the high-level steps listed below.

  1. Place the geode.properties file for the application in the working directory or in native-client-installation-directory/defaultSystem.
  2. Place the cache.xml file for the application in the desired location and specify its path using the cache-xml-file property in the geode.properties file.
  3. Add other attributes to the geode.properties file as needed for the local system architecture.

Running a Client Out of the Box

If you start a client without any configuration, it uses any attributes set programmatically plus any hard-coded defaults (listed in System Properties). Running with the defaults is a convenient way to learn the operation of the distributed system and to test which attributes need to be reconfigured for your environment.

Running based on defaults is not recommended for production systems, as important components, such as security, might be overlooked.