pangpang
pangpang

Reputation: 8821

cassandra connection error: Unable to connect to any servers

cassandra doesn't work for my VM.

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")})

when I use the command:

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, }

then cqlsh can work:

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>

but a few minutes later, the cqlsh is down:

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")})

Anyone can help me! Thanks in advance!

Upvotes: 4

Views: 4782

Answers (2)

pangpang
pangpang

Reputation: 8821

I found the root cause: the memory is not enough. I create the linux swap, then everything is ok.

how to add swap on ubuntu

Upvotes: 3

omer727
omer727

Reputation: 7565

Sound like the server is going down after a few minutes. You should check the logs for the reason

Upvotes: 3

Related Questions