diff --git a/utils/build-static-symbols.tcl b/utils/build-static-symbols.tcl deleted file mode 100644 index d97f2d2ec..000000000 --- a/utils/build-static-symbols.tcl +++ /dev/null @@ -1,23 +0,0 @@ -# Copyright(C) 2009 Salvatore Sanfilippo, under the BSD license. -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -set fd [open redis.c] -set symlist {} -while {[gets $fd line] != -1} { - if {[regexp {^static +[A-z0-9]+[ *]+([A-z0-9]*)\(} $line - sym]} { - lappend symlist $sym - } -} -set symlist [lsort -unique $symlist] -puts "static struct redisFunctionSym symsTable\[\] = {" -foreach sym $symlist { - puts "{\"$sym\",(unsigned long)$sym}," -} -puts "{NULL,0}" -puts "};" - -close $fd diff --git a/utils/cluster_fail_time.tcl b/utils/cluster_fail_time.tcl index b69b52ea8..46b3686d5 100644 --- a/utils/cluster_fail_time.tcl +++ b/utils/cluster_fail_time.tcl @@ -21,11 +21,11 @@ proc avg vector { set samples {} while 1 { - exec redis-cli -p $::fail_port debug sleep $::sleep_time > /dev/null & + exec redict-cli -p $::fail_port debug sleep $::sleep_time > /dev/null & # Wait for fail? to appear. while 1 { - set output [exec redis-cli -p $::other_port cluster nodes] + set output [exec redict-cli -p $::other_port cluster nodes] if {[string match {*fail\?*} $output]} break after 100 } @@ -35,7 +35,7 @@ while 1 { # Wait for fail? to disappear. while 1 { - set output [exec redis-cli -p $::other_port cluster nodes] + set output [exec redict-cli -p $::other_port cluster nodes] if {![string match {*fail\?*} $output]} break after 100 } @@ -49,7 +49,7 @@ while 1 { puts "AVG([llength $samples]): [avg $samples]" # Wait for the instance to be available again. - exec redis-cli -p $::fail_port ping + exec redict-cli -p $::fail_port ping # Wait for the fail flag to be cleared. after 2000 diff --git a/utils/create-cluster/.gitignore b/utils/create-cluster/.gitignore deleted file mode 100644 index a34b639a1..000000000 --- a/utils/create-cluster/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -config.sh -*.rdb -*.aof -*.conf -*.log -appendonlydir-* diff --git a/utils/create-cluster/README b/utils/create-cluster/README deleted file mode 100644 index bcd745977..000000000 --- a/utils/create-cluster/README +++ /dev/null @@ -1,27 +0,0 @@ -create-cluster is a small script used to easily start a big number of Redis -instances configured to run in cluster mode. Its main goal is to allow manual -testing in a condition which is not easy to replicate with the Redis cluster -unit tests, for example when a lot of instances are needed in order to trigger -a given bug. - -The tool can also be used just to easily create a number of instances in a -Redis Cluster in order to experiment a bit with the system. - -USAGE ---- - -To create a cluster, follow these steps: - -1. Edit create-cluster and change the start / end port, depending on the -number of instances you want to create. -2. Use "./create-cluster start" in order to run the instances. -3. Use "./create-cluster create" in order to execute redis-cli --cluster create, so that -an actual Redis cluster will be created. (If you're accessing your setup via a local container, ensure that the CLUSTER_HOST value is changed to your local IP) -4. Now you are ready to play with the cluster. AOF files and logs for each instances are created in the current directory. - -In order to stop a cluster: - -1. Use "./create-cluster stop" to stop all the instances. After you stopped the instances you can use "./create-cluster start" to restart them if you change your mind. -2. Use "./create-cluster clean" to remove all the AOF / log files to restart with a clean environment. - -Use the command "./create-cluster help" to get the full list of features. diff --git a/utils/create-cluster/create-cluster b/utils/create-cluster/create-cluster deleted file mode 100755 index e9e1cc2e8..000000000 --- a/utils/create-cluster/create-cluster +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash -# -# SPDX-FileCopyrightText: 2024 Redict Contributors -# -# SPDX-License-Identifier: LGPL-3.0-only - -SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" - -# Settings -BIN_PATH="$SCRIPT_DIR/../../src/" -CLUSTER_HOST=127.0.0.1 -PORT=30000 -TIMEOUT=2000 -NODES=6 -REPLICAS=1 -PROTECTED_MODE=yes -ADDITIONAL_OPTIONS="" - -# You may want to put the above config parameters into config.sh in order to -# override the defaults without modifying this script. - -if [ -a config.sh ] -then - source "config.sh" -fi - -# Computed vars -ENDPORT=$((PORT+NODES)) - -if [ "$1" == "start" ] -then - while [ $((PORT < ENDPORT)) != "0" ]; do - PORT=$((PORT+1)) - echo "Starting $PORT" - $BIN_PATH/redis-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --appenddirname appendonlydir-${PORT} --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} - done - exit 0 -fi - -if [ "$1" == "create" ] -then - HOSTS="" - while [ $((PORT < ENDPORT)) != "0" ]; do - PORT=$((PORT+1)) - HOSTS="$HOSTS $CLUSTER_HOST:$PORT" - done - OPT_ARG="" - if [ "$2" == "-f" ]; then - OPT_ARG="--cluster-yes" - fi - $BIN_PATH/redis-cli --cluster create $HOSTS --cluster-replicas $REPLICAS $OPT_ARG - exit 0 -fi - -if [ "$1" == "stop" ] -then - while [ $((PORT < ENDPORT)) != "0" ]; do - PORT=$((PORT+1)) - echo "Stopping $PORT" - $BIN_PATH/redis-cli -p $PORT shutdown nosave - done - exit 0 -fi - -if [ "$1" == "restart" ] -then - OLD_PORT=$PORT - while [ $((PORT < ENDPORT)) != "0" ]; do - PORT=$((PORT+1)) - echo "Stopping $PORT" - $BIN_PATH/redis-cli -p $PORT shutdown nosave - done - PORT=$OLD_PORT - while [ $((PORT < ENDPORT)) != "0" ]; do - PORT=$((PORT+1)) - echo "Starting $PORT" - $BIN_PATH/redis-server --port $PORT --protected-mode $PROTECTED_MODE --cluster-enabled yes --cluster-config-file nodes-${PORT}.conf --cluster-node-timeout $TIMEOUT --appendonly yes --appendfilename appendonly-${PORT}.aof --appenddirname appendonlydir-${PORT} --dbfilename dump-${PORT}.rdb --logfile ${PORT}.log --daemonize yes ${ADDITIONAL_OPTIONS} - done - exit 0 -fi - -if [ "$1" == "watch" ] -then - PORT=$((PORT+1)) - while [ 1 ]; do - clear - date - $BIN_PATH/redis-cli -p $PORT cluster nodes | head -30 - sleep 1 - done - exit 0 -fi - -if [ "$1" == "tail" ] -then - INSTANCE=$2 - PORT=$((PORT+INSTANCE)) - tail -f ${PORT}.log - exit 0 -fi - -if [ "$1" == "tailall" ] -then - tail -f *.log - exit 0 -fi - -if [ "$1" == "call" ] -then - while [ $((PORT < ENDPORT)) != "0" ]; do - PORT=$((PORT+1)) - $BIN_PATH/redis-cli -p $PORT $2 $3 $4 $5 $6 $7 $8 $9 - done - exit 0 -fi - -if [ "$1" == "clean" ] -then - echo "Cleaning *.log" - rm -rf *.log - echo "Cleaning appendonlydir-*" - rm -rf appendonlydir-* - echo "Cleaning dump-*.rdb" - rm -rf dump-*.rdb - echo "Cleaning nodes-*.conf" - rm -rf nodes-*.conf - exit 0 -fi - -if [ "$1" == "clean-logs" ] -then - echo "Cleaning *.log" - rm -rf *.log - exit 0 -fi - -echo "Usage: $0 [start|create|stop|restart|watch|tail|tailall|clean|clean-logs|call]" -echo "start -- Launch Redis Cluster instances." -echo "create [-f] -- Create a cluster using redis-cli --cluster create." -echo "stop -- Stop Redis Cluster instances." -echo "restart -- Restart Redis Cluster instances." -echo "watch -- Show CLUSTER NODES output (first 30 lines) of first node." -echo "tail -- Run tail -f of instance at base port + ID." -echo "tailall -- Run tail -f for all the log files at once." -echo "clean -- Remove all instances data, logs, configs." -echo "clean-logs -- Remove just instances logs." -echo "call -- Call a command (up to 7 arguments) on all nodes." diff --git a/utils/generate-module-api-doc.rb b/utils/generate-module-api-doc.rb index 6d3992b41..aef8245d2 100755 --- a/utils/generate-module-api-doc.rb +++ b/utils/generate-module-api-doc.rb @@ -20,13 +20,13 @@ def markdown(s) newlines = [] # Fix some markdown lines.each{|l| - # Rewrite RM_Xyz() to RedisModule_Xyz(). - l = l.gsub(/(?\n" -puts " Reference for the Redis Modules API\n" +puts " Reference for the Redict Modules API\n" puts "aliases:\n" puts " - /topics/modules-api-ref\n" puts "---\n" @@ -163,7 +163,7 @@ $index = {} src.each_with_index do |line,i| if is_func_line(src, i) line =~ /RM_([A-z0-9]+)/ - name = "RedisModule_#{$1}" + name = "RedictModule_#{$1}" $index[name] = true end end @@ -177,7 +177,7 @@ if File.directory?(git_dir) && `which git` != "" version.chomp! `git --git-dir="#{git_dir}" cat-file blob "#{version}:src/module.c"`.each_line do |line| if line =~ /^\w.*[ \*]RM_([A-z0-9]+)/ - name = "RedisModule_#{$1}" + name = "RedictModule_#{$1}" if ! $since[name] $since[name] = version end diff --git a/utils/install_server.sh b/utils/install_server.sh deleted file mode 100755 index 7b0d7e727..000000000 --- a/utils/install_server.sh +++ /dev/null @@ -1,252 +0,0 @@ -#!/bin/sh - -# Copyright 2011 Dvir Volk . All rights reserved. -# SPDX-FileCopyrightText: 2011 Dvir Volk -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-2-Clause -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -die () { - echo "ERROR: $1. Aborting!" - exit 1 -} - - -#Absolute path to this script -SCRIPT=$(readlink -f $0) -#Absolute path this script is in -SCRIPTPATH=$(dirname $SCRIPT) - -#Initial defaults -_REDIS_PORT=6379 -_MANUAL_EXECUTION=false - -echo "Welcome to the redis service installer" -echo "This script will help you easily set up a running redis server" -echo - -#check for root user -if [ "$(id -u)" -ne 0 ] ; then - echo "You must run this script as root. Sorry!" - exit 1 -fi - -#bail if this system is managed by systemd -_pid_1_exe="$(readlink -f /proc/1/exe)" -if [ "${_pid_1_exe##*/}" = systemd ] -then - echo "This systems seems to use systemd." - echo "Please take a look at the provided example service unit files in this directory, and adapt and install them. Sorry!" - exit 1 -fi -unset _pid_1_exe - -if ! echo $REDIS_PORT | egrep -q '^[0-9]+$' ; then - _MANUAL_EXECUTION=true - #Read the redis port - read -p "Please select the redis port for this instance: [$_REDIS_PORT] " REDIS_PORT - if ! echo $REDIS_PORT | egrep -q '^[0-9]+$' ; then - echo "Selecting default: $_REDIS_PORT" - REDIS_PORT=$_REDIS_PORT - fi -fi - -if [ -z "$REDIS_CONFIG_FILE" ] ; then - _MANUAL_EXECUTION=true - #read the redis config file - _REDIS_CONFIG_FILE="/etc/redis/$REDIS_PORT.conf" - read -p "Please select the redis config file name [$_REDIS_CONFIG_FILE] " REDIS_CONFIG_FILE - if [ -z "$REDIS_CONFIG_FILE" ] ; then - REDIS_CONFIG_FILE=$_REDIS_CONFIG_FILE - echo "Selected default - $REDIS_CONFIG_FILE" - fi -fi - -if [ -z "$REDIS_LOG_FILE" ] ; then - _MANUAL_EXECUTION=true - #read the redis log file path - _REDIS_LOG_FILE="/var/log/redis_$REDIS_PORT.log" - read -p "Please select the redis log file name [$_REDIS_LOG_FILE] " REDIS_LOG_FILE - if [ -z "$REDIS_LOG_FILE" ] ; then - REDIS_LOG_FILE=$_REDIS_LOG_FILE - echo "Selected default - $REDIS_LOG_FILE" - fi -fi - -if [ -z "$REDIS_DATA_DIR" ] ; then - _MANUAL_EXECUTION=true - #get the redis data directory - _REDIS_DATA_DIR="/var/lib/redis/$REDIS_PORT" - read -p "Please select the data directory for this instance [$_REDIS_DATA_DIR] " REDIS_DATA_DIR - if [ -z "$REDIS_DATA_DIR" ] ; then - REDIS_DATA_DIR=$_REDIS_DATA_DIR - echo "Selected default - $REDIS_DATA_DIR" - fi -fi - -if [ ! -x "$REDIS_EXECUTABLE" ] ; then - _MANUAL_EXECUTION=true - #get the redis executable path - _REDIS_EXECUTABLE=`command -v redis-server` - read -p "Please select the redis executable path [$_REDIS_EXECUTABLE] " REDIS_EXECUTABLE - if [ ! -x "$REDIS_EXECUTABLE" ] ; then - REDIS_EXECUTABLE=$_REDIS_EXECUTABLE - - if [ ! -x "$REDIS_EXECUTABLE" ] ; then - echo "Mmmmm... it seems like you don't have a redis executable. Did you run make install yet?" - exit 1 - fi - fi -fi - -#check the default for redis cli -CLI_EXEC=`command -v redis-cli` -if [ -z "$CLI_EXEC" ] ; then - CLI_EXEC=`dirname $REDIS_EXECUTABLE`"/redis-cli" -fi - -echo "Selected config:" - -echo "Port : $REDIS_PORT" -echo "Config file : $REDIS_CONFIG_FILE" -echo "Log file : $REDIS_LOG_FILE" -echo "Data dir : $REDIS_DATA_DIR" -echo "Executable : $REDIS_EXECUTABLE" -echo "Cli Executable : $CLI_EXEC" - -if $_MANUAL_EXECUTION == true ; then - read -p "Is this ok? Then press ENTER to go on or Ctrl-C to abort." _UNUSED_ -fi - -mkdir -p `dirname "$REDIS_CONFIG_FILE"` || die "Could not create redis config directory" -mkdir -p `dirname "$REDIS_LOG_FILE"` || die "Could not create redis log dir" -mkdir -p "$REDIS_DATA_DIR" || die "Could not create redis data directory" - -#render the templates -TMP_FILE="/tmp/${REDIS_PORT}.conf" -DEFAULT_CONFIG="${SCRIPTPATH}/../redis.conf" -INIT_TPL_FILE="${SCRIPTPATH}/redis_init_script.tpl" -INIT_SCRIPT_DEST="/etc/init.d/redis_${REDIS_PORT}" -PIDFILE="/var/run/redis_${REDIS_PORT}.pid" - -if [ ! -f "$DEFAULT_CONFIG" ]; then - echo "Mmmmm... the default config is missing. Did you switch to the utils directory?" - exit 1 -fi - -#Generate config file from the default config file as template -#changing only the stuff we're controlling from this script -echo "## Generated by install_server.sh ##" > $TMP_FILE - -read -r SED_EXPR <<-EOF -s#^port .\+#port ${REDIS_PORT}#; \ -s#^logfile .\+#logfile ${REDIS_LOG_FILE}#; \ -s#^dir .\+#dir ${REDIS_DATA_DIR}#; \ -s#^pidfile .\+#pidfile ${PIDFILE}#; \ -s#^daemonize no#daemonize yes#; -EOF -sed "$SED_EXPR" $DEFAULT_CONFIG >> $TMP_FILE - -#cat $TPL_FILE | while read line; do eval "echo \"$line\"" >> $TMP_FILE; done -cp $TMP_FILE $REDIS_CONFIG_FILE || die "Could not write redis config file $REDIS_CONFIG_FILE" - -#Generate sample script from template file -rm -f $TMP_FILE - -#we hard code the configs here to avoid issues with templates containing env vars -#kinda lame but works! -REDIS_INIT_HEADER=\ -"#!/bin/sh\n -#Configurations injected by install_server below....\n\n -EXEC=$REDIS_EXECUTABLE\n -CLIEXEC=$CLI_EXEC\n -PIDFILE=\"$PIDFILE\"\n -CONF=\"$REDIS_CONFIG_FILE\"\n\n -REDISPORT=\"$REDIS_PORT\"\n\n -###############\n\n" - -REDIS_CHKCONFIG_INFO=\ -"# REDHAT chkconfig header\n\n -# chkconfig: - 58 74\n -# description: redis_${REDIS_PORT} is the redis daemon.\n -### BEGIN INIT INFO\n -# Provides: redis_6379\n -# Required-Start: \$network \$local_fs \$remote_fs\n -# Required-Stop: \$network \$local_fs \$remote_fs\n -# Default-Start: 2 3 4 5\n -# Default-Stop: 0 1 6\n -# Should-Start: \$syslog \$named\n -# Should-Stop: \$syslog \$named\n -# Short-Description: start and stop redis_${REDIS_PORT}\n -# Description: Redis daemon\n -### END INIT INFO\n\n" - -if command -v chkconfig >/dev/null; then - #if we're a box with chkconfig on it we want to include info for chkconfig - echo "$REDIS_INIT_HEADER" "$REDIS_CHKCONFIG_INFO" > $TMP_FILE && cat $INIT_TPL_FILE >> $TMP_FILE || die "Could not write init script to $TMP_FILE" -else - #combine the header and the template (which is actually a static footer) - echo "$REDIS_INIT_HEADER" > $TMP_FILE && cat $INIT_TPL_FILE >> $TMP_FILE || die "Could not write init script to $TMP_FILE" -fi - -### -# Generate sample script from template file -# - No need to check which system we are on. The init info are comments and -# do not interfere with update_rc.d systems. Additionally: -# Ubuntu/debian by default does not come with chkconfig, but does issue a -# warning if init info is not available. - -cat > ${TMP_FILE} <> ${TMP_FILE} - -#copy to /etc/init.d -cp $TMP_FILE $INIT_SCRIPT_DEST && \ - chmod +x $INIT_SCRIPT_DEST || die "Could not copy redis init script to $INIT_SCRIPT_DEST" -echo "Copied $TMP_FILE => $INIT_SCRIPT_DEST" - -#Install the service -echo "Installing service..." -if command -v chkconfig >/dev/null 2>&1; then - # we're chkconfig, so lets add to chkconfig and put in runlevel 345 - chkconfig --add redis_${REDIS_PORT} && echo "Successfully added to chkconfig!" - chkconfig --level 345 redis_${REDIS_PORT} on && echo "Successfully added to runlevels 345!" -elif command -v update-rc.d >/dev/null 2>&1; then - #if we're not a chkconfig box assume we're able to use update-rc.d - update-rc.d redis_${REDIS_PORT} defaults && echo "Success!" -else - echo "No supported init tool found." -fi - -/etc/init.d/redis_$REDIS_PORT start || die "Failed starting service..." - -#tada -echo "Installation successful!" -exit 0 diff --git a/utils/lru/README b/utils/lru/README index f043b2979..ab367aa6c 100644 --- a/utils/lru/README +++ b/utils/lru/README @@ -1,9 +1,9 @@ The test-lru.rb program can be used in order to check the behavior of the -Redis approximated LRU algorithm against the theoretical output of true +Redict approximated LRU algorithm against the theoretical output of true LRU algorithm. -In order to use the program you need to recompile Redis setting the define -REDIS_LRU_CLOCK_RESOLUTION to 1, by editing the file server.h. +In order to use the program you need to recompile Redict setting the define +REDICT_LRU_CLOCK_RESOLUTION to 1, by editing the file server.h. This allows to execute the program in a fast way since the 1 ms resolution is enough for all the objects to have a different enough time stamp during the test. diff --git a/utils/lru/lfu-simulation.c b/utils/lru/lfu-simulation.c index 2dffbef5f..2be3db562 100644 --- a/utils/lru/lfu-simulation.c +++ b/utils/lru/lfu-simulation.c @@ -14,7 +14,7 @@ int keyspace_size = 1000000; time_t switch_after = 30; /* Switch access pattern after N seconds. */ struct entry { - /* Field that the LFU Redis implementation will have (we have + /* Field that the LFU Redict implementation will have (we have * 24 bits of total space in the object->lru field). */ uint8_t counter; /* Logarithmic counter. */ uint16_t decrtime; /* (Reduced precision) time of last decrement. */ diff --git a/utils/redis_init_script b/utils/redict_init_script similarity index 60% rename from utils/redis_init_script rename to utils/redict_init_script index 0eb0e1c43..a6a61e41f 100755 --- a/utils/redis_init_script +++ b/utils/redict_init_script @@ -4,23 +4,23 @@ # # SPDX-License-Identifier: LGPL-3.0-only # -# Simple Redis init.d script conceived to work on Linux systems +# Simple Redict init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. ### BEGIN INIT INFO -# Provides: redis_6379 +# Provides: redict_6379 # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 -# Short-Description: Redis data structure server -# Description: Redis data structure server. See https://redis.io +# Short-Description: Redict data structure server +# Description: Redict data structure server. See https://redict.io ### END INIT INFO -REDISPORT=6379 -EXEC=/usr/local/bin/redis-server -CLIEXEC=/usr/local/bin/redis-cli +REDICTPORT=6379 +EXEC=/usr/local/bin/redict-server +CLIEXEC=/usr/local/bin/redict-cli -PIDFILE=/var/run/redis_${REDISPORT}.pid -CONF="/etc/redis/${REDISPORT}.conf" +PIDFILE=/var/run/redict_${REDICTPORT}.pid +CONF="/etc/redict/${REDICTPORT}.conf" case "$1" in start) @@ -28,7 +28,7 @@ case "$1" in then echo "$PIDFILE exists, process is already running or crashed" else - echo "Starting Redis server..." + echo "Starting Redict server..." $EXEC $CONF fi ;; @@ -39,13 +39,13 @@ case "$1" in else PID=$(cat $PIDFILE) echo "Stopping ..." - $CLIEXEC -p $REDISPORT shutdown + $CLIEXEC -p $REDICTPORT shutdown while [ -x /proc/${PID} ] do - echo "Waiting for Redis to shutdown ..." + echo "Waiting for Redict to shutdown ..." sleep 1 done - echo "Redis stopped" + echo "Redict stopped" fi ;; *) diff --git a/utils/redis-copy.rb b/utils/redis-copy.rb deleted file mode 100644 index 9b3aea50a..000000000 --- a/utils/redis-copy.rb +++ /dev/null @@ -1,34 +0,0 @@ -# Copyright (C) 2009-2010 Salvatore Sanfilippo -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -require 'shellwords' - -def redisCopy(opts={}) - src = "#{opts[:srchost]}:#{opts[:srcport]}" - dst = "#{opts[:dsthost]}:#{opts[:dstport]}" - `redis-copy #{src.shellescape} #{dst.shellescape}` -rescue Errno::ENOENT - $stderr.puts 'This utility requires the redis-copy executable', - 'from the redis-copy gem on https://rubygems.org', - 'To install it, run `gem install redis-copy`.' - exit 1 -end - -$stderr.puts "This utility is deprecated. Use the redis-copy gem instead." -if ARGV.length != 4 - puts "Usage: redis-copy.rb " - exit 1 -end -puts "WARNING: it's up to you to FLUSHDB the destination host before to continue, press any key when ready." -STDIN.gets -srchost = ARGV[0] -srcport = ARGV[1] -dsthost = ARGV[2] -dstport = ARGV[3] -puts "Copying #{srchost}:#{srcport} into #{dsthost}:#{dstport}" -redisCopy(:srchost => srchost, :srcport => srcport.to_i, - :dsthost => dsthost, :dstport => dstport.to_i) diff --git a/utils/redis-sha1.rb b/utils/redis-sha1.rb deleted file mode 100644 index 4a67a48e0..000000000 --- a/utils/redis-sha1.rb +++ /dev/null @@ -1,49 +0,0 @@ -# Copyright (C) 2009 Salvatore Sanfilippo -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -require 'rubygems' -require 'redis' -require 'digest/sha1' - -def redisSha1(opts={}) - sha1="" - r = Redis.new(opts) - r.keys('*').sort.each{|k| - vtype = r.type?(k) - if vtype == "string" - len = 1 - sha1 = Digest::SHA1.hexdigest(sha1+k) - sha1 = Digest::SHA1.hexdigest(sha1+r.get(k)) - elsif vtype == "list" - len = r.llen(k) - if len != 0 - sha1 = Digest::SHA1.hexdigest(sha1+k) - sha1 = Digest::SHA1.hexdigest(sha1+r.list_range(k,0,-1).join("\x01")) - end - elsif vtype == "set" - len = r.scard(k) - if len != 0 - sha1 = Digest::SHA1.hexdigest(sha1+k) - sha1 = Digest::SHA1.hexdigest(sha1+r.set_members(k).to_a.sort.join("\x02")) - end - elsif vtype == "zset" - len = r.zcard(k) - if len != 0 - sha1 = Digest::SHA1.hexdigest(sha1+k) - sha1 = Digest::SHA1.hexdigest(sha1+r.zrange(k,0,-1).join("\x01")) - end - end - # puts "#{k} => #{sha1}" if len != 0 - } - sha1 -end - -host = ARGV[0] || "127.0.0.1" -port = ARGV[1] || "6379" -db = ARGV[2] || "0" -puts "Performing SHA1 of Redis server #{host} #{port} DB: #{db}" -p "Dataset SHA1: #{redisSha1(:host => host, :port => port.to_i, :db => db)}" diff --git a/utils/redis_init_script.tpl b/utils/redis_init_script.tpl deleted file mode 100755 index c2ccd8b9b..000000000 --- a/utils/redis_init_script.tpl +++ /dev/null @@ -1,48 +0,0 @@ -# -# SPDX-FileCopyrightText: 2024 Redict Contributors -# -# SPDX-License-Identifier: LGPL-3.0-only - -case "$1" in - start) - if [ -f $PIDFILE ] - then - echo "$PIDFILE exists, process is already running or crashed" - else - echo "Starting Redis server..." - $EXEC $CONF - fi - ;; - stop) - if [ ! -f $PIDFILE ] - then - echo "$PIDFILE does not exist, process is not running" - else - PID=$(cat $PIDFILE) - echo "Stopping ..." - $CLIEXEC -p $REDISPORT shutdown - while [ -x /proc/${PID} ] - do - echo "Waiting for Redis to shutdown ..." - sleep 1 - done - echo "Redis stopped" - fi - ;; - status) - PID=$(cat $PIDFILE) - if [ ! -x /proc/${PID} ] - then - echo 'Redis is not running' - else - echo "Redis is running ($PID)" - fi - ;; - restart) - $0 stop - $0 start - ;; - *) - echo "Please use start, stop, restart or status as first argument" - ;; -esac diff --git a/utils/releasetools/01_create_tarball.sh b/utils/releasetools/01_create_tarball.sh deleted file mode 100755 index 4cdd6c60e..000000000 --- a/utils/releasetools/01_create_tarball.sh +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/sh - -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -if [ $# != "1" ] -then - echo "Usage: ./utils/releasetools/01_create_tarball.sh " - exit 1 -fi - -TAG=$1 -TARNAME="redis-${TAG}.tar" -echo "Generating /tmp/${TARNAME}" -git archive $TAG --prefix redis-${TAG}/ > /tmp/$TARNAME || exit 1 -echo "Gizipping the archive" -rm -f /tmp/$TARNAME.gz -gzip -9 /tmp/$TARNAME diff --git a/utils/releasetools/02_upload_tarball.sh b/utils/releasetools/02_upload_tarball.sh deleted file mode 100755 index c7f60edb9..000000000 --- a/utils/releasetools/02_upload_tarball.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -if [ $# != "1" ] -then - echo "Usage: ./utils/releasetools/02_upload_tarball.sh " - exit 1 -fi - -echo "Uploading..." -scp /tmp/redis-${1}.tar.gz ubuntu@host.redis.io:/var/www/download/releases/ -echo "Updating web site... " -echo "Please check the github action tests for the release." -echo "Press any key if it is a stable release, or Ctrl+C to abort" -read x -ssh ubuntu@host.redis.io "cd /var/www/download; - rm -rf redis-${1}.tar.gz; - wget http://download.redis.io/releases/redis-${1}.tar.gz; - tar xvzf redis-${1}.tar.gz; - rm -rf redis-stable; - mv redis-${1} redis-stable; - tar cvzf redis-stable.tar.gz redis-stable; - rm -rf redis-${1}.tar.gz; - shasum -a 256 redis-stable.tar.gz > redis-stable.tar.gz.SHA256SUM; - " diff --git a/utils/releasetools/03_test_release.sh b/utils/releasetools/03_test_release.sh deleted file mode 100755 index 36e7fdd6c..000000000 --- a/utils/releasetools/03_test_release.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/sh - -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -set -e -if [ $# != "1" ] -then - echo "Usage: ./utils/releasetools/03_test_release.sh " - exit 1 -fi - -TAG=$1 -TARNAME="redis-${TAG}.tar.gz" -DOWNLOADURL="http://download.redis.io/releases/${TARNAME}" - -echo "Doing sanity test on the actual tarball" - -cd /tmp -rm -rf test_release_tmp_dir -mkdir test_release_tmp_dir -cd test_release_tmp_dir -rm -f $TARNAME -rm -rf redis-${TAG} -wget $DOWNLOADURL -tar xvzf $TARNAME -cd redis-${TAG} -make -./runtest -./runtest-sentinel -./runtest-cluster -./runtest-moduleapi diff --git a/utils/releasetools/04_release_hash.sh b/utils/releasetools/04_release_hash.sh deleted file mode 100755 index d3b14109c..000000000 --- a/utils/releasetools/04_release_hash.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -if [ $# != "1" ] -then - echo "Usage: ./utils/releasetools/04_release_hash.sh " - exit 1 -fi - -SHA=$(curl -s http://download.redis.io/releases/redis-${1}.tar.gz | shasum -a 256 | cut -f 1 -d' ') -ENTRY="hash redis-${1}.tar.gz sha256 $SHA http://download.redis.io/releases/redis-${1}.tar.gz" -echo $ENTRY >> ../redis-hashes/README -echo "Press any key to commit, Ctrl-C to abort)." -read yes -(cd ../redis-hashes; git commit -a -m "${1} hash."; git push) diff --git a/utils/releasetools/changelog.tcl b/utils/releasetools/changelog.tcl deleted file mode 100755 index 0d67e591f..000000000 --- a/utils/releasetools/changelog.tcl +++ /dev/null @@ -1,41 +0,0 @@ -#!/usr/bin/env tclsh - -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -if {[llength $::argv] != 2 && [llength $::argv] != 3} { - puts "Usage: $::argv0 \[\]" - exit 1 -} - -set branch [lindex $::argv 0] -set ver [lindex $::argv 1] -if {[llength $::argv] == 3} { - set count [lindex ::$argv 2] -} else { - set count 100 -} - -set template { -================================================================================ -Redis %ver% Released %date% -================================================================================ - -Upgrade urgency : -} - -set template [string trim $template] -append template "\n\n" -set date [clock format [clock seconds]] -set template [string map [list %ver% $ver %date% $date] $template] - -append template [exec git log $branch~$count..$branch "--format=format:%an in commit %h:%n %s" --shortstat] - -#Older, more verbose version. -# -#append template [exec git log $branch~30..$branch "--format=format:+-------------------------------------------------------------------------------%n| %s%n| By %an, %ai%n+--------------------------------------------------------------------------------%nhttps://github.com/redis/redis/commit/%H%n%n%b" --stat] - -puts $template diff --git a/utils/req-res-log-validator.py b/utils/req-res-log-validator.py index 6e4fc3d96..d3d9e0ab0 100755 --- a/utils/req-res-log-validator.py +++ b/utils/req-res-log-validator.py @@ -30,12 +30,12 @@ except ImportError: """ The purpose of this file is to validate the reply_schema values of COMMAND DOCS. Basically, this is what it does: -1. Goes over req-res files, generated by redis-servers, spawned by the testsuite (see logreqres.c) +1. Goes over req-res files, generated by redict-servers, spawned by the testsuite (see logreqres.c) 2. For each request-response pair, it validates the response against the request's reply_schema (obtained from COMMAND DOCS) -This script spins up a redis-server and a redis-cli in order to obtain COMMAND DOCS. +This script spins up a redict-server and a redict-cli in order to obtain COMMAND DOCS. -In order to use this file you must run the redis testsuite with the following flags: +In order to use this file you must run the redict testsuite with the following flags: ./runtest --dont-clean --force-resp3 --log-req-res And then: @@ -69,7 +69,7 @@ IGNORED_COMMANDS = { class Request(object): """ - This class represents a Redis request (AKA command, argv) + This class represents a Redict request (AKA command, argv) """ def __init__(self, f, docs, line_counter): """ @@ -113,7 +113,7 @@ class Request(object): class Response(object): """ - This class represents a Redis response in RESP3 + This class represents a Redict response in RESP3 """ def __init__(self, f, line_counter): """ @@ -166,7 +166,7 @@ class Response(object): count = int(line[1:]) for i in range(count): field = Response(f, line_counter) - # Redis allows fields to be non-strings but JSON doesn't. + # Redict allows fields to be non-strings but JSON doesn't. # Luckily, for any kind of response we can validate, the fields are # always strings (example: XINFO STREAM) # The reason we can't always convert to string is because of DEBUG PROTOCOL MAP @@ -244,11 +244,11 @@ def process_file(docs, path): def fetch_schemas(cli, port, args, docs): - redis_proc = subprocess.Popen(args, stdout=subprocess.PIPE) + redict_proc = subprocess.Popen(args, stdout=subprocess.PIPE) while True: try: - print('Connecting to Redis...') + print('Connecting to Redict...') r = redis.Redis(port=port) r.ping() break @@ -268,8 +268,8 @@ def fetch_schemas(cli, port, args, docs): else: docs[name] = doc - redis_proc.terminate() - redis_proc.wait() + redict_proc.terminate() + redict_proc.wait() if __name__ == '__main__': @@ -278,9 +278,9 @@ if __name__ == '__main__': testdir = os.path.abspath(os.path.dirname(os.path.abspath(__file__)) + "/../tests") parser = argparse.ArgumentParser() - parser.add_argument('--server', type=str, default='%s/redis-server' % srcdir) + parser.add_argument('--server', type=str, default='%s/redict-server' % srcdir) parser.add_argument('--port', type=int, default=6534) - parser.add_argument('--cli', type=str, default='%s/redis-cli' % srcdir) + parser.add_argument('--cli', type=str, default='%s/redict-cli' % srcdir) parser.add_argument('--module', type=str, action='append', default=[]) parser.add_argument('--verbose', action='store_true') parser.add_argument('--fail-commands-not-all-hit', action='store_true') @@ -289,16 +289,16 @@ if __name__ == '__main__': docs = dict() - # Fetch schemas from a Redis instance - print('Starting Redis server') - redis_args = [args.server, '--port', str(args.port)] + # Fetch schemas from a Redict instance + print('Starting Redict server') + redict_args = [args.server, '--port', str(args.port)] for module in args.module: - redis_args += ['--loadmodule', 'tests/modules/%s.so' % module] + redict_args += ['--loadmodule', 'tests/modules/%s.so' % module] - fetch_schemas(args.cli, args.port, redis_args, docs) + fetch_schemas(args.cli, args.port, redict_args, docs) # Fetch schemas from a sentinel - print('Starting Redis sentinel') + print('Starting Redict sentinel') # Sentinel needs a config file to start config_file = "tmpsentinel.conf" diff --git a/utils/speed-regression.tcl b/utils/speed-regression.tcl index d166598ea..c74179d6a 100755 --- a/utils/speed-regression.tcl +++ b/utils/speed-regression.tcl @@ -7,7 +7,7 @@ # SPDX-License-Identifier: BSD-3-Clause # SPDX-License-Identifier: LGPL-3.0-only -source ../tests/support/redis.tcl +source ../tests/support/redict.tcl set ::port 12123 set ::tests {PING,SET,GET,INCR,LPUSH,LPOP,SADD,SPOP,LRANGE_100,LRANGE_600,MSET} set ::datasize 16 @@ -25,25 +25,25 @@ proc run-tests branches { exec -ignorestderr make 2> /dev/null if {$branch_id == 0} { - puts " copy redis-benchmark from unstable to /tmp..." - exec -ignorestderr cp ./redis-benchmark /tmp + puts " copy redict-benchmark from unstable to /tmp..." + exec -ignorestderr cp ./redict-benchmark /tmp incr branch_id continue } - # Start the Redis server - puts " starting the server... [exec ./redis-server -v]" - set pids [exec echo "port $::port\nloglevel warning\n" | ./redis-server - > /dev/null 2> /dev/null &] + # Start the Redict server + puts " starting the server... [exec ./redict-server -v]" + set pids [exec echo "port $::port\nloglevel warning\n" | ./redict-server - > /dev/null 2> /dev/null &] puts " pids: $pids" after 1000 puts " running the benchmark" - set r [redis 127.0.0.1 $::port] + set r [redict 127.0.0.1 $::port] set i [$r info] - puts " redis INFO shows version: [lindex [split $i] 0]" + puts " redict INFO shows version: [lindex [split $i] 0]" $r close - set output [exec /tmp/redis-benchmark -n $::requests -t $::tests -d $::datasize --csv -p $::port] + set output [exec /tmp/redict-benchmark -n $::requests -t $::tests -d $::datasize --csv -p $::port] lappend runs $b $output puts " killing server..." catch {exec kill -9 [lindex $pids 0]} @@ -88,7 +88,7 @@ proc combine-results {results} { } proc main {} { - # Note: the first branch is only used in order to get the redis-benchmark + # Note: the first branch is only used in order to get the redict-benchmark # executable. Tests are performed starting from the second branch. set branches { slowset 2.2.0 2.4.0 unstable slowset @@ -107,7 +107,7 @@ if {![file exists speed-regression.tcl]} { } # Make sure there is not already a server running on port 12123 -set is_not_running [catch {set r [redis 127.0.0.1 $::port]}] +set is_not_running [catch {set r [redict 127.0.0.1 $::port]}] if {!$is_not_running} { puts "Sorry, you have a running server on port $::port" exit 1 diff --git a/utils/systemd-redis_multiple_servers@.service b/utils/systemd-redis_multiple_servers@.service index 108ccfc64..96814741d 100644 --- a/utils/systemd-redis_multiple_servers@.service +++ b/utils/systemd-redis_multiple_servers@.service @@ -1,26 +1,26 @@ -# example systemd template service unit file for multiple redis-servers +# example systemd template service unit file for multiple redict-servers # # You can use this file as a blueprint for your actual template service unit -# file, if you intend to run multiple independent redis-server instances in +# file, if you intend to run multiple independent redict-server instances in # parallel using systemd's "template unit files" feature. If you do, you will # want to choose a better basename for your service unit by renaming this file # when copying it. # -# Please take a look at the provided "systemd-redis_server.service" example +# Please take a look at the provided "systemd-redict_server.service" example # service unit file, too, if you choose to use this approach at managing -# multiple redis-server instances via systemd. +# multiple redict-server instances via systemd. [Unit] -Description=Redis data structure server - instance %i -Documentation=https://redis.io/documentation -# This template unit assumes your redis-server configuration file(s) -# to live at /etc/redis/redis_server_.conf -AssertPathExists=/etc/redis/redis_server_%i.conf +Description=Redict data structure server - instance %i +Documentation=https://redict.io +# This template unit assumes your redict-server configuration file(s) +# to live at /etc/redict/redict_server_.conf +AssertPathExists=/etc/redict/redict_server_%i.conf #Before=your_application.service another_example_application.service -#AssertPathExists=/var/lib/redis +#AssertPathExists=/var/lib/redict [Service] -ExecStart=/usr/local/bin/redis-server /etc/redis/redis_server_%i.conf +ExecStart=/usr/local/bin/redict-server /etc/redict/redict_server_%i.conf LimitNOFILE=10032 NoNewPrivileges=yes #OOMScoreAdjust=-900 @@ -29,9 +29,9 @@ Type=notify TimeoutStartSec=infinity TimeoutStopSec=infinity UMask=0077 -#User=redis -#Group=redis -#WorkingDirectory=/var/lib/redis +#User=redict +#Group=redict +#WorkingDirectory=/var/lib/redict [Install] WantedBy=multi-user.target diff --git a/utils/systemd-redis_server.service b/utils/systemd-redis_server.service index cf158644a..7c3e630eb 100644 --- a/utils/systemd-redis_server.service +++ b/utils/systemd-redis_server.service @@ -1,13 +1,13 @@ -# example systemd service unit file for redis-server +# example systemd service unit file for redict-server # -# In order to use this as a template for providing a redis service in your -# environment, _at the very least_ make sure to adapt the redis configuration +# In order to use this as a template for providing a redict service in your +# environment, _at the very least_ make sure to adapt the redict configuration # file you intend to use as needed (make sure to set "supervised systemd"), and # to set sane TimeoutStartSec and TimeoutStopSec property values in the unit's # "[Service]" section to fit your needs. # # Some properties, such as User= and Group=, are highly desirable for virtually -# all deployments of redis, but cannot be provided in a manner that fits all +# all deployments of redict, but cannot be provided in a manner that fits all # expectable environments. Some of these properties have been commented out in # this example service unit file, but you are highly encouraged to set them to # fit your needs. @@ -16,17 +16,17 @@ # more information. [Unit] -Description=Redis data structure server -Documentation=https://redis.io/documentation +Description=Redict data structure server +Documentation=https://redict.io #Before=your_application.service another_example_application.service -#AssertPathExists=/var/lib/redis +#AssertPathExists=/var/lib/redict Wants=network-online.target After=network-online.target [Service] -ExecStart=/usr/local/bin/redis-server --supervised systemd --daemonize no -## Alternatively, have redis-server load a configuration file: -#ExecStart=/usr/local/bin/redis-server /path/to/your/redis.conf +ExecStart=/usr/local/bin/redict-server --supervised systemd --daemonize no +## Alternatively, have redict-server load a configuration file: +#ExecStart=/usr/local/bin/redict-server /path/to/your/redict.conf LimitNOFILE=10032 NoNewPrivileges=yes #OOMScoreAdjust=-900 @@ -35,9 +35,9 @@ Type=notify TimeoutStartSec=infinity TimeoutStopSec=infinity UMask=0077 -#User=redis -#Group=redis -#WorkingDirectory=/var/lib/redis +#User=redict +#Group=redict +#WorkingDirectory=/var/lib/redict [Install] WantedBy=multi-user.target diff --git a/utils/whatisdoing.sh b/utils/whatisdoing.sh deleted file mode 100755 index 2e3c658cf..000000000 --- a/utils/whatisdoing.sh +++ /dev/null @@ -1,30 +0,0 @@ -# SPDX-FileCopyrightText: 2024 Redict Contributors -# SPDX-FileCopyrightText: 2024 Salvatore Sanfilippo -# -# SPDX-License-Identifier: BSD-3-Clause -# SPDX-License-Identifier: LGPL-3.0-only - -# This script is from http://poormansprofiler.org/ -# -# NOTE: Instead of using this script, you should use the Redis -# Software Watchdog, which provides a similar functionality but in -# a more reliable / easy to use way. -# -# Check https://redis.io/topics/latency for more information. - -#!/bin/bash -nsamples=1 -sleeptime=0 -pid=$(ps auxww | grep '[r]edis-server' | awk '{print $2}') - -for x in $(seq 1 $nsamples) - do - gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p $pid - sleep $sleeptime - done | \ -awk ' - BEGIN { s = ""; } - /Thread/ { print s; s = ""; } - /^\#/ { if (s != "" ) { s = s "," $4} else { s = $4 } } - END { print s }' | \ -sort | uniq -c | sort -r -n -k 1,1