8.2. Configuration

This section describes how to configure Neo4j Fabric.

This section describes the following:

8.2.1. Fabric database setup

Fabric must be set on a standalone Neo4j DBMS: the settings in neo4j.conf are identified by the fabric namespace. The minimal requirements to setup Fabric are:

  • A virtual database name: this is the entry point used by the client applications to access the Fabric environment.
  • One or more Fabric graph URI and database: this a reference of a URI and a database for each graph set in the Fabric environment.

8.2.1.1. Development setup example

Consider a standalone Neo4j DBMS which has two databases, db1 and db2. Note that all databases except for the default and system must be created using the CREATE DATABASE.

The simplest configuration of Fabric is:

fabric.database.name=example

fabric.graph.0.uri=neo4j://localhost:7687
fabric.graph.0.database=db1

fabric.graph.1.uri=neo4j://localhost:7687
fabric.graph.1.database=db2

It comprises the Fabric database, named example and accessible via the default URI, i.e., neo4j://localhost:7687, and two Fabric graphs, uniquely identified with the ID 0 and 1.

Figure 8.4. Minimal Fabric setting in a development setup
fabric minimal setting

8.2.1.2. Naming graphs

Fabric graphs may also be identified by a name, which can be configured with the setting, fabric.graph.<ID>.name. For example, if the given names are graphA (associated to db1) and graphB (associated to db2), the two additional settings will be:

fabric.graph.0.name=graphA
fabric.graph.1.name=graphB

This way, you can access a graph by using either:

  • The graph name:

    USE example.graphA
    MATCH (n)
    RETURN count(n) AS countNode
  • The graph ID:

    USE example.graph(0)
    MATCH (n)
    RETURN count(n) AS countNode

8.2.1.3. Cluster setup with no single point of failure example

In this example, all components are redundant and data is stored in a Causal Cluster. In addition to the settings described in the previous example, a setting with no single point of failure requires the use of the routing servers parameter, which specifies a list of standalone Neo4j DBMSs that expose the same Fabric database and configuration. This parameter is required in order to simulate the same connectivity that client applications use with Causal Cluster, i.e. in case of fault of one instance the client application may revert to another existing instance.

Assume that in this example, the data is stored in three databases: db1, db2 and db3. The configuration of Fabric would be:

dbms.mode=SINGLE

fabric.database.name=example
fabric.routing.servers=server1:7687,server2:7687

fabric.graph.0.name=graphA
fabric.graph.0.uri=neo4j://core1:7687,neo4j://core2:7687,neo4j://core3:7687
fabric.graph.0.database=db1

fabric.graph.1.name=graphB
fabric.graph.1.uri=neo4j://core1:7687,neo4j://core2:7687,neo4j://core3:7687
fabric.graph.1.database=db2

fabric.graph.2.name=graphC
fabric.graph.2.uri=neo4j://core1:7687,neo4j://core2:7687,neo4j://core3:7687
fabric.graph.2.database=db3

The configuration above must be added to the neo4j.conf file of the Neo4j DBMSs server1 and server2. The parameter fabric.routing.servers contains the list of available standalone Neo4j DBMSs hosting the Fabric database. The parameter fabric.graph.<ID>.uri can contain a list of URIs, so in case the first server does not respond to the request, the connection can be established to another server that is part of the cluster. The URIs refer to the neo4j:// schema so that Fabric can retrieve a routing table and can use one of the members of the cluster to connect.

Figure 8.5. Fabric setting with Causal Cluster and no single point of failure
fabric setting

8.2.1.4. Cluster routing context

The URIs in the graph settings may include routing contexts. This can be used to associate a Fabric graph with a filtered subset of Causal Cluster members, by selecting a routing policy.

As an example, assuming we have a server policy called read_replicas defined in the configuration of the cluster we are targeting, we might set up a Fabric graph that accesses only the read replicas of the cluster.

fabric.graph.0.name=graphA
fabric.graph.0.uri=neo4j://core1:7687?policy=read_replicas
fabric.graph.0.database=db1

This enables scenarios where queries executed through Fabric are explicitly offloaded to specific instances in clusters.

8.2.2. Authentication and authorization

8.2.2.1. Credentials

Connections between the Fabric database and the Neo4j DBMSs hosting the data are created using the same credentials that are supplied in the client connection to the Fabric database. It is recommended to maintain a set of user credentials on all the Neo4j DBMSs; if required, a subset of credentials may be set for local access on the remote DBMSs.

8.2.2.2. User and role administration

User and role administration actions are not automatically propagated to the Fabric environment, therefore security settings must be executed on any DBMS that is part of Fabric.

8.2.2.3. Privileges on the Fabric database

In order to use all Fabric features, users of Fabric databases need ACCESS and READ privileges.

8.2.3. Important settings

This section provides general information about Fabric settings and describes the ones important for creating a fabric set-up. Please refer to Section A.1, “Configuration settings” fort the full list of Fabric configuration options.

Fabric settings are divided in the following categories:

  • System Settings: DBMS-level settings.
  • Graph Settings: definition and configuration of Fabric graphs.
  • Drivers Settings: configuration of drivers used to access Neo4j DBMSs and databases associated to Fabric graphs.

8.2.3.1. System settings

Table 8.1. Fabric system settings
Parameter Description

fabric.database.name

Name of the Fabric database. Neo4j Fabric currently supports one Fabric database in a standalone Neo4j DBMS.

fabric.routing.servers

A comma-separated list of Neo4j DBMSs that share the same Fabric configuration. These DBMSs form a routing group. A client application will route transactions through a Neo4j driver or connector to one of the members of the routing group. A Neo4j DBMS is represented by its Bolt connector address. Example: fabric.routing.servers=server1:7687,server2:7687.

8.2.3.2. Graph settings

The <ID> in the following settings is the integer associated to each Fabric graph.

Table 8.2. Fabric graph settings
Parameter Description

fabric.graph.<ID>.uri

URI of the Neo4j DBMS hosting the database associated to the Fabric graph. Example: neo4j://somewhere:7687

fabric.graph.<ID>.database

Name of the database associated to the Fabric graph.

fabric.graph.<ID>.name

Name assigned to the Fabric graph. The name can be used in Fabric queries.

fabric.graph.<ID>.driver.*

Any specific driver setting, i.e. any setting related to a connection to a specific Neo4j DBMS and database.This setting overrides a global driver setting.

When configuring access to a remote DBMS, please make sure that the remote is configured to advertise its address correcly. This is done through either dbms.default_advertised_address or dbms.connector.bolt.advertised_address. Fabric reads the routing table from the remote DBMS and then connects back using an appropriate entry in that table.

8.2.3.3. Drivers settings

Fabric uses the Neo4j Java driver to connect to and access the data stored in Neo4j databases associated to Fabric graphs. This section presents the most important parameters available to configure the driver.

Drivers settings are configured with parameters with names of the format:

fabric.driver.<suffix>

A setting can be global, i.e. be valid for all the drivers used in Fabric, or it can be specific for a given connection to a Neo4j database associated to a graph. The graph-specific setting overrides the global configuration for that graph.

Example 8.1. Global drivers setting versus graph-specific drivers setting

A drivers setting for Fabric as the following is valid for all the connections established with the Neo4j DBMSs set in Fabric:

fabric.driver.api=RX

A graph-specific connection for the database with ID=6 will override the fabric.driver.api setting for that database:

fabric.graph.6.driver.api=ASYNC
Table 8.3. Fabric drivers setting suffixes
Parameter suffix Explanation

ssl_enabled

SSL for Fabric drivers is configured using the fabric SSL policy. This setting can be used to instruct the driver not to use SSL even though the fabric SSL policy is configured. The driver will use SSL if the fabric SSL policy is configured, and this setting is set to true. This parameter can only be used in fabric.graph.<graph ID>.driver.ssl_enabled and not fabric.driver.ssl_enabled.

api

Determines which driver API will be used. Supported values are RX and ASYNC. ASYNC must be used when the remote instance is 3.5.

Most driver options described in Driver Manual → Configuration have an equivalent in Fabric configuration.