Configuration parameters

Configuration parameters are defined in the neo4j.conf file.

The following configuration parameters are applicable for managing databases:

Parameter name Description

initial.dbms.default_database

Name of the default database for the Neo4j instance. The database is created if it does not exist when the instance starts.

Default value: neo4j

In a clustered setup, the value of initial.dbms.default_database is only used to set the initial default database. To change the default database at a later point, see Change the default database.

Be aware that the automatically created initial default database may have a different topology to the default configuration values. See Default database in a cluster for more information.

dbms.max_databases

Maximum number of databases that can be used in a Neo4j single instance or cluster. The number includes all the online and offline databases. The value is an integer with a minimum value of 2. Enterprise Edition

Default value: 100

Once the limit has been reached, it is not possible to create any additional databases. Similarly, if the limit is changed to a number lower than the total number of existing databases, no additional databases can be created.

server.databases.default_to_read_only

Default mode of all databases. If this setting is set to true all existing and new databases will be in read only mode, and so will prevent write queries.

Default value: false

server.databases.read_only

List of database names for which to prevent write queries. This set can contain also not yet existing databases, but not the system database.

Regardless of settings of server.databases.default_to_read_only, server.databases.read_only and server.databases.writable the system database will never be read-only and will always accept write queries.

Another way of preventing writes is to set the database access to read-only using the ALTER DATABASE command.

Example configuration:

server.databases.read_only=["foo", "bar"]

server.databases.writable

List of database names for which to accept write queries. This set can contain also not yet existing databases.
The value of this setting is ignored if server.databases.default_to_read_only is set to false.
If a database name is present in both sets, the database will be read-only and prevent write queries.

If most of your databases would read-only with a few exceptions, it can be easier to set server.databases.default_to_read_only to true, and then put the names of the non read-only databases into server.databases.writable.

Example configuration:

server.databases.writable=["foo", "bar"]

Although it is possible to achieve the same goal, i.e. set a database to read-only, both by using the Cypher command ALTER DATABASE and by using configuration parameters in neo4j.conf, it is important to understand the difference between the two. ALTER DATABASE foo SET ACCESS READ ONLY effectively sets the database foo to read-only across the entire DBMS.

Using configuration parameters is more subtle and allows you to configure access on each instance separately, in case of a cluster for example. If you use server.databases.default_to_read_only all databases on that instance are set to read-only.

If both the Cypher command and the configuration parameters are used and they contain conflicting information, the database in question is set to read-only.