Skip to content

config v1

Yatao Li edited this page Aug 7, 2017 · 1 revision

id: configv1 title: Configuration File Specification (Version 1.0) permalink: /docs/manual/Config/config-v1.html

A Graph Engine Configuration File is an XML file with the default name trinity.xml. When a Graph Engine instance is initialized, it will automatically load the default configuration file, unless TrinityConfig.LoadConfig(...) is explicitly called. The file can contain configuration settings for a single machine and/or a cluster of machines.

Root Node

The root node is always Trinity. There must be exactly one root node. The root node has an optional attribute ConfigVersion.

ConfigVersion

Optional. Specifies the version of the configuration file. Currently, the value must be 1.0 or 2.0 if specified. The value "1.0" indicates that the configuration file conforms to the specification 1.0 given here. Note, if ConfigVersion is not specified, the configuration file will be parsed as version 1.0.

Note, nuget package GraphEngine.Core 1.0.8482 and below only support configuration specification 1.0.

All valid nodes under Trinity node are section nodes.

Sections

A top-level node under the root node must be a section node. A section is identified by its name attribute, for example, <section name="Storage">...</section>. Each section contains a number of entries. An entry is identified by its name attribute, for example, <entry name="StorageRoot">...</entry>.

Storage Section

The Storage section can have one optional entry StorageRoot.

StorageRoot

Optional. Specifies the path of a directory for saving and loading Graph Engine disk images. The default path is the storage directory in AssemblyPath.

Servers Section

The Servers section specifies the endpoints and configurations of the servers in a cluster. It can have a number of Server entries. The value of a Server entry is an Hostname:Port string that describes the server endpoint.

Each Server entry can have the following attributes.

AvailabilityGroup

Optional. Each server is associated with an availability group. This attribute specifies the identifier of the availability group that the current server belongs to. If not specified, each server will be in its own default availability group. Multiple Server nodes could have the same availability group. The servers within the same availability group correspond to the same server Id in MemoryCloud.SendMessage(...). The ServerId parameter in the SendMessage method is the index number of the availability group. Note, when this attribute is used, all Server nodes within a Cluster node must specify the attribute or none of them should specify.

AssemblyPath

Optional. Specifies the directory of the running Graph Engine instance. Useful for running multiple Graph Engine instances on the same machine (listening on different ports, or bound to different network interfaces).

StorageRoot

Optional. Specifies the path of a directory for saving and loading Graph Engine disk images. The default path is the storage directory in AssemblyPath.

LoggingLevel

Optional. Specifies the logging level. Its value must be one of the following: Verbose, Debug, Info, Warning, Error, Fatal, Off. The default level is Info.

Multiple Server entries can be specified is for easily deploying Graph Engine to a cluster of machines using a single configuration file. For a Graph Engine cluster consisting of multiple machines, when a Graph Engine instance is started, it loads its server configuration from one of the Server entries according to the following rules:

  • The Endpoint property matches one of the network interfaces of the machine on which the Graph Engine instance is running.
  • If AssemblyPath is specified, it matches the directory where the running Graph Engine instance resides.

Proxies Section

The Proxies section specifies the endpoints and configurations of the proxies in a cluster. The structure of a Proxy section is the same as that of a Server section.

Network Section

The Network section can have the following entries.

HttpPort

Optional. If a server/proxy has an Http endpoint, it will listen on the specified Http port after it is started. The value is an integer. When a negative integer is specified, the HTTP server is disabled and no port will be opened. The default port is 80.

ClientMaxConn

Optional. Specifies how many network connections will be established between a client and a Graph Engine communication instance. The default value is 2.

Logging Section

The Logging section can have the following entries.

LogDirectory

Optional. Specifies the path of a directory to store log files. The default path is the trinity-log directory in AssemblyPath.

LogLevel

Optional. Specifies the logging level. Its value must be one of the following: Verbose, Debug, Info, Warning, Error, Fatal, Off. The default level is Info.

Sample Configuration File

<?xml version="1.0" encoding="utf-8"?>
<Trinity>
  <section name="Storage">
    <entry name="StorageRoot">D:\storage</entry>
  </section>
  <section name="Servers">
    <entry name="Server">192.168.0.1:5304</entry>
    <entry name="Server">192.168.0.2:5304</entry>
  </section>
  <section name="Proxies" />
  <section name="Network">
    <entry name="ClientMaxConn">2</entry>
  </section>
  <section name="Logging">
    <entry name="LoggingLevel">Info</entry>
  </section>
</Trinity>
Clone this wiki locally