Difference between revisions of "Redis-cli"

From wikieduonline
Jump to navigation Jump to search
Tags: Mobile web edit, Mobile edit
 
(45 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
{{lc}}
 
{{lc}}
 +
https://redis.io/docs/manual/cli/
 +
[[brew install redis-cli]]
 +
[[redis-cli --help]]
 +
[[redis-cli -h you-redis-server]]
 +
[[redis-cli -h myredis-master]]
 +
REDISCLI_AUTH="$REDIS_PASSWORD" [[redis-cli]] -h myredis-master
 +
REDISCLI_AUTH="$REDIS_PASSWORD" [[redis-cli]] -h redis-master
 +
[[redis-cli --version]]
 +
 +
[[redis-cli info server]]
 +
 +
[[redis-cli Memory commands|memory]]
 +
{{redis-cli memory}}
  
[[redis-cli --help]]
 
  
[[redis-cli INFO SERVER]]
 
  
redis-cli [[DBSIZE]]
+
* <code>[[redis-cli dbsize]]</code>
  (integer) 0
+
* <code>[[redis-cli flushall]]</code>
 +
* <code>[[redis-cli ping]]</code>
 +
* <code>[[redis-cli monitor]]</code>
 +
* <code>[[redis-cli --bigkeys]]</code>
 +
* <code>[[redis-cli --stat]]</code>
 +
* <code>[[redis-cli --scan]]</code>
 +
 
 +
* <code>[[redis-cli config set requirepass]]</code>
 +
 
 +
* <code>[[redis-cli --latency]]</code>
 +
* <code>[[redis-cli --latency-history]]</code>
 +
* <code>[[redis-cli --latency-dist]]</code>
 +
* <code>[[redis-cli latency doctor]]</code>
 +
* <code>[[redis-cli --intrinsic-latency 5]]</code>
 +
 
 +
===[[Backups]]===
 +
  [[redis-cli --rdb]] /tmp/dump.rdb
  
 
  redis-cli LPUSH mylist a b c d
 
  redis-cli LPUSH mylist a b c d
Line 19: Line 46:
 
  redis-cli --raw INCR mycounter
 
  redis-cli --raw INCR mycounter
 
  3
 
  3
 
redis-cli PING or redis-cli [[ping]]
 
PONG
 
 
redis-cli FLUSHALL
 
OK
 
 
  redis-cli -x SET net_services < [[/etc/services]]
 
  
  
  [[--bigkeys]]
+
  [[redis-cli -x]] SET net_services < [[/etc/services]]
 
 
  
 +
== Errors ==
 
  redis-cli
 
  redis-cli
 
  Could not connect to Redis at 127.0.0.1:[[6379]]: [[Connection refused]]
 
  Could not connect to Redis at 127.0.0.1:[[6379]]: [[Connection refused]]
 
   
 
   
 
  Solution: [[brew install redis]] && [[brew services restart redis]]
 
  Solution: [[brew install redis]] && [[brew services restart redis]]
 
 
redis-cli help
 
redis-cli 7.0.4
 
To get help about Redis commands type:
 
      "help @<group>" to get a list of commands in <group>
 
      "help <command>" for help on <command>
 
      "help <tab>" to get a list of possible help topics
 
      "quit" to exit
 
 
To set redis-cli preferences:
 
      ":set hints" enable online hints
 
      ":set nohints" disable online hints
 
Set your preferences in ~/.redisclirc
 
  
 
== Related ==
 
== Related ==
 
* <code>[[brew install redis]]</code>
 
* <code>[[brew install redis]]</code>
 +
* <code>[[redis-client]]</code>
  
 
== See also ==
 
== See also ==

Latest revision as of 14:45, 9 March 2023

https://redis.io/docs/manual/cli/

brew install redis-cli
redis-cli --help
redis-cli -h you-redis-server
redis-cli -h myredis-master
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h myredis-master
REDISCLI_AUTH="$REDIS_PASSWORD" redis-cli -h redis-master
redis-cli --version
redis-cli info server

memory Redis memory footprint: redis-cli info memory, redis-cli memory stats, redis-cli memory doctor, redis-cli memory usage


Backups[edit]

redis-cli --rdb /tmp/dump.rdb
redis-cli LPUSH mylist a b c d
(integer) 4
redis-cli --csv LRANGE mylist 0 -1
"d","c","b","a"
redis-cli INCR mycounter
(integer) 1
redis-cli INCR mycounter
(integer) 2
redis-cli --raw INCR mycounter
3


redis-cli -x SET net_services < /etc/services

Errors[edit]

redis-cli
Could not connect to Redis at 127.0.0.1:6379: Connection refused

Solution: brew install redis && brew services restart redis

Related[edit]

See also[edit]

Advertising: