Reputation: 1750
In order to install Cassandra, I've done the following: 1. Downloaded the TAR file. 2. Extracted the file. 3. Set the path for data and commitlog directories in the yaml file.
Now when I run Cassandra, I'm getting the following error: "Java HotSpot (TM) 64-Bit Server VM warning: Cannot open file. /..logs/gc.log due to No such file or directory"
What's causing this problem? Do I need to do something else before running it.
OS: RHEL 6.5 Cassandra version: 3.11.1
Upvotes: 5
Views: 8399
Reputation:
I am a windows user and I was facing a similar problem. I tried to resolve it by trying different things. Although I forgot one simple step, to run the command prompt as administrator. Once I ran as administrator, my problem was solved.
Upvotes: 0
Reputation: 341
Here is what worked for me: ${CASSANDRA_HOME} is set in /home/richard/.bashrc but with Cassandra you have a Cassandra user so ${CASSANDRA_HOME} has to be put in that Cassandra users /home/cassandra/.bashrc as well. My Cassandra is in
/usr/local/cassandra/apache-cassandra-3.11.3
so to add logs I did a sudo mkdir logs
. Then -ls -la showed root root so I did a
sudo chwon cassandra:cassandra logs
Do a cd .. to go up one directory and issue ls -la. I did a chown on each level above. I did it back to /usr/local which may be one to far and cause issues later but it looked low risk. Then I changed .bashrc in home and Cassandra from -Xloggc to -Xlog:gc as requried by the V9 and later Java
From JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
To JVM_OPTS="$JVM_OPTS -Xlog:gc:${CASSANDRA_HOME}/logs/gc.log"
I switch to the Cassandra user and started Cassandra successfully
sudo - cassandra
I have
export cassandra=/usr/local/cassandra/apache-cassandra-3.11.3/bin/cassandra
in .bashrc so when I enter $cassandra my first line echoed:
in /usr/local/cassandra/apache-cassandra-3.11.3/conf/casandra-env.sh
and my last line was
StorageService.java:2289 - Node localhost/127.0.0.1 state jump to NORMAL
If you are still having problems stick with it.
richard@sony:~$ sudo updatedb
richard@sony:~$ locate .bashrc
/home/richard/.bashrc
/home/cassandra/.bashrc
richard@sony:/usr/local/cassandra/apache-cassandra-3.11.3/logs$ ls -la
total 1636
drwxr-xr-x 2 cassandra cassandra 4096 Sep 30 10:30 .
drwxrwxr-x 12 cassandra cassandra 4096 Sep 30 10:17 ..
-rw-rw-r-- 1 cassandra cassandra 1569961 Sep 30 11:31 debug.log
-rw-rw-r-- 1 cassandra cassandra 1116 Sep 30 11:46 gc.log
-rw-rw-r-- 1 cassandra cassandra 945 Sep 30 10:18 gc.log.0
-rw-rw-r-- 1 cassandra cassandra 85584 Sep 30 11:31 system.log
Upvotes: 0
Reputation: 2124
Cassandra logs all gcs in a log file called gc.log. The path of this file is defined in cassandra-env.sh:
#GC log path has to be defined here because it needs to access CASSANDRA_HOME
JVM_OPTS="$JVM_OPTS -Xloggc:${CASSANDRA_HOME}/logs/gc.log"
Make sure you have a folder in your cassandra folder called logs and that whatever user you're running cassandra with has write permisssions to this folder.
Upvotes: 7