我使用 neo4j-ha-bolt-driver 模块连接到 neo4j 集群。我连接到neo4j并尝试更新查询,但我得到“Neo4jError:不允许直接在此数据库上进行写入操作。写入必须通过领导者。此服务器的角色是:FOLLOWER”。知道如何解决这个问题吗?
var Neo4jHA = require("neo4j-ha-bolt-driver");
const servers = [
["http://neo4j-core1", "bolt://neo4j-core1"],
["http://neo4j-core2", "bolt://neo4j-core2"],
["http://neo4j-core3", "bolt://neo4j-core3"],
["http://neo4j-core4", "bolt://neo4j-core4"],
["http://neo4j-core5", "bolt://neo4j-core5"],
];
const auth = { user: "user", pass: "pass" };
const strategy = Neo4jHA.HAStrategies.roundRobin;
const rwConfig = Neo4jHA.HAReadWrite.all;
const checkInterval = 500;
let time = timestamp('YYYY-MM-DD hh:mm:ss.iii');
const driver = new Neo4jHA(
servers,
{ auth, strategy, rwConfig, checkInterval },
(readyCallback) => {
session = driver.session(true);
session.run("match (n:student) where n.student_id= 3 set n.time= '" + time + "'")
.subscribe({
onCompleted: function () {
console.log('updated')
},
onError: function (err) {
console.log(err)
}
})
});