Cannot create KeySpace using Cassandra-CLI - cassandra

I have installed and started up Cassandra server(1.0.8). I can connect to the server using the CLI application. But as soon as I try to create a keyspace "twissandra" following the step from CassandraCLI
I end up getting the following error
I can see the cassandra.yaml file in "config" directory of the installation.
EDIT - THE ANSWER
OK So after a few days of short chitty chats with libjack. The error was tracked down.
REM set CLASSPATH="%CASSANDRA_HOME%\conf"
The line above is a remark (comment if you may) I had to go through the whole BAT file line by line before finally removing the REM clause.

The cassandra.yaml is expected to be found in the classpath. By default, the cassandra.bat (my version from 1.07 zip) adds the $CASSANDRA_HOME\conf directory to the classpath (as well as other necessary Jars)
If CASSANDRA_HOME is not set, it uses the directory above the script location.
To test, perhaps modify the cassandra.bat to echo out all the commands and see where things get messed up.

Related

Starting Cassandra on the foreground

If I start the Cassandra service everything is ok, but when I try to start Cassandra on the foreground using "cassandra -f" I get the following error:
Error: Could not find or load main class
Files\DataStax-DDC\apache-cassandra.logs.gc.log
Do I need to configure anything in particular to run Cassandra in the foreground?
Looks like the space in your "Program Files" directory is not escaped in your CASSANDRA_HOME environment variable. It gets set in your cassandra-env.ps1 (in conf/) config file, you could manually set it.

Changing data file directories Cassandra

I'm trying to change the Cassandra data, commit log and saved caches directories by defining a custom shell script for CASANDRA_INCLUDE. I'm modifying the properties in the script as follows :
***
data_file_directories = "/usr/pic1/kearanky/cassandra/data"
commitlog_directory = "/usr/pic1/kearanky/cassandra/commitlog"
saved_caches_directory: "/usr/pic1/kearanky/cassandra/saved_caches"
***
When I run cassandra I get the error "data_file_directories: command not found". How can I modify the directories correctly?
PS: I don't have write access to cassandra.yaml and can't create the default directories it uses.
referrer to this answer Make your own cassandra.yaml with your custom directories and then run cassandra with with -d flag and cassandra.config=directory
or set $CASSANDRA_HOME variable in your .bashrc and then run cassandra

puppet: Could not back up <file>: Got passed new contents for sum

I had a question I was hoping someone might have an answer to. Essentially what I'm doing is try to ensure I'm always using a fixed, slightly older version of phpunit, which I've placed in my module's file resources.
The manifest:
file
{
"/usr/bin/phpunit":
ensure => file,
owner => 'root',
group => 'root',
mode => 0755,
source => "puppet:///modules/php/phpunit"
}
Preparation: I download the current ('wrong') version of phpunit and place it in /usr/bin.
So the first run puppet succeeds:
Notice: Compiled catalog for <hostname> in environment production in 3.06 seconds
Notice: /Stage[main]/Php/File[/usr/bin/phpunit]/content: content changed '{md5}9f61f732829f4f9e3d31e56613f1a93a' to '{md}38789acbf53196e20e9b89e065cbed94'
Notice: /Stage[main]/Httpd/Service[httpd]: Triggered 'refresh' from 1 events
Notice: Finished catalog run in 15.86 seconds
Then I download the current (still 'wrong') version of phpunit and place it in /usr/bin again.
This time the puppet run fails.
Notice: Compiled catalog for <hostname> in environment production in 2.96 seconds
Error: Could not back up /usr/bin/phpunit: Got passed new contents for sum {md5}9f61f732829f4f9e3d31e56613f1a93a
Error: Could not back up /usr/bin/phpunit: Got passed new contents for sum {md5}9f61f732829f4f9e3d31e56613f1a93a
Error: /Stage[main]/Php/File[/usr/bin/phpunit]/content: change from {md5}9f61f732829f4f9e3d31e56613f1a93a to {md5}38789acbf53196e20e9b89e065cbed94 failed: Could not back up /usr/bin/phpunit: Got passed new contents for sum {md5}9f61f732829f4f9e3d31e56613f1a93a
What gives? If I delete the file ( /var/lib/puppet/clientbucket/9/f/6/1/f/7/3/2/9f61f732829f4f9e3d31e56613f1a93a/ ) from my filebucket it will work again... for the next run, but not the one after that.
What am I doing wrong?
I'd appreciate any input and thanks in advance.
Been having this error as well. I solved it with a combination of two previous answers.
Firstly I had to delete /var/lib/puppet/clientbucket on the client node by running:
sudo rm -r /var/lib/puppet/clientbucket
Just doing this will only let it run once more.
Then I had to mark the backup => false to stop it recreating the file, missing out either step failed to solve it for me. The accepted answer is incorrect by saying there is
"no solution other than upgrading".
I was able to fix the same problem by removing /var/lib/puppet/clientbucket on the client node.
This node has been running out of disk space, so puppet has probably incorrectly stored empty files there.
As a workaround, you can set backup => false in the file resource. This is a little unsafe, of course.
This has no solution other than to upgrade since there's a bug in certain versions of puppet where files containing both UTF8 and binary characters are treated wrongly, and it results in an error message.
https://tickets.puppetlabs.com/browse/PUP-1038
The ridiculously overcomplicated solution I used as a workaround is to have a .tar file in the file resource which notifies an exec which untars and places the actual executable in the correct directory, making sure the timestamp for the latter is newer than the former.
It's far from ideal but it works in cases like mine where upgrading puppet to the most current version isn't an attractive option.

Cassandra dead but pid file exists

I have novice to cassandra and tried my hands to install cassandra-2.1.2 on centos 7.0.
After complete installation execute cqlsh command and created few keyspace(s) and column family.
Which seems to me in first glance its working perfectly.
But later onwards i realized below issues:
1- when i execute "service cassandra status" command, i got below error:
Output:Cassandra dead but pid file exists.
I googled the above issue and found some links
http://www.datastax.com/support-forums/topic/dse-dead-but-pid-file-exists
https://baioradba.wordpress.com/2014/06/13/how-to-install-cassandra-on-centos-6-5/
and found that I had same configuration mentioned in above links but the same error still persists.
Please tell me the root cause and how to resolve it.
2- Second issue is in the cassandra.log file.
When I analysed the cassandra.log file there was an expection as :
Expecting URI in variable: [cassandra.config]. Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting.
Below is the complete log:
12:01:40.816 [main] ERROR o.a.c.config.DatabaseDescriptor - Fatal configuration error
org.apache.cassandra.exceptions.ConfigurationException: Expecting URI in variable: [cassandra.config]. Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting.
at org.apache.cassandra.config.YamlConfigurationLoader.getStorageConfigURL(YamlConfigurationLoader.java:73) ~[apache-cassandra-2.1.3.jar:2.1.3]
at org.apache.cassandra.config.YamlConfigurationLoader.loadConfig(YamlConfigurationLoader.java:84) ~[apache-cassandra-2.1.3.jar:2.1.3]
at org.apache.cassandra.config.DatabaseDescriptor.loadConfig(DatabaseDescriptor.java:158) ~[apache-cassandra-2.1.3.jar:2.1.3]
at org.apache.cassandra.config.DatabaseDescriptor.<clinit>(DatabaseDescriptor.java:133) ~[apache-cassandra-2.1.3.jar:2.1.3]
at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:110) [apache-cassandra-2.1.3.jar:2.1.3]
at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:465) [apache-cassandra-2.1.3.jar:2.1.3]
at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:554) [apache-cassandra-2.1.3.jar:2.1.3]
Expecting URI in variable: [cassandra.config]. Please prefix the file with file:/// for local files or file://<server>/ for remote files. Aborting.
Fatal configuration error; unable to start. See log for stacktrace.
I again searched the same issue in google and but the links were not that useful as they contained the java class code for cassandra.config .
Again please tell the root cause and how to resolve it?
Thanks in advance.
rm /var/run/cassandra.pid
Run ps -ef | grep cassandra
Kill the pid of the cassandra process.
Start cassandra
fix this issue, Edit the cassandra-env.sh:
sudo vi /etc/cassandra/conf/cassandra-env.sh
increase heap size for cassandra .. this should resolve your issue
Check if you have enough memory to start cassandra service with this command:
cat /proc/meminfo
I was running Hortonworks VM with Virtualbox, and I had a lot of Hadoop components started which needed a lot of memory, so for me the solution was to stop unnecessary Hadoop components and add some extra memory to the virtual machine.
From https://github.com/apache/cassandra/blob/cassandra-2.1/examples/client_only/README.txt#L43-L49 :
cassandra.yaml can be on the classpath as is done here, can be
specified (by modifying the script) in a location within the classpath
like this: java -Xmx1G
-Dcassandra.config=/path/in/classpath/to/cassandra.yaml ... or can be retrieved from a location outside the classpath like this: ...
-Dcassandra.config=file:///path/to/cassandra.yaml ... or ... -Dcassandra.config=http://awesomesauce.com/cassandra.yaml ...
So you probably had a misconfigured startup option.
Remove the pid file. Try
rm /var/run/cassandra.pid

DataStax Opscenter Agent doesn't connect: "Unable to locate cassandra.yaml configuration file"

I have installed Datastax Community Edition v2.0.3 on a Windows Server 2012 R2 Datacenter machine.
After a vanilla install, I can't connect to the database with OpsCenter because the agent failed to start: it says "0 of 1 agents connected" in the top of the page. I can connect to the database itself using CQLSH. This problem does not occur with v2.0.2.
My datastax_opscenter_agent-stderr.log file contains the following:
2013-12-05 16:16:54 Commons Daemon procrun stderr initialized
Exception in thread "Initialization" clojure.lang.ExceptionInfo: throw+: {:type :bad-permissions, :message "Unable to locate the cassandra.yaml configuration file. If your configuration file is not located with the Cassandra install, please set the 'conf_location' option in the Cassandra section of the OpsCenter cluster configuration file and restart opscenterd. Checked the following directories: [\"/etc/dse/cassandra/cassandra.yaml\" \"/etc/cassandra/conf/cassandra.yaml\" \"/etc/cassandra/cassandra.yaml\" \"C:\\\\Program Files\\\\DataStax Community\\\\apache-cassandra\\\\bin\\\\conf\\\\cassandra.yaml\"]"} {:object {:type :bad-permissions, :message "Unable to locate the cassandra.yaml configuration file. If your configuration file is not located with the Cassandra install, please set the 'conf_location' option in the Cassandra section of the OpsCenter cluster configuration file and restart opscenterd. Checked the following directories: [\"/etc/dse/cassandra/cassandra.yaml\" \"/etc/cassandra/conf/cassandra.yaml\" \"/etc/cassandra/cassandra.yaml\" \"C:\\\\Program Files\\\\DataStax Community\\\\apache-cassandra\\\\bin\\\\conf\\\\cassandra.yaml\"]"}, :environment {tar-location "C:\\Program Files\\DataStax Community\\apache-cassandra\\bin\\conf\\cassandra.yaml", conf nil, checked-files ["/etc/dse/cassandra/cassandra.yaml" "/etc/cassandra/conf/cassandra.yaml" "/etc/cassandra/cassandra.yaml" "C:\\Program Files\\DataStax Community\\apache-cassandra\\bin\\conf\\cassandra.yaml"]}}
at opsagent.util.cassandra_util$cassandra_conf_location.invoke(cassandra_util.clj:118)
at opsagent.util.cassandra_util$get_cassandra_conf.invoke(cassandra_util.clj:130)
at opsagent.opsagent$create_thrift_conf_vars.invoke(opsagent.clj:52)
at opsagent.opsagent$setup_thrift.invoke(opsagent.clj:138)
at opsagent.jmx$determine_ip.invoke(jmx.clj:333)
at opsagent.jmx$setup_jmx$fn__1309.invoke(jmx.clj:350)
at clojure.lang.AFn.run(AFn.java:24)
at java.lang.Thread.run(Unknown Source)
There is in fact a cassandra.yamlfile in the C:\Program Files\DataStax Community\apache-cassandra\conf directory, where it is supposed to be. The message above states that it looked in C:\\Program Files\\DataStax Community\\apache-cassandra\\bin\\conf\\cassandra.yaml, though (notice the \bin).
Setting the conf_location option in the opscenter\conf\clusters\local.conf, as per the log's suggestion, results in the same error.
The Windows Firewall has been turned off through all this.
Edit
I've been tinkering a little bit, and now I get the same exception in the log, except the path where it's been looking for cassanda.yaml has changed from
'C:\Program Files\DataStax Community\apache-cassandra\bin\conf\cassandra.yaml'
to
'C:\Program Files\DataStax Community\utils\conf\cassandra.yaml'
I have no idea what I did to change this.
I have tried copying cassandra.yaml to the directory above. This gets rid of the exception in datastax_opscenter_agent-stderr.log, but OpsCenter still says "0 of 1 agents connected". However, the Dashboard is now showing data in the graphs. I am also able to add a keyspace to the schema, but it won't show up after I created it. It is accessible using CLQSH, though. Obviously having cassandra.yaml in two different places is not ideal, either.
I fixed this problem by setting the conf_location property as below:
conf_location = C:\Program Files\DataStax Community\apache-cassandra\conf\cassandra.yaml
Initially I was using quotes around the path, which didn't work. Removing the quotes did the trick.
I had the same problem in Windows 7 x64 while installing DataStax Community Edition v1.2.15. I got it working and then after backup and rollback I used Beyond Compare to identify exactly what change actually fixed this. There is some ambiguity in khaledh's otherwise correct answer and in the equivalent SF question, thus I am providing a more complete answer.
In C:\Program Files\DataStax Community\opscenter\conf\clusters\local.conf, the default contents of ..
[cassandra]
seed_hosts = 127.0.0.1
.. should instead be ..
[cassandra]
seed_hosts = 127.0.0.1
conf_location = C:\\Program Files\\DataStax Community\\apache-cassandra\\conf\\cassandra.yaml
Restart the services and then in OpsCenter if it still says "0 of 1 agents" click on the "Fix now" link. In my case it was not until I clicked on this link that it self-updated and showed "1 of 1" without any prompting or alerts.
I fixed this issue by adding entry in the agent configuration file address.yaml,
Steps,
Login to Agent machine
Stop agent
Add the JAVA_HOME if not already added
Edit ( create if not exists ) address.yaml
( located at /etc/datastax-agent/ if you have installed OpsCenter Agents using package manager )
Add entry as
cassandra_conf:
Start the agent
Restart the opscenter - the new agent wonts show up until you restart opscenter
cassandra_conf: /usr/lib/cassandra-2.0.5/conf/cassandra.yaml
Create the if not exists
( For DataStax version 5.0.1 for both Opscenter and Agent )

Resources