Skip to content

Instantly share code, notes, and snippets.

@chuyeow
Last active December 22, 2015 02:19
Show Gist options
  • Save chuyeow/6402690 to your computer and use it in GitHub Desktop.
Save chuyeow/6402690 to your computer and use it in GitHub Desktop.
Setting up Redis server on Ubuntu

Compile Redis

  1. Download and unpack redis from (http://redis.io/download).
  2. Run make or make 32bit (good idea to save on memory or when RAM is low).
  3. Run tests with make test.

Install Redis

  1. Copy binaries (redis-server, redis-cli, etc.) in src/ to /usr/local/bin.
  2. Setup init.d script:
  3. cd utils
  4. ./install_server.sh

Operating system tweaks

  1. Add vm.overcommit_memory = 1 to /etc/sysctl.conf and run the command sysctl vm.overcommit_memory=1.

redis.conf

  1. You'll probably want to uncomment bind 127.0.0.1 so that Redis is only accessible locally.
  2. Turn on Append Only File (AOF): appendonly yes
  3. Tweak these memory-related settings:
  • hash-max-ziplist-entries, hash-max-ziplist-value, list-max-ziplist-entries, list-max-ziplist-value, zset-max-ziplist-entries, zset-max-ziplist-value, set-max-intset-entries

Redis administration

  1. Rename sensitive Redis commands in redis.conf:
  • rename-command FLUSHDB "FLUSHDB_SOMEOBSCUREWORDS"
  • rename-command FLUSHALL ""
  • rename-command CONFIG ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment