cqlsh and nodetool command not found - cassandra

I have installed cassandra 3.11.4 as per the below link http://cassandra.apache.org/download/ and when I'm trying to run cqlsh and nodetool command its showing command not found.
when run sudo service cassandra status,cassandra is running.
Please help

First, you need to verify that the service is healthy and operational
verify that the process is running:
ps -efa | grep cassandra
The expected outcome is a valid java process being executed
verify the log file as defined in $CASSANDRA_HOME/conf/logback.xml
tail -n 100 cassandra/system.log
The expected outcome is to not find errors
Try to replicate the issue in a new instance of the command line

You need to verify the services whether it is running or not in the configured port and IPs.
Also, you can check the system.log for any error. if still issue and data is not important you can delete the /data /commitlog /savedcache and restart the cassandra services again.
once started just check
ps -ef | grep cassandra

Related

Cannot start Cassandra - Snitch's Datacenter Differs from Previous

Im trying to start DSE 5.0.1 Cassandra (Single node) in my local.
Getting below error:
CassandraDaemon.java:698 - Cannot start node if snitch's data center
(Cassandra) differs from previous data center (Graph). Please fix the
snitch configuration, decommission and rebootstrap this node or use
the flag -Dcassandra.ignore_dc=true
If you are using GossipingPropertyFileSnitch, start Cassandra with the option
-Dcassandra.ignore_dc=true
If it starts successfully, execute:
nodetool repair
nodetool cleanup
Afterwards, Cassandra should be able to start normally without the ignore option.
This occurs when the node starts and see's that it has information indicating that it was previously part of a different datacenter. This occurs if the datacenter was different on a prior boot and was then changed.
In your case you are most likely using DseSimpleSnitch which names the Datacenter based on the workload of that node. Previously the node was started with Graph enabled which turned the name to Graph. Now trying to start it without Graph enabled leads to it naming the Datacenter Cassandra which is the default.
Using the -Dcassandra.ignore_dc=true flag will allow you to proceed but a better solution would be to switch to GossipingPropertyFileSnitch and give this machine a dedicated datacenter name.
Another option (if you are just testing) is to wipe out the data directory as this will clear out the information previously labeling the datacenter for the node. This will most likely be sudo rm -R /var/lib/cassandra/
This issue will happen when you change Datacenter name in this below respective file /etc/dse/cassandra/cassandra-rackdc.properties
To resolve please follow the below 3 steps
Clear the below-mentioned directories(Note:- if have data please take a backup with cp command )
cd /var/lib/cassandra/commitlog
sudo rm -rf *
cd /var/lib/cassandra/data
sudo rm -rf *
now start the dse service with the below command
service dse start
command to check the list node's status
nodetool -h ::FFFF:127.0.0.1 status

Cassandra Unknown command bootstrap

I am new to cassandra but it seems the nodetool bootstrap command is not working.
huangg#cassandra-mpsre01-sjc1:~$ nodetool help bootstrap
Unknown command bootstrap
huangg#cassandra-mpsre01-sjc1:~$ nodetool bootstrap resume
nodetool: Found unexpected parameters: [bootstrap, resume]
See 'nodetool help' or 'nodetool help <command>'.
huangg#cassandra-mpsre01-sjc1:~$ nodetool help |grep bootstrap
rebuild Rebuild data by streaming from other nodes (similarly to bootstrap)
Is it a version issue?
[cqlsh 5.0.1 | Cassandra 2.1.9 | CQL spec 3.2.0 | Native protocol v3]
I want to use it because I want to resume a node after I decommission it. Right now, after I decommission a node, I have to stop cassandra service and then restart the cassandra service. I guess bootstrap can be used after the decommission command, to commission the node.
nodetool join is a different thing.
So there are two things here
1. First the commands which you specified don't seem correct.
For Bootstrap you can probably use the following link and see the correct syntax.
https://docs.datastax.com/en/cassandra/2.2/cassandra/tools/toolsBootstrap.html
Now after the node is decommissioned, you would want to rebuild it from another node and then work with it as the other nodes are working.
For that you can use nodetool rebuild.
https://docs.datastax.com/en/cassandra/2.1/cassandra/tools/toolsRebuild.html
Both are similar commands, but you can see which suits your scenario best and use accordingly.
nodetool bootstrap doesn't exist in c* 2.1.9. nodetool rebuild is the closest command
$ nodetool help rebuild NAME
nodetool rebuild - Rebuild data by streaming from other nodes (similarly
to bootstrap)
SYNOPSIS
nodetool [(-h | --host )] [(-p | --port )]
[(-pw | --password )]
[(-pwf | --password-file )]
[(-u | --username )] rebuild [--]
OPTIONS
-h , --host
Node hostname or ip address
-p <port>, --port <port>
Remote jmx agent port number
-pw <password>, --password <password>
Remote jmx agent password
-pwf <passwordFilePath>, --password-file <passwordFilePath>
Path to the JMX password file
-u <username>, --username <username>
Remote jmx agent username
--
This option can be used to separate command-line options from the
list of argument, (useful when arguments might be mistaken for
command-line options
<src-dc-name>
Name of DC from which to select sources for streaming. By default,
pick any DC

DataStax OpsCenter not starting on centos dse cluster

I am trying to setup cassandra cluster with 5 nodes. I have installed dse on all nodes and started dse on all the nodes by command.
sudo service dse start
dse is running fine on all nodes.
Now I am trying to configure opscenter following http://www.datastax.com/documentation/opscenter/3.2/webhelp/index.html#opsc/install/../../opsc/install/opscInstallRHEL_t.html
When I execute "sudo service opscenterd start", it starts without any problem and even log doesnt show any problem.
But when I try doing "netstat -a | grep 8888", it doesnt show any listener.
Can anybody please help me in identifying issue?
Thanks,
Jenish
I would first figure out if the service is indeed starting. When you say you checked log, was that /var/log/messages or the opscenter logs? I would check both.
Next I would see if it stays running. You can also check for the process running with
ps -eaf | grep opscenterd
If everything is running but not listening on the right port, you should check your opscenterd.conf file for proper port and interface:
[webserver]
port = 8888
interface = 127.0.0.1
Note that your interface definition may be different - for example, it may be 0.0.0.0 which signifies binding to all interfaces (rather than just localhost as above), but you should validate that it is correct for your environment.

Load cassandra schema programmatically

I'm trying to install and configure cassandra programmatically using a shell script.
I install cassandra, run ./cassandra and then I try to load the schema using cassandra-cli --host localhost -f <schema-file>. The problem is that it tries to load the schema before cassandra is up and throws an exception. Is there any way to know when cassandra is up and running?
Thanks!
You can check to see if anything is listening on 9160 (the Thrift port) prior to loading the schema. Binding to the port is the last thing the service does, and indicates it's ready to service requests.
If Cassandra is running this command will return something:
sudo lsof -i :9160
use ./cassandra -f then you will know it when Cassandra starts to listen on the Thrift port

Cannot connect to my Cassandra with localhost

My Cassandra used to work with no problems.
I was able to connect with no problems but now for some reason it doesn't work anymore.
[default#unknown] connect localhost/9160;
Exception connecting to localhost/9160. Reason: Connection refused.
I am in Ubuntu server
Thanks in-advance
The solution to this question was provided to you on the pycassa google group:
https://groups.google.com/d/topic/pycassa-discuss/Bai7bvkHYU4/discussion
This is not a pycassa problem. The problems you are having are specific to starting a Cassandra instance and not following the documentation in the README.txt that is in the root folder of the distribution:
Getting started
This short guide will walk you through getting a basic one node cluster up
and running, and demonstrate some simple reads and writes.
tar -zxvf apache-cassandra-$VERSION.tar.gz
cd apache-cassandra-$VERSION
sudo mkdir -p /var/log/cassandra
sudo chown -R whoami /var/log/cassandra
sudo mkdir -p /var/lib/cassandra
sudo chown -R whoami /var/lib/cassandra
Note: The sample configuration files in conf/ determine the file-system
locations Cassandra uses for logging and data storage. You are free to
change these to suit your own environment and adjust the path names
used here accordingly.
Now that we're ready, let's start it up!
bin/cassandra -f
Running the startup script with the -f argument will cause Cassandra to
remain in the foreground and log to standard out.
Now let's try to read and write some data using the command line client.
bin/cassandra-cli --host localhost
The command line client is interactive so if everything worked you should
be sitting in front of a prompt...
Connected to: "Test Cluster" on localhost/9160
Welcome to cassandra CLI.
Type 'help;' or '?' for help. Type 'quit;' or 'exit;' to quit.
[default#unknown]
As the banner says, you can use 'help;' or '?' to see what the CLI has to
offer, and 'quit;' or 'exit;' when you've had enough fun.
Verify the following:
Cassandra process is running and thrift is listening on 9160 (netstat-tulpn)
9160 port not being blocked by a firewall rule or similar
If the above are true, then check the cassandra log for additional information.
Other than that your description is pretty vague. So any other information about what may have changed in the environment would be helpful.
I faced the same problem and the reason was that I had configured Cassandra to listen on the Server IP and not on localhost.
/etc/dse/cassandra/cassandra.yaml
listen_address: 10.102.8.71
So try this and check if it works for you:
cassandra-cli --host "your host name"

Resources