TimeUUID与Cassandra和Lazyboy [英] TimeUUID with Cassandra and Lazyboy

查看:187
本文介绍了TimeUUID与Cassandra和Lazyboy的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试使用UUID1键插入列,以便能够按日期对它们进行排序。我总是得到错误cassandra.ttypes.InvalidRequestException:InvalidRequestException(为什么='UUIDs必须正好是16个字节'),我不知道为什么。

I try to insert column with UUID1 keys to be able to sort them by date. I always get the error "cassandra.ttypes.InvalidRequestException: InvalidRequestException(why='UUIDs must be exactly 16 bytes')", and I don't know why.

下面是生成此错误的代码:

Here is the code generating this error :

from lazyboy import *
from lazyboy.key import Key
import uuid

class TestItemKey(Key):
    def __init__(self, key=None):
        Key.__init__(self, 'MXstore', 'TestCF', key)

class TestItem(record.Record):
    def __init__(self, *args, **kwargs):
        record.Record.__init__(self, *args, **kwargs)
        self.key = TestItemKey(uuid.uuid1().bytes)

connection.add_pool('MXstore', ['localhost:9160'])

tmp = {'foo' : 'bar'}
tmps = TestItem(tmp).save()


b $ b

我做错了什么?我使用lazyboy 0.705与Cassandra 0.6.4。
存储配置是:

What did I do wrong ? I use lazyboy 0.705 with Cassandra 0.6.4. The storage configuration is :

<Keyspaces>
    <Keyspace Name="MXstore">
        <ColumnFamily Name="TestCF" CompareWith="TimeUUIDType" />

        <ReplicaPlacementStrategy>org.apache.cassandra.locator.RackUnawareStrategy</ReplicaPlacementStrategy>
        <ReplicationFactor>3</ReplicationFactor>
        <EndPointSnitch>org.apache.cassandra.locator.EndPointSnitch</EndPointSnitch>
    </Keyspace>
</Keyspaces>


推荐答案

列名称必须为uuid版本1。像您的密钥是uuid版本1

The column name must be of uuid version 1. Looks like your key is a uuid version 1

这篇关于TimeUUID与Cassandra和Lazyboy的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆