2016-08-11 35 views
1

Cassandra讓我非常頭疼。昨天,一切運行良好,然後我丟了一張桌子,跑了一個CQLSSTableWriter,它以某種方式多次拋出關於我的Lucene index(不在類路徑之類)的錯誤,現在,我在cqlsh中發出的每個命令都會拋出錯誤。Cassandra - 在CQLSH中發出的每個命令都會引發錯誤

CREATE KEYSPACE IF NOT EXISTS mydata WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}; 

需要一段時間,然後拋出:

Warning: schema version mismatch detected, which might be caused by DOWN nodes; 
if this is not the case, check the schema versions of your nodes in system.local and system.peers. 
OperationTimedOut: errors={}, last_host=XXX.XXX.XXX.20 

之後,我將創建一個新的表,它也將拋出同樣的錯誤。

cqlsh:mydata> create table test (id text PRIMARY KEY, id2 text); 
Warning: schema version mismatch detected, which might be caused by DOWN nodes; if this is not the case, check the schema versions of your nodes in system.local and system.peers. 
OperationTimedOut: errors={}, last_host=XXX.XXX.XXX.20 

last_host總是顯示我運行cqlsh的主機的IP地址。我也嘗試了與不同節點相同的命令。

但是,鍵空間和表格仍在創建中!錯誤說,有關不匹配模式版本,所以我做了肯定,並跑:

nodetool describecluster 

而且它的輸出顯示我的所有節點都在相同的架構。沒有模式不匹配。我之前也發佈了nodetool resetlocalschema,但沒有任何運氣。

當我繼續向新創建的表中插入一些數據時,會出現以下錯誤。請注意,insert語句不會返回錯誤。

cqlsh:mydata> insert into test(id, id2) values('test1', 'test2'); 
cqlsh:mydata> select * from mydata.test ; 
Traceback (most recent call last): 
    File "/usr/bin/cqlsh.py", line 1314, in perform_simple_statement 
    result = future.result() 
    File "/usr/share/cassandra/lib/cassandra-driver-internal-only-3.0.0-6af642d.zip/cassandra-driver-3.0.0-6af642d/cassandra/cluster.py", line 3122, in result 
    raise self._final_exception 
Unavailable: code=1000 [Unavailable exception] message="Cannot achieve consistency level ONE" info={'required_replicas': 1, 'alive_replicas': 0, 'consistency': 'ONE'} 

請注意,我有一個數據中心和五個節點。我不打算在將來使用多個數據中心。 [cqlsh 5.0.1 | Cassandra 3.0.8 | CQL規範3.4.0 | Native protocol v4]

我也重新啓動了Cassandra多次。 nodetool status顯示所有節點已啓動並正在運行。有沒有人知道發生了什麼?

回答

1

我解決了這個由...

  1. 下降的密鑰空間

  2. 所有表運行alter keyspace mydata WITH replication = {'class': 'NetworkTopologyStrategy', 'dc1': '1'};代替SimpleStrategy

  3. 所有節點上重新啓動卡桑德拉服務

  4. 重新創建所有表格

  5. 捉迷藏nodetool repair

現在我能夠再次插入數據和查詢數據。儘管如此,仍然不太清楚這一切的原因是什麼。

+2

通常情況下,通過重新啓動受影響的節點(您可以通過運行'nodetool describecluster'來查看模式分歧。很高興您得到了解決方案,儘管如此。 – Aaron

+0

@Aaron這正是導致我頭痛的部分。 'nodetool describecluster'的輸出在整個時間都是這樣的:'9ae01f7c-c138-31ee-a9d1-d11527c2471b:[xxx.xxx.xxx.24,xxx.xxx.xxx.28,xxx.xxx.xxx。 30,xxx.xxx.xxx.32,xxx.xxx.xxx。20] UNREACHABLE:[127.0.0.1]'。正如上面的問題所述,我期待這意味着沒有模式分歧。 – j9dy

+1

'不可用:[127.0.0.1]'關注我。如果這不是集羣中的有效節點,我會在其上執行一個'nodetool removenode' ...然後從所有其他節點上的system.peers中刪除它。否則,127.0.0.1將停留在舊模式中,並且保持報告不一致。 – Aaron

相關問題