2016-10-10 59 views
0

我使用CassandraDB保存度量標準數據。爲什麼我要用空值獲取列條目?

我創建了一個ColumnFamily中與名metrics

CREATE TABLE metrics (
    mbean text, 
    metricstime timestamp, 
    ftpconnectionstate int, 
    PRIMARY KEY (mbean, metricstime)); 

由此產生的 「表」,在cqlsh看起來像這樣:

mbean  | metricstime    | ftpconnectionstate 
-----------+--------------------------+-------------------- 
FtpOnline | 2016-10-10 14:38:45+0000 |     1 
FtpOnline | 2016-10-10 14:38:50+0000 |     1 
FtpOnline | 2016-10-10 14:38:55+0000 |     1 
FtpOnline | 2016-10-10 14:39:00+0000 |     1 
FtpOnline | 2016-10-10 14:39:05+0000 |     1 
FtpOnline | 2016-10-10 14:39:10+0000 |     1 
FtpOnline | 2016-10-10 14:39:15+0000 |     1 
FtpOnline | 2016-10-10 14:39:20+0000 |     1 

引擎蓋下卡桑德拉節省這樣的值:

RowKey: FtpOnline 
=> (name=2016-10-10 14\:38\:45+0000:, value=, timestamp=1476110327630000, ttl=604800) 
=> (name=2016-10-10 14\:38\:45+0000:ftpconnectionstate, value=00000001, timestamp=1476110327630000, ttl=604800) 
=> (name=2016-10-10 14\:38\:50+0000:, value=, timestamp=1476110331832000, ttl=604800) 
=> (name=2016-10-10 14\:38\:50+0000:ftpconnectionstate, value=00000001, timestamp=1476110331832000, ttl=604800) 
=> (name=2016-10-10 14\:38\:55+0000:, value=, timestamp=1476110336830000, ttl=604800) 
=> (name=2016-10-10 14\:38\:55+0000:ftpconnectionstate, value=00000001, timestamp=1476110336830000, ttl=604800) 
=> (name=2016-10-10 14\:39\:00+0000:, value=, timestamp=1476110341831000, ttl=604800) 
=> (name=2016-10-10 14\:39\:00+0000:ftpconnectionstate, value=00000001, timestamp=1476110341831000, ttl=604800) 
=> (name=2016-10-10 14\:39\:05+0000:, value=, timestamp=1476110346832000, ttl=604800) 
=> (name=2016-10-10 14\:39\:05+0000:ftpconnectionstate, value=00000001, timestamp=1476110346832000, ttl=604800) 

現在您可以看到存在具有空值的列條目。 我的問題是:有沒有可能擺脫它們?

回答

1

我相信你指的是每隔一行的值=。他們在那裏,因爲值實際上是作爲該字段的名稱存儲的。這就是Cassandra存儲集羣密鑰的方式。由於該值是名稱中的值,所以將它包含在「值」字段中也沒有意義。通常情況下,這種看法是分散的,因爲它不是用戶需要擔心的事情。

相關問題