Falko
Falko

Reputation: 1038

Redis loads old data, shall start clean

I want to use Redis as memory only. But when I start it, it loads the content of my test run (that used just the default config, i.e. without config file).

How can I prevent it to load that stuff? (Beside deleting these files. I want to ensure by configuration that I don't mistakenly load data.)

My current configuration:

# Redis configuration
# - memory only
# - limited to 1 GB

loglevel warning
databases 4
maxclients 50
maxmemory 1GB
maxmemory-policy noeviction
# milliseconds
lua-time-limit 100
# microseconds
slowlog-log-slower-than 10000
slowlog-max-len 1000
# subscribe __keyevent@0__:expired
notify-keyspace-events Ex
# is this needed? 
appendonly no

Upvotes: 0

Views: 804

Answers (1)

Tw Bert
Tw Bert

Reputation: 3809

You should:

  1. Use a .conf file
  2. Remove the .rdb file (once) prior to starting redis-server
  3. Comment out your save entries; see this comment in the default .conf :
    Note: you can disable saving at all commenting all the "save" lines.

If you want to check the runtime config, you can let redis rewrite your .conf file. See: CONFIG REWRITE

Diff your previous config to the rewritten one, so you can see what you're missing.

To see the actual config on a running redis-server instance, use CONFIG GET
Example from redis-cli:

127.0.0.1:14130> config get *save*

You can also set some config options online, see CONFIG SET

If you want to daemonize your test server, use install_server.sh. This script has had a major overhaul in 2.8.8. I recommend you do this (if possible/permissions), since it sets up a nice structure with the .conf where it should be, according to your OS's standards. Also, you can configure the daemon to start automatically after a server reboot.

Hope this helps, TW

Upvotes: 1

Related Questions