2014-02-25 47 views
1

我試圖使用卡桑德拉的結果backend.Here是芹菜應用:使用卡桑德拉如芹菜結果後端

from __future__ import absolute_import 
from celery import Celery 

app = Celery('proj', 
     broker='amqp://', 
     backend='cassandra', 
     include=['proj.tasks']) 

# Optional configuration, see the application user guide. 
app.conf.update(
    CASSANDRA_SERVERS = ["localhost:9160"], 
    CASSANDRA_KEYSPACE = "celery", 
    CASSANDRA_COLUMN_FAMILY = "tasks_result", 
    CASSANDRA_READ_CONSISTENCY = "ONE", 
    CASSANDRA_WRITE_CONSISTENCY = "ONE", 
    CASSANDRA_OPTIONS = { 
     'timeout': 10, 
     'max_retries': 1 
    } 
    ) 

if __name__ == '__main__': 
    app.start() 

由於芹菜的卡桑德拉後端使用pycassa,我創建密鑰空間 - 「芹菜」和表 - 'tasks_result'使用pycassaShell。問題是結果存儲在「tasks_result」表中有十六進制十進制值,如下所示:

key                  | column1 | value 
----------------------------------------------------------------------------+-----------+-------------------------------------------- 
0x65333336633966622d323937612d346535612d613164352d353333613765663962613663 | 0x6368696c6472656e |        0x80025d71012e 
0x65333336633966622d323937612d346535612d613164352d353333613765663962613663 | 0x646174655f646f6e65 | 0x323031342d30322d32355431363a30343a34355a 
0x65333336633966622d323937612d346535612d613164352d353333613765663962613663 | 0x726573756c74 |        0x80024b092e 
0x65333336633966622d323937612d346535612d613164352d353333613765663962613663 | 0x737461747573 |       0x53554343455353 
0x65333336633966622d323937612d346535612d613164352d353333613765663962613663 | 0x74726163656261636b |         0x80024e2e 

如何檢索實際數據存儲在哪裏?在此先感謝..

+0

下面的輸出是從''cqlsh''吧? –

回答

1

當您創建ColumnFamily(aka表)時,將KeyValidation和ColumnValidation定義爲UTF8Type。然後使用pycassa從它讀取,它應該沒問題。默認情況下,Cassandra以二進制形式存儲事物。基於表定義,翻譯由查詢接口發生。