Using redis-cli I connected to specific server:
redis-cli -h 10.1.xx.xx
And select 1
Then just to get list of one key features:
KEYS data_column*
THis will print list of that column values on command line. However, there are like quite many values, I want to save query output to file.
In general, using > file_name
after the command works. But in this case, it does not work, as its on redis server, though from command line. How to save such query result?
Within Redis, there are two different ways of persisting data to disk. One is a method called snapshotting that takes the data as it exists at one moment in time and writes it to disk. The other method is called AOF, or append—only file, and it works by copying incoming write commands to disk as they happen.
The SAVE commands performs a synchronous save of the dataset producing a point in time snapshot of all the data inside the Redis instance, in the form of an RDB file. You almost never want to call SAVE in production environments where it will block all the other clients. Instead usually BGSAVE is used.
rdb file in the /var/lib/redis/ directory. You'll want to update the permissions so the file is owned by the redis user and group: sudo chown redis:redis /var/lib/redis/dump.
Simply use:
./redis-cli -h 10.1.xx.xx -n 1 keys 'data_column*' >file.txt
echo "keys data_column*" | redis-cli -h 10.1.xx.xx -p xx > file.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With