如果您无法将索引的状态从Install更改为Enable,我建议您检查JanusGraph的运行实例并关闭除“(Current)”之外的所有实例,然后再次尝试删除索引。
要检查和关闭实例,请在gremlin shell中使用以下命令:
mgmt = graph.openManagement()
mgmt.getOpenInstances() //all open instances
==>7f0001016161-dunwich1(current)
==>7f0001016161-atlantis1
mgmt.forceCloseInstance(‘7f0001016161-atlantis1’) //remove an instance
mgmt.commit()
</code>
要删除索引,请使用以下代码:
// Disable the “name” composite index
this.management = this.graph.openManagement()
def nameIndex = this.management.getGraphIndex(indexName)
this.management.updateIndex(nameIndex, SchemaAction.DISABLE_INDEX).get()
this.management.commit()
this.graph.tx().commit()
// Block until the SchemaStatus transitions from INSTALLED to REGISTERED
ManagementSystem.awaitGraphIndexStatus(graph, indexName).status(SchemaStatus.DISABLED).call()
// Delete the index using JanusGraphManagement
this.management = this.graph.openManagement()
def delIndex = this.management.getGraphIndex(indexName)
def future = this.management.updateIndex(delIndex, SchemaAction.REMOVE_INDEX)
this.management.commit()
this.graph.tx().commit()
</code>
我遇到了同样的问题并尝试了很多其他的事情,最后上面的程序工作了!