Get Redis keys and values at command prompt

There’s no command for that, but you can write a script to do so. You will need to perform for each key a “type” command: > type <key> and depending on the response perform: for “string”: get <key> for “hash”: hgetall <key> for “list”: lrange <key> 0 -1 for “set”: smembers <key> for “zset”: zrange … Read more

Redis sentinel vs clustering

First, lets talk sentinel. Sentinel manages the failover, it doesn’t configure Redis for HA. It is an important distinction. Second, the diagram you posted is actually a bad setup – you don’t want to run Sentinel on the same node as the Redis nodes it is managing. When you lose that host you lose both. … Read more

Does name length impact performance in Redis?

The key you’re talking about using isn’t really all that long. The example key you give is for a set, set lookup methods are O(1). The more complex operations on a set (SDIFF, SUNION, SINTER) are O(N). Chances are that populating $userId was a more expensive operation than using a longer key. Redis comes with … Read more

When to use a key/value store such as Redis instead/along side of a SQL database?

I can’t seem to figure out when it’s time to use it in an application. I would recommend you to read this tutorial which contains also use cases. Since redis is rather memory oriented it’s really good for frequently updated real-time data, such as session store, state database, statistics, caching and its advanced data structures … Read more

Does Redis persist data?

I suggest you read about this on http://redis.io/topics/persistence . Basically you lose the guaranteed persistence when you increase performance by using only in-memory storing. Imagine a scenario where you INSERT into memory, but before it gets persisted to disk lose power. There will be data loss. Redis supports so-called “snapshots”. This means that it will … Read more

Print number of keys in Redis

You can issue the INFO command, which returns information and statistics about the server. See here for an example output. As mentioned in the comments by mVChr, you can use info keyspace directly on the redis-cli. redis> INFO # Server redis_version:6.0.6 redis_git_sha1:00000000 redis_git_dirty:0 redis_build_id:b63575307aaffe0a redis_mode:standalone os:Linux 5.4.0-1017-aws x86_64 arch_bits:64 multiplexing_api:epoll atomicvar_api:atomic-builtin gcc_version:9.3.0 process_id:2854672 run_id:90a5246f10e0aeb6b02cc2765b485d841ffc924e tcp_port:6379 … Read more

How to connect to remote Redis server?

redis-cli -h XXX.XXX.XXX.XXX -p YYYY xxx.xxx.xxx.xxx is the IP address and yyyy is the port EXAMPLE from my dev environment redis-cli -h 10.144.62.3 -p 30000 REDIS CLI COMMANDS Host, port, password and database By default redis-cli connects to the server at 127.0.0.1 port 6379. As you can guess, you can easily change this using command … Read more

What’s the Point of Multiple Redis Databases?

You don’t want to use multiple databases in a single redis instance. As you noted, multiple instances lets you take advantage of multiple cores. If you use database selection you will have to refactor when upgrading. Monitoring and managing multiple instances is not difficult nor painful. Indeed, you would get far better metrics on each … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)