我有2.1.2版本的单节点cassandra。
我使用cqlsh连接到cassandra并输入一些命令来试验。首先,所有命令都会有效,直到create keyspace
挂起。
这些是我的行动。
myuser@myhost:~/s/kuankr-feed-api$ cqlsh 192.168.1.160
Connected to Kr Cluster at 192.168.1.160:9160.
[cqlsh 4.1.1 | Cassandra 2.1.2 | CQL spec 3.1.1 | Thrift protocol 19.39.0]
Use HELP for help.
cqlsh> describe keyspaces;
system system_auth OpsCenter
kuankr_feed_production kuankr_feed_staging system_traces
cqlsh> use kuankr_feed_production;
cqlsh:kuankr_feed_production> describe tables;
news_activity news_timeline questions_activity questions_timeline
cqlsh:kuankr_feed_production> select * from news_activity limit 1;
# too long to show
(1 rows)
cqlsh:kuankr_feed_production> create keyspace test with replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
^C
cqlsh:kuankr_feed_production> create table Cats (name text);
^C
语句create keyspace test with replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
挂起,任何连续的语句都会挂起。如果我退出并重新连接,除了create keyspace
之外,所有语句都可以。
我做这些实验是因为我们的新闻源系统可以查询活动,但不能插入或删除使用cassandra作为存储后端的活动。
重启cassandra后,我重播了我的操作。这时候,卡桑德拉立刻回应了我。
cqlsh:kuankr_feed_production> create keyspace test with replication = {'class': 'SimpleStrategy', 'replication_factor': 1};
cqlsh:kuankr_feed_production> create table Cats (name text);
Bad Request: No PRIMARY KEY specifed (exactly one required)
Update0:我的操作期间的cassandra日志
WARN [SharedPool-Worker-35] 2015-11-29 13:34:17,402 BatchStatement.java:255 - Batch of prepared statements for [kuankr_feed_production.news_timeline] is of size 9400, exceeding specified threshold of 5120 by 4280.
### similar 'BatchStatement.java:255 - Batch of prepared statements for...' rows across line 56127 to 56206
WARN [SharedPool-Worker-41] 2015-11-29 13:35:48,088 BatchStatement.java:255 - Batch of prepared statements for [kuankr_feed_production.news_timeline] is of size 9400, exceeding specified threshold of 5120 by 4280.
INFO [ScheduledTasks:1] 2015-11-29 13:35:49,833 ColumnFamilyStore.java:840 - Enqueuing flush of compaction_history: 2800 (0%) on-heap, 0 (0%) off-heap
INFO [MemtableFlushWriter:40] 2015-11-29 13:35:49,834 Memtable.java:325 - Writing Memtable-compaction_history@99094617(578 serialized bytes, 20 ops, 0%/0% of on/off-heap limit)
INFO [ScheduledTasks:1] 2015-11-29 13:35:49,838 ColumnFamilyStore.java:840 - Enqueuing flush of sstable_activity: 14523 (0%) on-heap, 0 (0%) off-heap
INFO [MemtableFlushWriter:41] 2015-11-29 13:35:49,839 Memtable.java:325 - Writing Memtable-sstable_activity@718981419(1539 serialized bytes, 610 ops, 0%/0% of on/off-heap limit)
INFO [MemtableFlushWriter:40] 2015-11-29 13:35:49,994 Memtable.java:364 - Completed flushing /var/lib/cassandra/data/system/compaction_history-b4dbb7b4dc493fb5b3bfce6e434832ca/system-compaction_history-ka-971-Data.db (407 bytes) for commitlog position ReplayPosition(segmentId=1448692540025, position=33554217)
INFO [MemtableFlushWriter:41] 2015-11-29 13:35:49,994 Memtable.java:364 - Completed flushing /var/lib/cassandra/data/system/sstable_activity-5a1ff267ace03f128563cfae6103c65e/system-sstable_activity-ka-2847-Data.db (803 bytes) for commitlog position ReplayPosition(segmentId=1448692540025, position=33554217)