From fdf54ae7e038d194d7807105dcb40f4021b864fa Mon Sep 17 00:00:00 2001 From: Felix Steghofer Date: Mon, 27 Nov 2017 17:39:20 +0100 Subject: [PATCH] updated redis import to add ttls --- src/redis_tools/compile.sh | 5 +++- src/redis_tools/configs/redis_local_t.conf | 28 ++++++++++++++++++++++ src/redis_tools/flush-all.sh | 2 +- src/redis_tools/list-10-keys.sh | 3 +++ src/redis_tools/list-all-keys.sh | 2 +- src/redis_tools/persist-redis.sh | 2 +- src/redis_tools/read-parallel.sh | 3 ++- 7 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 src/redis_tools/configs/redis_local_t.conf create mode 100755 src/redis_tools/list-10-keys.sh diff --git a/src/redis_tools/compile.sh b/src/redis_tools/compile.sh index c157e6d..30f08eb 100755 --- a/src/redis_tools/compile.sh +++ b/src/redis_tools/compile.sh @@ -9,7 +9,7 @@ # # Starting the required redis instances can be done via: # for i in /somedir/*_local_*.conf; do sudo -u someuser redis-server "$i"; done -# +# # Adjust somedir and someuser to your local setup # # ATTENTION: @@ -22,3 +22,6 @@ gcc r-4-felix.c -lhiredis -L~/src/hiredis -I~/src -o r-4-felix +# with gz +gcc r-4-felix.c -lhiredis -lz -o r-4-felix-gz + diff --git a/src/redis_tools/configs/redis_local_t.conf b/src/redis_tools/configs/redis_local_t.conf new file mode 100644 index 0000000..21ba0f0 --- /dev/null +++ b/src/redis_tools/configs/redis_local_t.conf @@ -0,0 +1,28 @@ +# Redis configuration file example +################################## INCLUDES ################################### + +include redis_local.conf + +# When running daemonized, Redis writes a pid file in /var/run/redis.pid by +# default. You can specify a custom pid file location here. +pidfile /home/felix/redis/redis/redis-server_t.pid + +# Accept connections on the specified port, default is 6379. +# If port 0 is specified Redis will not listen on a TCP socket. +port 2345 + +# Specify the path for the unix socket that will be used to listen for +# incoming connections. There is no default, so Redis will not listen +# on a unix socket when not specified. +# yields better performance than loopback +unixsocket /home/felix/redis/redis/redis_local_t.sock +unixsocketperm 755 + +# Specify the log file name. Also the empty string can be used to force +# Redis to log on the standard output. Note that if you use standard +# output for logging but daemonize, logs will be sent to /dev/null +logfile /home/felix/redis/redis/redis-server_t.log + +# The filename where to dump the DB +dbfilename dump_t.rdb + diff --git a/src/redis_tools/flush-all.sh b/src/redis_tools/flush-all.sh index 693e433..2a9d13c 100755 --- a/src/redis_tools/flush-all.sh +++ b/src/redis_tools/flush-all.sh @@ -4,5 +4,5 @@ read -p "Really delete all redis data? " -n 1 -r echo if [[ $REPLY =~ ^[Yy]$ ]] then - for i in `seq 2337 2344`; do redis-cli -p "$i" flushall; done + for i in `seq 2337 2345`; do redis-cli -p "$i" flushall; done fi diff --git a/src/redis_tools/list-10-keys.sh b/src/redis_tools/list-10-keys.sh new file mode 100755 index 0000000..2a39d62 --- /dev/null +++ b/src/redis_tools/list-10-keys.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +for i in `seq 2337 2344`; do echo "redis instance $i"; redis-cli -p "$i" scan 0 count 100 match \*; done diff --git a/src/redis_tools/list-all-keys.sh b/src/redis_tools/list-all-keys.sh index 7abbd7a..50d201d 100755 --- a/src/redis_tools/list-all-keys.sh +++ b/src/redis_tools/list-all-keys.sh @@ -1,3 +1,3 @@ #!/bin/bash -for i in `seq 2337 2344`; do redis-cli -p "$i" keys \*; done +for i in `seq 2337 2345`; do redis-cli -p "$i" keys \*; done diff --git a/src/redis_tools/persist-redis.sh b/src/redis_tools/persist-redis.sh index 127b6e5..7df8a64 100755 --- a/src/redis_tools/persist-redis.sh +++ b/src/redis_tools/persist-redis.sh @@ -1,3 +1,3 @@ #!/bin/bash -for i in `seq 2337 2344`; do redis-cli -p "$i" bgsave & sleep 4m; done +for i in `seq 2337 2345`; do redis-cli -p "$i" bgsave & sleep 4m; done diff --git a/src/redis_tools/read-parallel.sh b/src/redis_tools/read-parallel.sh index 510408a..4de763f 100755 --- a/src/redis_tools/read-parallel.sh +++ b/src/redis_tools/read-parallel.sh @@ -1,4 +1,5 @@ #!/bin/bash -find /run/media/felix/disk/pDNS -iname 'pdns_capture.pcap-*-2017-09-0[1-7]*.csv' | sort -t- -k3 | xargs -P10 -n1 ./r-4-felix +#find /run/media/felix/disk/pDNS -iname 'pdns_capture.pcap-*-2017-09-0[1-7]*.csv.gz' | sort -t- -k3 | xargs -P10 -n1 ./r-4-felix +find /home/felix/pdns -iname 'pdns_capture.pcap-*-2017-09-0[1-7]*.csv.gz' | sort -t- -k3 | xargs -P10 -n1 ./r-4-felix-gz