nuvo / cain

Backup and restore tool for Cassandra on Kubernetes
Apache License 2.0
32 stars 21 forks source link

Setting cain exec user #8

Closed alexbarta closed 5 years ago

alexbarta commented 5 years ago

Hi Maor,

I have noticed that cain is using root user in cassandra container to restore the data:

root@cassandra-0:/# ls -l /var/lib/cassandra/data/keyspace1/standard1-6f0c08800bb011e9b9b59b0b7cda5ee3/
total 241944
drwxr-xr-x 2 cassandra cassandra         6 Dec 29 21:26 backups
-rw-r--r-- 1 root      root             50 Dec 29 21:26 manifest.json
-rw-r--r-- 1 root      root           2332 Dec 29 21:26 mc-1-big-CRC.db
-rw-r--r-- 1 root      root       38133625 Dec 29 21:26 mc-1-big-Data.db
-rw-r--r-- 1 root      root              9 Dec 29 21:26 mc-1-big-Digest.crc32
-rw-r--r-- 1 root      root         209400 Dec 29 21:26 mc-1-big-Filter.db
-rw-r--r-- 1 root      root        2838316 Dec 29 21:26 mc-1-big-Index.db
-rw-r--r-- 1 cassandra cassandra     10287 Dec 29 21:27 mc-1-big-Statistics.db
-rw-r--r-- 1 root      root          28850 Dec 29 21:26 mc-1-big-Summary.db
-rw-r--r-- 1 root      root             80 Dec 29 21:26 mc-1-big-TOC.txt
-rw-r--r-- 1 root      root          11676 Dec 29 21:26 mc-2-big-CRC.db
-rw-r--r-- 1 root      root      191139110 Dec 29 21:26 mc-2-big-Data.db
-rw-r--r-- 1 root      root             10 Dec 29 21:26 mc-2-big-Digest.crc32
-rw-r--r-- 1 root      root        1038552 Dec 29 21:26 mc-2-big-Filter.db
-rw-r--r-- 1 root      root       14143190 Dec 29 21:26 mc-2-big-Index.db
-rw-r--r-- 1 cassandra cassandra     10287 Dec 29 21:27 mc-2-big-Statistics.db
-rw-r--r-- 1 root      root         143140 Dec 29 21:26 mc-2-big-Summary.db
-rw-r--r-- 1 root      root             80 Dec 29 21:26 mc-2-big-TOC.txt
-rw-r--r-- 1 root      root            837 Dec 29 21:26 schema.cql
drwxr-xr-x 5 cassandra cassandra       129 Dec 29 21:26 snapshots

For obvious reasons, the ownership of restored files should be assigned cassandra:cassandra. Is there a way to specify a specific user for the file copy?

maorfr commented 5 years ago

Hey,

good catch! I remember wanting to do this ;) Can you test it with version 0.4.2?

thanks!

alexbarta commented 5 years ago

The usergroup arg fixed the bug. Thanks

maorfr commented 5 years ago

Fixed in version 0.4.2 using --user-group.