I have two volumes attached to my AWS EC2 CentOS 7, primary
and secondary
. If I execute certain operations that require downloading and storing of data, how do I specify the storage path?
For eg., I would like to stream a Kafka data into a text file to be stored in the secondary volume. If I run the following command:
bin/kafka-console-consumer.sh --topic my_kafka_topic --from-beginning --bootstrap-server "my_dns:9092" | tee output.txt
the data stream is written into file output.txt
stored on the primary
volume automatically. How do I specify for it to store on the secondary
volume.
I can find the filesystem paths with df -h
, and this is what I see:
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.8G 0 3.8G 0% /dev/shm
tmpfs 3.8G 17M 3.8G 1% /run
tmpfs 3.8G 0 3.8G 0% /sys/fs/cgroup
/dev/nvme0n1p1 58G 20G 38G 35% /
/dev/nvme1n1 60G 33M 60G 1% /opt/data/datadir1
where /dev/nvme1n1
is the secondary
volume.
Thanks.
CodePudding user response:
stored on the primary volume automatically
No, it isn't. That just happens to be where you run the command. You can cd
to the other volume directory first, then the command will work as you want.
However, you should specify an absolute path for the file on the mounted volume rather than the relative-path of the current directory where you run the command.