DataStax Academy FAQ

DataStax Academy migrated to a new learning management system (LMS) in July 2020. We are also moving to a new Cassandra Certification process so there are changes to exam bookings, voucher system and issuing of certificates.

Check out the Academy FAQ pages for answers to your questions:


question

igor.rmarinho_185445 avatar image
igor.rmarinho_185445 asked ·

Why does nodetool import return "Directory ... does not exist"?

Hi,
I'm try to import some sstables using nodetool import, but it's saying that my folder does not exist even if the folder is there and contain the sstables.

[root@lab-1234]# nodetool -u cassandra -pw cassandra  import employee position_by_id /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234

[root@lab-1234]# nodetool import employee position_by_id /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234
error: Directory /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234 does not exist
-- StackTrace --
java.lang.RuntimeException: Directory /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234 does not exist
at org.apache.cassandra.db.SSTableImporter.getSSTableListers(SSTableImporter.java:277)
at org.apache.cassandra.db.SSTableImporter.importNewSSTables(SSTableImporter.java:77)
at org.apache.cassandra.db.ColumnFamilyStore.importNewSSTables(ColumnFamilyStore.java:832)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:4

the folder exist and the sstables are inside of it

[root@lab-1234]# cd /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234
[root@lab-1234]# pwd
/media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234
[root@lab-usa-dse-node-1 1234]# ll
total 15184
-rw-r--r-- 1 cassandra cassandra    8199 Jul 15 19:57 ba-267-bti-CompressionInfo.db
-rw-r--r-- 1 cassandra cassandra 5978627 Jul 15 19:57 ba-267-bti-Data.db
-rw-r--r-- 1 cassandra cassandra  228824 Jul 15 19:57 ba-267-bti-Filter.db
-rw-r--r-- 1 cassandra cassandra 1765208 Jul 15 19:57 ba-267-bti-Partitions.db
-rw-r--r-- 1 cassandra cassandra       0 Jul 15 19:57 ba-267-bti-Rows.db
-rw-r--r-- 1 cassandra cassandra   10464 Jul 15 19:57 ba-267-bti-Statistics.db
-rw-r--r-- 1 cassandra cassandra    7719 Jul 15 19:57 ba-268-bti-CompressionInfo.db
-rw-r--r-- 1 cassandra cassandra 5624953 Jul 15 19:57 ba-268-bti-Data.db
-rw-r--r-- 1 cassandra cassandra  228824 Jul 15 19:57 ba-268-bti-Filter.db
-rw-r--r-- 1 cassandra cassandra 1660504 Jul 15 19:57 ba-268-bti-Partitions.db
-rw-r--r-- 1 cassandra cassandra       0 Jul 15 19:57 ba-268-bti-Rows.db
-rw-r--r-- 1 cassandra cassandra   10416 Jul 15 19:57 ba-268-bti-Statistics.db
-rw-r--r-- 1 cassandra cassandra      54 Jul 21 15:14 manifest.json
-rw-r--r-- 1 cassandra cassandra    1020 Jul 21 15:14 schema.cql

Any idea on it?

Thank you.

dserestorenodetool import
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

1 Answer

smadhavan avatar image
smadhavan answered ·

@igor.rmarinho_185445, it is weird that you're getting an error on a different directory than what you've passed in as arguments to the command,

 [root@lab-1234]# nodetool import employee position_by_id /media/cassandra/data/stagingusagcpcommon_employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234
 error: Directory /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots/1234 does not exist

In any case, can you check what's the permissions set on the 1234 directory by running the below command?

 ls -l /media/cassandra/data/employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots
 ls -l /media/cassandra/data/stagingusagcpcommon_employee/position_by_id-d326e650bf8c11ea8e4d4792f2e6dfb4/snapshots

Also, what is the user with which you're running the Cassandra?

 ps -ef|grep cassandra

[EDIT] If the user running the Cassandra process does not have permissions on the directory, it won't be able to access it. You need to fix the permissions on the target directory (and its parents) for the import to work.

3 comments Share
10 |1000 characters needed characters left characters exceeded

Up to 8 attachments (including images) can be used with a maximum of 1.0 MiB each and 10.0 MiB total.

Hi @smadhavan, was my bad I was trying to hide this info, lol.

another example:


nodetool -u cassandra -pw cassandra import system_auth roles /media/cassandra/data/system_auth/roles-5bc52802de2535edaeab188eecebb090/snapshots/daily-full-10.20.50.12-202007211514

error: Directory /media/cassandra/data/system_auth/roles-5bc52802de2535edaeab188eecebb090/snapshots/daily-full-10.20.50.12-202007211514 does not exist
-- StackTrace --


All permissions are:


-rw-r--r-- 1 cassandra cassandra   47 Jul 15 17:30 ba-5-bti-CompressionInfo.db
-rw-r--r-- 1 cassandra cassandra  279 Jul 15 17:30 ba-5-bti-Data.db
-rw-r--r-- 1 cassandra cassandra    9 Jul 15 17:30 ba-5-bti-Digest.crc32
-rw-r--r-- 1 cassandra cassandra  176 Jul 15 17:30 ba-5-bti-Filter.db
-rw-r--r-- 1 cassandra cassandra   91 Jul 15 17:30 ba-5-bti-Partitions.db
-rw-r--r-- 1 cassandra cassandra    0 Jul 15 17:30 ba-5-bti-Rows.db


0 Likes 0 · ·

You were right the snapshot was root:root after I unzipped it.

Thank you!

0 Likes 0 · ·

@igor.rmarinho_185445, glad that worked!

0 Likes 0 · ·