6

I'm newbie in cassandra apache. In the tutorial video, it says type bin/nodetools status to check the status of node but when I tried to input it. Terminal returns

Failed to connect to '127.0.0.1:7199' - ConnectException: 'Connection
refused (Connection refused)'.

Check this image

I tried to change JVM_OPTS to "$JVM_OPTS -Djava.rmi.server.hostname=localhost" in cassandra-env.sh but still can't connect. What I gonna do to fix this error?

Debug.logs

DEBUG [main] 2017-01-21 13:57:48,095 ColumnFamilyStore.java:881 - Enqueuing flush of local: 38.338KiB (0%) on-heap, 0.000KiB (0%) off-heap
DEBUG [PerDiskMemtableFlushWriter_0:1] 2017-01-21 13:57:48,167 Memtable.java:435 - Writing Memtable-local@858986260(8.879KiB serialized bytes, 1 ops, 0%/0% of on/off-heap limit), flushed range = (min(-9223372036854775808), max(9223372036854775807)]
DEBUG [PerDiskMemtableFlushWriter_0:1] 2017-01-21 13:57:48,168 Memtable.java:464 - Completed flushing /usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-56-big-Data.db (5.367KiB) for commitlog position CommitLogPosition(segmentId=1484978256521, position=32861)
DEBUG [MemtableFlushWriter:1] 2017-01-21 13:57:48,471 ColumnFamilyStore.java:1184 - Flushed to [BigTableReader(path='/usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-56-big-Data.db')] (1 sstables, 9.527KiB), biggest 9.527KiB, smallest 9.527KiB
DEBUG [CompactionExecutor:1] 2017-01-21 13:57:48,472 CompactionTask.java:150 - Compacting (896b3470-df9e-11e6-9508-7dc463a45cc9) [/usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-53-big-Data.db:level=0, /usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-54-big-Data.db:level=0, /usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-55-big-Data.db:level=0, /usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-56-big-Data.db:level=0, ]
DEBUG [main] 2017-01-21 13:57:48,539 StorageService.java:2084 - Node localhost/127.0.0.1 state NORMAL, token [-1035692197905104867, -1103547951527719073, -1136980347732340590, -1150272208899529050, -1184340318934652250, -1251847845785777189, -1355083122390358187,
INFO  [main] 2017-01-21 13:57:48,539 StorageService.java:2087 - Node localhost/127.0.0.1 state jump to NORMAL
DEBUG [main] 2017-01-21 13:57:48,545 StorageService.java:1336 - NORMAL
DEBUG [PendingRangeCalculator:1] 2017-01-21 13:57:48,575 PendingRangeCalculatorService.java:66 - finished calculation for 3 keyspaces in 19ms
INFO  [main] 2017-01-21 13:57:49,125 NativeTransportService.java:70 - Netty using native Epoll event loop
DEBUG [CompactionExecutor:1] 2017-01-21 13:57:49,286 CompactionTask.java:230 - Compacted (896b3470-df9e-11e6-9508-7dc463a45cc9) 4 sstables to [/usr/lib/cassandra/apache-cassandra-3.9/data/data/system/local-7ad54392bcdd35a684174e047860b377/mc-57-big,] to level=0.  9.869KiB to 4.938KiB (~50% of original) in 812ms.  Read Throughput = 12.145KiB/s, Write Throughput = 6.077KiB/s, Row Throughput = ~2/s.  4 total partitions merged to 1.  Partition merge counts were {4:1, }
INFO  [main] 2017-01-21 13:57:49,368 Server.java:159 - Using Netty Version: [netty-buffer=netty-buffer-4.0.39.Final.38bdf86, netty-codec=netty-codec-4.0.39.Final.38bdf86, netty-codec-haproxy=netty-codec-haproxy-4.0.39.Final.38bdf86, netty-codec-http=netty-codec-http-4.0.39.Final.38bdf86, netty-codec-socks=netty-codec-socks-4.0.39.Final.38bdf86, netty-common=netty-common-4.0.39.Final.38bdf86, netty-handler=netty-handler-4.0.39.Final.38bdf86, netty-tcnative=netty-tcnative-1.1.33.Fork19.fe4816e, netty-transport=netty-transport-4.0.39.Final.38bdf86, netty-transport-native-epoll=netty-transport-native-epoll-4.0.39.Final.38bdf86, netty-transport-rxtx=netty-transport-rxtx-4.0.39.Final.38bdf86, netty-transport-sctp=netty-transport-sctp-4.0.39.Final.38bdf86, netty-transport-udt=netty-transport-udt-4.0.39.Final.38bdf86]
INFO  [main] 2017-01-21 13:57:49,369 Server.java:160 - Starting listening for CQL clients on localhost/127.0.0.1:9042 (unencrypted)...
INFO  [main] 2017-01-21 13:57:49,429 CassandraDaemon.java:521 - Not starting RPC server as requested. Use JMX (StorageService->startRPCServer()) or nodetool (enablethrift) to start it
Tigran Saluev
  • 3,351
  • 2
  • 26
  • 40
thedeal deals
  • 63
  • 1
  • 1
  • 4

4 Answers4

7
  1. Get rid of JVM_OPTS to "$JVM_OPTS -Djava.rmi.server.hostname=localhost.
  2. Set listen_address and broadcast_rpc_address to local ip (ifconfig > ip-address-of-system).
  3. Restart Cassandra.
nevsv
  • 2,448
  • 1
  • 14
  • 21
  • **Set listen_address and broadcast_rpc_address to local ip (ifconfig)**. Does this mean setting these values to __ or _localhost_ @nevsv – nishant Oct 09 '17 at 09:16
  • ip-address-of-system – nevsv Oct 09 '17 at 10:42
  • @nevsv how would I confirm what the IP address of my system is? I'm on Ubutu 18.04 – daniel blythe May 13 '20 at 15:29
  • Do we get rid of the variable or append to it?Which one do we pick for `listen_address` and do we add quotes? This didn't even work for me – xjcl Jul 23 '20 at 17:38
  • @xjcl please read the question before the answer, and you will get an understanding of what "get rid" is referring to. Also, disregarding the fact that the question wasn't about how to find ip adress of the machine, in the comments there is an answer for output of ipconfig, also added to the answer. Regarding how to write ip adresses, the answer is to the question and not a basic cassandra course. You can find this info with 2 sec google search. – nevsv Aug 09 '20 at 12:44
3

Find and uncomment the following line from JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=" to JVM_OPTS="$JVM_OPTS -Djava.rmi.server.hostname=127.0.0.1"

If you face any difficulty on start cassandra, then delete the commit logs of datastax,

           C:\Program Files\DataStax-DDC\data\commitlog
praveenkumar s
  • 325
  • 4
  • 16
1

Check your system Memory i had a same issue but after increasing RAM 4GB its working properly.

sudip saha
  • 61
  • 1
1

Connection refused can have multiple causes, the most common one being that the application to connect to is not there. Check this using

sudo service cassandra status  # exit by pressing 'q'

If it says active (exited) in bold then Cassandra is not even running!

  • Check Cassandra's log for error messages:

    grep -A2 ERROR /var/log/cassandra/system.log
    
  • Watch htop after you sudo service cassandra restart -- if it fills up all of your available memory, Cassandra will die without an error message. On my EC2 instance an empty Cassandra takes up about 1.3 GB of RAM, which would be too little for a t2.nano or t2.micro instance.

xjcl
  • 12,848
  • 6
  • 67
  • 89