Where is cassandra backup stored on windows - cassandra

I am using Cassandra 1.2 db on windows 7.
I want to take the back up of a keyspace.
I am doing as following:
C:\Workspace\apache-cassandra-1.2.4-bin\bin> nodetool -h localhost -p 7199 snaps
hot myDb
Starting NodeTool
Requested snapshot for: myDb
Snapshot directory: 1371534210892
C:\Workspace\apache-cassandra-1.2.4-bin\bin>
So it shows snapshot directory as 1371534210892 . What does it mean?
Where can I find the snapshot just created ?

TL;DR;
Check C:\var\lib\cassandra\data\system\myDb\snapshots\1371534210892
Before I provide details its important that you know my environment so you can compare.
How I setup Cassandra
I downloaded the zip from Apache's website then I unzipped it to C:\apache-cassandra-1.2.5 and finally I added the CASSANDRA_HOME environment variable.
How I start / backup Cassandra
I start cassandra by running startup.bat in the bin folder:
C:\apache-cassandra-1.2.4\bin\cassandra.bat
I backup cassandra by running the same command that you did (I backed up system because it was a fresh cassandra install):
nodetool -h localhost snapshot system
# output:
Starting NodeTool
Requested snapshot for: system
Snapshot directory: 1371547087563
I then browsed to the following directory where I found the 1371547087563 folder:
C:\var\lib\cassandra\data\system\local\snapshots
The snapshot is also created for every other keyspace so with a clean install I could find it in:
C:\var\lib\cassandra\data\system\schema_columns\snapshots
C:\var\lib\cassandra\data\system\schema_columnfamilies\snapshots
C:\var\lib\cassandra\data\system\schema_keyspaces
So basically it backups up the 4 internal keyspaces (system, schema_columns, schema_columnfamilies, schema_keyspaces) and the keyspace that you provide on the end as a parameter to the nodetool command, but because I specified system as the param, the command created snapshots of the 4 internal keyspaces only.
In your case the fifth keyspace would be the one you are after.

find 1371534210892 folder inside cassandra/data/yourkeyspacename (equivalent to folder/var/lib/data/yourkeyspacename in LINUX) here each CF have 1371534210892 folder under snapshot directory which is latest one,
This base cassandra folder is the one which you generated during installation not the one having bin and all directories

Related

Java HotSpot(TM) Server VM warning in Cassandra

I am getting following error while running the cassandra.
$ sudo service cassandra start
$ cassandra
Java HotSpot(TM) Server VM warning: Cannot open file /var/log/cassandra/gc.log due to Permission denied.
I guess you have installed the Cassandra using repositories. Cassandra needs a directory to store data and in your case, it cannot create that directories because of permission problems. You have three-way:
Become the root user using the command sudo su and run the command cassandra as the root user. You can issue the command sudo systemctl enable cassandra.service to run Cassandra automatically at startup.
change the following setting in cassandra.yaml file to where the user has permission, like your home directory.
data_file_directories
commitlog_directory
saved_caches_directory
add the line export CASSANDRA_HOME=path/to/cassandra in user .bashrc file and after that run source .bashrc to compile it. This makes Cassandra know the Cassandra install directory and creates the nesseccery folder within that.

How can we set nodetool and cqlsh to be run from anywhere and by any user on linux server

I am trying to setup environment variables so that any user on a particular server can run commands like nodetool or cqlsh from any where in linux file system . The effort to traverse to bin directory everytime should be saved .
How can we achieve this ? My DSE 4.8 is a tarball install .
Nodetool is usually available to any user that has execution privileges in your linux boxes
For cqlsh, you can set any configuration inside the cqlshrc file (usually found in $HOME/.cassandra/cqlshrc; we have used to enable client-node encryption but has more configurable options
To setup environment variable just follow some steps from root user:
# vi /etc/profile.d/cassandra.sh
Add the following lines to the cassandra.sh file-
export CASSANDRA_HOME=/opt/apache-cassandra-3.0.8
export CASSANDRA_CONF_DIR=/opt/apache-cassandra-3.0.8/conf
Here /opt/ is my directory, where I've extracted my apache-cassandra-3.0.8-bin.tar.gz tarball.
After adding those lines to cassandra.sh, save and exit. Then-
# source /etc/profile.d/cassandra.sh

Cassandra system disk full

After starting Cassandra and starting batch writes, the system disk becomes full and when I inspect it using df -h. But I can't find the which files use this space used. I tried to inspect using du -h with no success. After restarting the machine, the problem still exists.
When I delete some files and start Cassandra again I got about 11GB available?
Any advice to got a solution for this problem?
Thanks
For data and commit log files see these places. You can configure these in cassandra.yaml file.
data_file_directories
The directory location where table data (SSTables) is stored. Cassandra distributes data evenly across the location, subject to the granularity of the configured compaction strategy. Default locations:
Package installations: /var/lib/cassandra/data
Tarball installations: install_location/data/data
commitlog_directory
The directory where the commit log is stored. Default locations:
Package installations: /var/lib/cassandra/commitlog
Tarball installations: install_location/data/commitlog
For more information read this.

Setting up Cassandra on Cloud9 IDE

I've followed these instructions to install Cassandra: http://docs.datastax.com/en/cassandra/2.0/cassandra/install/installDeb_t.html
When I do $ cqlsh terminal replies me with
Connection error: Could not connect to localhost:9160
I read that the issue might be with configuration file cassandra.yaml
However, I turned out I can't access it. My etc/cassandra folder is empty: enter image description here
How to access cassandra.yaml?
Where is cassandra is stored in my project?
Is there a way to check if Cassandra is actually set up in project?
The image you have attached is showing the ~/.cassandra directory off of your home dir. That's not the same as/etc/cassandra. You should be able to confirm this with the following command:
$ ls -al /etc/cassandra/cassandra.yaml
-rw-r--r-- 1 cassandra cassandra 43985 Mar 11 12:46 /etc/cassandra/cassandra.yaml
To verify if Cassandra is even running, this should work for you if you have successfully completed the packaged install:
$ sudo service cassandra status
Otherwise, simply running this should work, too:
$ ps -ef | grep cassandra
When you set up Cassandra, you'll want to set the listen_address and rpc_address to the machine's hostname or IP. They're set to localhost by default, so if it's running cqlsh should connect to that automatically.
My guess is that Cassandra is not starting for you. Check the system.log file, which (for the packaged install) is stored in /var/logs/cassandra:
$ cat /var/log/cassandra/system.log
Check out that file, and you might find some clues as to what is happening here.
Also, did you really install Cassandra 2.0? That version has been deprecated, so for a new install you shouldn't go any lower than Cassandra 2.1.

How to load data to remote server using sstableloder?

I am newbie to the cassandra, the situation is:
[1] I want to bulkload(bulk-upload) my cassandra data from my client PC into the "remote server A"
[2] the IPAddress of the remote server A is 192.168..
[3] so I typed as follows from my client PC:
$ sstableloader -d 192.168.**.** [path/to/my/clientPC's/cassandra/columnFamily/Directory]
[4] the cassandra is running on both of clientPC and remote server A
then, I get the message like this...
Could not retrieve endpoint ranges:
I cant get what on earth is going on here... please somebody help me...
Ensure that you are running the command from your C* data directory root, and then pass the relative path for the keyspace and columnFamily. The target database must also have the same keyspace name and column family name.
So if your C* data dir in cassandra.yaml is defined as /cassandra/data and your keyspace is ks1 and column family is my_cf, then cd to /cassandra/data, the run sstableloader -d <ip> ks1/mv_cf.
From http://www.datastax.com/docs/1.1/references/bulkloader
Using sstableloader
In binary installations, sstableloader is located in the
/bin directory.
The sstableloader bulk loads the SSTables found in the directory
to the configured cluster. The parent directory of
is used as the keyspace name. For example to load an
SSTable named Standard1-he-1-Data.db into keyspace Keyspace1, the
files Keyspace1-Standard1-he-1-Data.db and
Keyspace1-Standard1-he-1-Index.db must be in a directory called
Keyspace1/Standard1/.
bash sstableloader [options]
Example:
$ ls -1 Keyspace1/Standard1/ Keyspace1-Standard1-he-1-Data.db
Keyspace1-Standard1-he-1-Index $ /bin/sstableloader
-d localhost //
Also, make sure any sstableloader defaults (such as port) match your target C* cluster.

Resources