Where does Redis store the data
Asked Answered
G

9

43

I am using redis for pub/sub as well as for server side cache. I mean my app server has redis server running as one process (functioning as a cache as well) . I have several thin clients (running redis client) connected to this app server in pub/sub mode. I would like to know where redis stores the cache data ? in server alone or there will be a copy in the clients as well. Also is it a good idea to use Redis in this fashion if there are close to 100 redis clients connected to server through pub/sub channel.

Thanks

Garget answered 17/4, 2015 at 6:55 Comment(1)
Possible duplicate of Where is the data directory in Redis?Seedbed
S
31

Redis is a (sort of) in-memory noSQL database; but I found that my copy (running on linux) dumps to /var/lib/redis/dump.rdb

Scottie answered 6/6, 2015 at 15:50 Comment(0)
H
13

Redis can manage really big numbers of connections, by default its in-memory store (thanks to storing stuff in RAM it can be so fast).

But in the same time it can be configured as a persistent store, so dumping cached data (every x time or every x updated keys) to disk.

So it can be configured depending on your needs, have a look here.

Hysterectomy answered 10/2, 2018 at 16:43 Comment(0)
V
8

All the cache data will be stored in the memory of the server provided to the config of running redis server. The clients do not hold any data, they only access the data stored by the redis server.

Volumetric answered 17/4, 2015 at 9:7 Comment(1)
how the data is linked between Ram and hard disk?Diplomatic
I
7

You can figure that out with the config command.

redis-cli config get dir

However as far as I know pub/sub data is volatile and not stored nor cached in redis at all. If you need that, you should look for a dedicated message broker like for example RabbitMQ.

Immaterialize answered 29/9, 2020 at 11:30 Comment(0)
C
5

I just installed redis on mac via homebrew. Without any configuration, I found the dump.rdb is in my working directory (where I launched redis-server).

Conventioner answered 10/2, 2018 at 16:8 Comment(0)
I
3

On my Ubuntu, it was at /var/lib/redis/dump.rdb. On my macOS (installed via brew), it was at /usr/local/var/db/redis/dump.rdb.

Iaea answered 29/9, 2020 at 11:6 Comment(0)
G
1

Default location

/var/lib/redis/

Glutton answered 31/7, 2018 at 18:9 Comment(0)
L
0

As I understood about the question your concern is about the Radis server memory and the client (application) memory.

I would like to know where redis stores the cache data ? in server alone or there will be a copy in the clients as well.

The Redis 6's client-side caching is what you actually looking for. There server and application both stores copies an keep in sync through a protocol communication. Eventhough they have implemented few ways to accomplish it following example (picked from the docs) mechanism will help you to understand it well.

Client 1 -> Server: CLIENT TRACKING ON

Client 1 -> Server: GET foo

(The server remembers that Client 1 may have the key "foo" cached)

(Client 1 may remember the value of "foo" inside its local memory)

Client 2 -> Server: SET foo SomeOtherValue

Server -> Client 1: INVALIDATE "foo"

Hope this helps. See that nice docs for more elaboration.

Lebaron answered 21/1, 2023 at 9:44 Comment(0)
G
-1

Redis save all data in memory of server and rarely save date to disk. For server<>client flow - all data transport with server. Redis can processing number of clients ... default limit - 10.000 If you need less .. you must reconfigure OS, Server Settings etc. - http://redis.io/topics/clients

Goerke answered 17/4, 2015 at 7:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.