janusgraph创建索引报错

创建名为byTelComposite的索引,installed转registered时报错:

janusgraph>GraphIndexStatusReport[success=false, indexName='byTelComposite', targetStatus=[REGISTERED], notConverged={tel=INSTALLED}, converged={}, elapsed=PT1M0.261S]

原因:
出现了多个事务或者实例

解决:
关闭实例过程

gremlin> mgmt = graph.openManagement()
==>org.janusgraph.graphdb.database.management.ManagementSystem@36c07c75
//查询实例
gremlin> mgmt.getOpenInstances()
==>c0a81433160396-s11(current)
==>c0a81433160854-s13
==>c0a81433160854-s11
==>c0a81433160854-s15
//出现多个则关闭
gremlin> mgmt.forceCloseInstance('c0a81433160854-s11')
==>null
gremlin> mgmt.commit()
==>null

关闭事务过程

//查询事务
graph.getOpenTransactions()//打开多个事务
//关闭事务
graph.getOpenTransactions().getAt(0).rollback()  //关闭
或者
int size = graph.getOpenTransactions().size();for(i=0;i<size;i++) {graph.getOpenTransactions().getAt(0).rollback()}  //size替换为事务的数量

最后查看实例事务是否都关闭

mgmt = graph.openManagement()
mgmt.getOpenInstances()
mgmt.commit()    
graph.getOpenTransactions()

INSTALLED转REGISTERED方法:
执行 REGISTER_INDEX ACTION,使索引状态INSTALLED 转为 REGISTERED

mgmt = graph.openManagement()
mgmt.updateIndex(m.getGraphIndex('byTelComposite'), SchemaAction.REGISTER_INDEX).get()
mgmt.commit()

或者

ManagementSystem.awaitGraphIndexStatus(graph, 'byTelComposite').call()

直接查看索引的状态

mgmt = graph.openManagement()
index = mgmt.getGraphIndex('byTelComposite')
index.getIndexStatus(mgmt.getPropertyKey('tel'))
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值