Introduction to managing multiple active databases with Neo4j.
With Neo4j 4.3 you can create and use more than one active database at the same time.
Neo4j is a Database Management System, or DBMS, capable of managing multiple databases. The DBMS can manage a standalone server, or a group of servers in a Causal Cluster.
A Neo4j instance is a Java process that is running the Neo4j server code.
- Transaction domain
A transaction domain is a collection of graphs that can be updated within the context of a single transaction.
- Execution context
An execution context is a runtime environment for the execution of a request. In practical terms, a request may be a query, a transaction, or an internal function or procedure.
A database is an administrative partition of a DBMS. In practical terms, it is a physical structure of files organized within a directory or folder, that has the same name of the database. In logical terms, a database is a container for one or more graphs.
A database defines a transaction domain and an execution context. This means that a transaction cannot span across multiple databases. Similarly, a procedure is called within a database, although its logic may access data that is stored in other databases.
A default installation of Neo4j 4.3 contains two databases:
This is a data model within a database. In Neo4j 4.0 there is only one graph within each database, and many administrative commands that refer to a specific graph do so using the database name.
In Neo4j Fabric, it is possible to refer to multiple graphs within the same transaction and Cypher query.
The following image illustrates a default installation, including the
system database and a single database named
neo4j for user data:
The edition of Neo4j determines the number of possible databases:
All installations include the
All installations include a built-in database named
system, which contains meta-data and security configuration.
system database behaves differently than all other databases.
In particular, when connected to this database you can only perform a specific set of administrative functions, as described in detail in Cypher Manual → Database management.
Most of the available administrative commands are restricted to users with specific administrative privileges. An example of configuring security privileges is described in Fine-grained access control. Access Control is described in detail in Cypher Manual → Access Control .
The following image illustrates an installation of Neo4j with multiple active databases, named
If a user connects to Neo4j without specifying a database, they will be connected to a home database. When choosing a home database the server will first use the home database configured for that user. If the connecting user does not have a home database configured, the server will use the default database, which every Neo4j instance has.
The default database is configurable. For details, see configuration parameters.
The following image illustrates an installation of Neo4j containing the three databases for user data, named
hr, and the
The default database is
Per-user home databases are controlled via the Cypher administration commands.
To set a home database for a user, this user must exist as a record in Neo4j. Therefore, for deployments using auth providers other than native, you create a native user with a matching username and then set a home database for that user. For more information on creating native users and configuring a home database for a user, see Cypher Manual → User Management.
Was this page helpful?