标签:并且 content ant key https star bottom tac tag
/go # etcdctl lease grant 200 //设置一个200秒过期的租约
lease 08e86eea8129eb12 granted with TTL(200s)
/go # etcdctl lease timetolive 08e86eea8129eb12 //查看该租约的剩余到期时间
lease 08e86eea8129eb12 granted with TTL(200s), remaining(153s)
/go # etcdctl lease revoke 08e86eea8129eb12 //删除租约
lease 08e86eea8129eb12 revoked
/go # etcdctl lease grant 200 //创建一个时长200秒的租约
lease 08e86eea8129eb17 granted with TTL(200s)
/go # etcdctl lease timetolive 08e86eea8129eb17 //查看租约剩余时间
lease 08e86eea8129eb17 granted with TTL(200s), remaining(181s)
/go # etcdctl put /user xiahualou --lease 08e86eea8129eb17 //插入一条数据并且关联到租约08e86eea8129eb17
OK
/go # etcdctl get /user
/user
xiahualou
/go # etcdctl lease timetolive 08e86eea8129eb17
lease 08e86eea8129eb17 granted with TTL(200s), remaining(114s)
/go # etcdctl lease timetolive 08e86eea8129eb17 //租约还没到期
lease 08e86eea8129eb17 granted with TTL(200s), remaining(65s)
/go # etcdctl put /user2 lisiyi --lease 08e86eea8129eb17 //插入一条数据
OK
/go # etcdctl lease timetolive 08e86eea8129eb12 --keys //租约已经过期了
lease 08e86eea8129eb12 already expired
/go # etcdctl lease timetolive 08e86eea8129eb17 --keys //查看该租约下的key
lease 08e86eea8129eb17 granted with TTL(200s), remaining(4s), attached keys([/user /user2])
/go # etcdctl lease timetolive 08e86eea8129eb17
lease 08e86eea8129eb17 already expired
/go # etcdctl get /user //租约过期了查不到数据
/go # etcdctl get /user1 //租约过期了查不到数据
/go # etcdctl lease keep-alive 08e86eea8129eb17 //过期之后不可以续租,只能过期前续租,续租成功又恢复到满租时长
lease 08e86eea8129eb17 expired or revoked.
标签:并且 content ant key https star bottom tac tag
原文地址:https://www.cnblogs.com/hualou/p/12071059.html