Cassandra Nodetool can't find NodeCmd from Git Bash - cassandra

I'm running Cassandra 2.0.9 with Java 1.7.0 on Windows. I can run nodetool normally from the Windows command line, but I'm not able to run it from the Git Bash (directly from terminal or through a sh script) or Cygwin when running .sh files that call NodeTool (but otherwise can run it).
The exact error I get is:
Error: Could not find or load main class org.apache.cassandra.tools.NodeCmd
I haven't done any kind of extra configuration outside of the recommended changes Datastax recommends, and I haven't had any other issues with Cassandra. I don't think I have any environment screw ups (but who knows what could be wrong). Has anyone else run into this issue before? Thanks!

Related

How to install Cassandra?

How do I download and install Apache Cassandra?
Assuming that you've already done this, but here's the Apache Cassandra download page: https://cassandra.apache.org/_/download.html
Following the links to download the current GA release should put an Apache Cassandra tarball in your ~/Downloads directory. I'd recommend moving that:
cd ~
mv ~/Downloads/apache-cassandra-4.0.6-bin.tar.gz .
Next, untar it:
tar -zxvf apache-cassandra-4.0.6-bin.tar.gz
That will create a directory containing Apache Cassandra. To start Cassandra cd into that directory and execute the cassandra binary.
cd apache-cassandra-4.0.6
bin/cassandra -p cassandra.pid
You should see several messages, but this indicates a successful start:
StorageService.java:2785 - Node localhost/127.0.0.1:7000 state jump to NORMAL
Running Cassandra like this with the -p option will put the process ID into the cassandra.pid file and run it in the background. To stop Cassandra, simply run a kill on the contents of the file.
kill `cat cassandra.pid`
Powershell script execution unavailable. Please use 'powershell Set-ExecutionPolicy Unrestricted' on this user-account to run cassandra with fully featured functionality on this platform. Starting with legacy startup options JAVA_HOME environment variable must be set!
Ahh... You're trying to run Cassandra on Windows! That's an important detail to mention. Cassandra used to ship with Powershell scripts for this purpose...which were removed with version 4.0. Your options:
Run Apache Cassandra 3.11, which still has the Powershell scripts.
Run Apache Cassandra 4.0 using local virtualization/containerization.
Last year I posted a video on how run Cassandra 4.0 locally on Windows using Minikube: Setting up Cassandra 4.0 locally on a Windows Machine
You can also use the official Cassandra container image on Docker Hub, assuming your company allows it, and you don't mind it missing important things like security.

Can't find Spark Submit when using Spark shell

I installed spark and am trying to run a file 'train.py' in the directory, '/home/xxx/Desktop/BD_Project', in shell using the following command:
$SPARK_HOME/bin/spark-submit /home/xxx/Desktop/BD_Project/train.py > output.txt
My teammates who used the same page that I did for spark installations have no problem when running this. However, it throws up the following error for me:
bash: /bin/spark-submit: No such file or directory
You need to set your SPARK_HOME to where your spark is installed, typically its in /usr/local/spark/bin/bin/spark-submit
Before you set it make sure where spark is installed by going to the directory.
You can set it like this before running your command :
export SPARK_HOME=/usr/local/spark/bin/bin/spark-submit
If you are homebrew user, setting your SPARK_HOME to
/opt/homebrew/Cellar/apache-spark/3.3.1/libexec"
would solve. Sorry for too late responding. Hoping this would help someone with this odd error.

Cassandra ccm not installed as application on windows 10

I have installed cassandra ccm tool on my windows 10 machine, and it got installed in directory 'C:\Python27\Scripts':
I have also added path to env variable PATH, but running ccm commands is not working:
ccm create -h
'ccm' is not recognized as an internal or external
command, operable program or batch file.
Is installation of ccm wrong?I see it's not installed as application.
The same question was asked on https://community.datastax.com/questions/11860/ so I'm reposting my answer here.
The most common causes of the reported error above are:
PYTHON_HOME is not set
PYTHON_HOME is not included in the PATH environment variable
As a side note, there are too many prerequisites for ccm to run on Windows so I recommend running Cassandra on Docker or better yet, use K8ssandra.io. Cheers!
I had to add .PY to PATHEXT system variable.

Error in running the command $ dse gremlin-console -i test.groovy

I came in to a situation in which I have to run a bash script lets say testbash.sh has the following lines:
#!/bin/bash
dse gremlin-console -i test.groovy
test.groovy file contains:
:remote config alias g cord.g
schema.describe()
The output of bash script testbash.sh is below
Error in /home/nithin/test.groovy at [2: schema.describe()] - No such property: schema for class: groovysh_evaluate.
Any clue will be greatly appreciated.
I can't seem to recreate your problem (at least on the latest version of 5.1.x). To troubleshoot, I think that you should first start dse gremlin-console without the -i and paste the commands from the script into the console and make sure that they return properly. If you get the same error, then you know that you can start looking into the problem from there without worrying about -i at all. Is cord.g initialized with a graph for a schema to be present?
If the commands work fine, then there must be something wrong with the console bootstrap that initializes it to work with the server on startup. The bootstrap script should be present in your DSE installation and is called dse-init.groovy. I would try pasting you commands into the bottom of that script and seeing if that solves your problem. If it does, then perhaps you have an older version of DSE because I do recall some changes in recent months for -i and -e handling that perhaps are related. I think that editing dse-init.groovy could be a reasonable workaround for you if you aren't able to upgrade for some reason.

Crontab skipping pg_restore if archive has sql errors

I have a strange problem with cron which is skipping pg_restore command (Postgres Restore) in the script file and not reporting any errors in the log file even if stderr is enabled. Could any one help what I am doing wrong?
Update:
Added Distribution Info and Cron,
I am using CentOS release 5.4 (Final) distribution with 64 bit package and my cron job is,
51 14 * * * /opt/scripts/test.sh 2>&1 >> /opt/logs/test.txt
Note: This is happening if backup(*.tar) archive has any errors but restores if I run the script manually.
Thanks,
Karthik
The odds are that you must specify the absolute, full path to the pg_restore command.
Since you don't seem to show your script, I cannot actually see that you forgot to.
This is a FAQ item since cron jobs run in a reduced environment and the PATH variable can be set to other things (or even be unset)
The problem is with the postgres version and the installed CentOS because I used external repository to download the latest version of postgres and learned that its always best to download the postgres version supported and verified by centos team from the same repository only.

Resources