Redis

Modified: 22 Nov 2017 17:39 UTC

The Joyent Redis image is a SmartOS base64 image preconfigured with Redis, an open sourced advanced key-value cache and store.



Overview

Redis comes pre-installed and tuned under the 'redis' user as the SMF service svc:/pkgsrc/redis:default. The instance comes with Redis listening on localhost only, and authentication enabled with the password as 'redis_pw' metadata.

Directory Layout

The directory and file layout is as follows:

Directory/File Description
/opt/local/bin,sbin Holds server binaries
/var/db/redis The data directory for Redis
/opt/local/etc/redis.conf The configuration file for Redis
/var/log/redis Where logs are stored for Redis

Services layout

The SMF service layout is as follows:

SMF Service Description
svc:/pkgsrc/redis:default Redis service

Starting Redis

By default redis comes enabled. You can disable, restart the service with:

    # svcadm disable pkgsrc/redis

or restart:

    # svcadm restart pkgsrc/redis

To check the status of the service:

    # svcs pkgsrc/redis
    online         May_12   svc:/pkgsrc/redis:default

Configuration

The Redis configuration file is stored at /opt/local/etc/redis.conf and database files at /var/db/redis.

Authentication

By default authentication is enabled using the metadata 'redis_pw' as the password. Before executing any commands you must first AUTH with the password as shown below.

    # redis-cli
    127.0.0.1:6379> auth password123
    OK
    127.0.0.1:6379>

To disable authentication edit the /opt/local/etc/redis.conf file and take out the 'requirepass' setting.

Bind address

For security purposes Redis comes listening on localhost only. To change this setting edit your /opt/local/etc/redis.conf and change the bind setting then restart Redis with 'svcadm restart redis'.

Memory usage

Monitoring the processes memory usages is easy with project support.

Redis memory usage can be monitored under the 'redis' project using prstat -J.

    # prstat -J
    PROJID    NPROC  SWAP   RSS MEMORY      TIME  CPU PROJECT
         0       16   78M   41M   0.0%   0:00:58 0.0% system
       925        2   8M   1508K  0.0%   0:00:00 0.0% redis

DTracing Redis

The Redis instance comes with the 'dtracetools' package installed which has a sample script to start tracing.

Example #1 - dtrace-redis_latency.d

Shows read and write latency for Redis:

# dtrace-redis_latency.d
  read->write dist (ns), for pid:                       97250
           value  ------------- Distribution ------------- count
           32768 |                                         0
           65536 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 1
          131072 |                                         0

Metadata Keys

With the Redis image are metadata keys that can be pre-defined during provision to provide additional customization to the instance.

Metadata Key Description
redis_password Redis password to set

Version 15.x.x

15.1.1

Name redis
Description A SmartOS 64-bit image pre-configured and optimized as a Redis 2.8.18 server. Packaged with Redis listening on localhost and authenticated with the 'redis_pw' metadata password.
UUID f8ef0ac0-0a1a-11e5-a999-3f7fce57a182
Based on base-64 15.1.1
Pkgsrc 2015Q1
What's New In This Image
Software Included In This Image

Software installed as pkgsrc packages:

bzip2-1.0.6nb1
curl-7.42.0
db4-4.8.30
dtracetools-0.7
gcc47-libs-4.7.4nb1
gtar-base-1.28nb1
htop-1.0.1
nodejs-0.12.4
openssl-1.0.2a
perl-5.20.2
pkgin-0.8.0
postfix-2.11.4
python27-2.7.9nb1
redis-2.8.18
smtools-20150312
sqlite3-3.8.10
sudo-1.7.10p9
wget-1.16.3
zoneinit-1.6.8

Software installed as npm packages:

json@9.0.3
manta@1.5.1
smartdc@7.3.1

Version 14.x.x

14.4.0

Name redis
Description A SmartOS 64-bit image pre-configured and optimized as a Redis 2.8.18 server. Packaged with Redis listening on localhost and authenticated with the 'redis_pw' metadata password.
UUID a07575a6-d2f6-11e4-8c15-135ec29aa6a1
Based on base-64-lts 14.4.0
Pkgsrc 2014Q4
What's new in this image
Software included in this image

Software installed as pkgsrc packages:

bzip2-1.0.6nb1
curl-7.39.0nb1
db4-4.8.30
dtracetools-0.7
gcc47-libs-4.7.3nb7
gtar-base-1.28
htop-1.0.1
nodejs-0.12.0
openssl-1.0.1k
perl-5.20.1
pkgin-0.7.0
postfix-2.11.3
python27-2.7.9
redis-2.8.18
smtools-20150226
sqlite3-3.8.7.4
sudo-1.7.10p9
wget-1.16.1
zoneinit-1.6.8

Software installed as npm packages:

json@9.0.3
manta@1.5.1
smartdc@7.3.1

14.3.0

Name redis
Description A SmartOS 64-bit image pre-configured and optimized as a Redis 2.8.13 server. Packaged with Redis listening on localhost and a uthenticated with the 'redis_pw' metadata password.
UUID cb52149a-7be5-11e4-8372-fff162be8304
Based on base64 14.3.0
pkgsrc 2014Q3
What's new in this image
Software included in this image

Software installed as pkgsrc packages:

    bzip2-1.0.6nb1
    curl-7.38.0
    db4-4.8.30
    gcc47-libs-4.7.3nb7
    gtar-base-1.28
    nodejs-0.10.33
    openssl-1.0.1j
    perl-5.20.0nb2
    pkgin-0.6.4nb7
    postfix-2.11.1nb1
    python27-2.7.8nb1
    smtools-20141114
    sqlite3-3.8.6
    sudo-1.7.10p8
    wget-1.16
    zoneinit-1.6.8

Software installed as npm packages

    manta@1.4.5
    smartdc@7.3.0

14.2.0

Name redis
Description A SmartOS 64-bit image pre-configured and optimized as a Redis 2.8.9 server. Packaged with Redis listening on localhost and authenticated with the 'redis_pw' metadata password.
UUID 7ae84590-6107-11e4-ac6b-cf658e1543b4
Based on base64 14.2.0
pkgsrc 2014Q2
What's new in this image
Software included in this image

Software installed as pkgsrc packages:

    bzip2-1.0.6nb1
    curl-7.37.0nb1
    db4-4.8.30
    gcc47-libs-4.7.3nb4
    gtar-base-1.27.1nb1
    nodejs-0.10.33
    openssl-1.0.1h
    perl-5.20.0nb2
    pkgin-0.6.4nb7
    postfix-2.11.1nb1
    python27-2.7.7nb2
    smtools-20140905
    sqlite3-3.8.5
    sudo-1.7.10p8
    wget-1.15nb2
    zoneinit-1.6.8

Software installed as npm packages

    manta@1.4.5
    smartdc@7.3.0