cassandra连接错误:无法连接到任何服务器

时间:2015-11-28 08:01:13

标签: database cassandra cql

cassandra对我的虚拟机不起作用。

cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

当我使用命令时:

cassandra
......
INFO  07:55:31 Enqueuing flush of local: 578 (0%) on-heap, 0 (0%) off-heap
INFO  07:55:31 Writing Memtable-local@2014850649(0.081KiB serialized bytes, 4 ops, 0%/0% of on/off-heap limit)
INFO  07:55:31 Completed flushing /var/lib/cassandra/data/system/local-7ad54392bcdd35a684174e047860b377/tmp-la-305-big-Data.db (0.000KiB) for commitlog position ReplayPosition(segmentId=1448697324414, position=105487)
INFO  07:55:31 Enqueuing flush of local: 51468 (0%) on-heap, 0 (0%) off-heap
INFO  07:55:31 Writing Memtable-local@280469114(8.354KiB serialized bytes, 259 ops, 0%/0% of on/off-heap limit)
INFO  07:55:31 Completed flushing /var/lib/cassandra/data/system/local-7ad54392bcdd35a684174e047860b377/tmp-la-306-big-Data.db (0.000KiB) for commitlog position ReplayPosition(segmentId=1448697324414, position=117466)
INFO  07:55:32 Node localhost/127.0.0.1 state jump to normal
INFO  07:55:32 Compacted (64dd8610-95a5-11e5-af1d-a752adc4283f) 4 sstables to [/var/lib/cassandra/data/system/compaction_history-b4dbb7b4dc493fb5b3bfce6e434832ca/la-91-big,] to level=0.  20,658 bytes to 20,029 (~96% of original) in 2,376ms = 0.008039MB/s.  0 total partitions merged to 225.  Partition merge counts were {1:225, }

然后cqlsh可以工作:

cqlsh
Connected to Test Cluster at 127.0.0.1:9042.
[cqlsh 5.0.1 | Cassandra 2.2.1 | CQL spec 3.3.0 | Native protocol v4]
Use HELP for help.
cqlsh>

但几分钟后,cqlsh关闭了:

cqlsh
Connection error: ('Unable to connect to any servers', {'127.0.0.1': error(111, "Tried connecting to [('127.0.0.1', 9042)]. Last error: Connection refused")})

任何人都可以帮助我!提前谢谢!

2 个答案:

答案 0 :(得分:3)

声音就像服务器在几分钟后停机一样。你应该检查日志

答案 1 :(得分:2)

我找到了根本原因:内存不够。我创建了linux swap,然后一切正常。

how to add swap on ubuntu