Hi all,
I'm new to Neo4j DBMS and need help with creating a custom procedure.
I'm trying to execute:
CALL apoc.custom.installProcedure(
'my_procedure(param1::STRING) :: (result::STRING)',
'MATCH (n:$param1) RETURN n.name AS result'
);
However, I get the following error:
Failed to invoke procedure `apoc.custom.installProcedure`: Caused by: java.lang.RuntimeException: No write operations are allowed directly on this database. Writes must pass through the leader. The role of this server is: FOLLOWER
This suggests that the database is running in a clustered environment with the server in FOLLOWER mode.
I'm using Neo4j 5.24.0 on Neo4j Desktop 1.6.1.122.
I just installed Neo4j Desktop and created a new database with the default configuration.
After encountering this issue, I checked the configuration file for settings related to standalone/cluster mode and LEADER/FOLLOWER roles but couldn't find anything that explicitly allows switching modes or roles (or, at least, I didn't recognize them).
I’m not even sure if my database instance is actually running in cluster mode, since I didn’t configure anything to enable it, unless cluster mode is the default (which seems unlikely).
Can anyone help me find a way to create custom procedures in my database installation?
Thank you!
P.S.
I found this parameter in the configuration file:
# Restrict the modes of databases that can be hosted on this server
# Allowed values:
# PRIMARY - Hosts standalone databases and members of the consensus quorum for a multi-primary database.
# SECONDARY - Only hosts read replicas, eventually-consistent read-only instances of databases.
# NONE - Can host databases in any mode.
#initial.server.mode_constraint=NONE
I then set:
initial.server.mode_constraint=PRIMARY
hoping that this would force the server to run in standalone mode.
However, when I tried to create the custom procedure again, I encountered the same issue.