Skip to content

Using Redis

richard-pei edited this page May 21, 2018 · 3 revisions

How to Use Redis

This is a short guide for how to set up and use a Redis server. This will likely be updated as the Support Tools team approaches the task of adapting the code to use in conjunction with Redis.

Setting up Redis with a Virtual Machine

The API team has advised everyone in the class to use Redis with a Virtual Machine in order to have a uniform environment. Download the UChicago CS Department's VM here:

https://howto.cs.uchicago.edu/vm:index

After downloading, run setup and Import appliance settings. Login using password "uccs".

Installing Redis

Follow the instructions at https://redis.io/topics/quickstart Short summary is just to run the following commands:

$ wget http://download.redis.io/redis-stable.tar.gz
$ tar xvzf redis-stable.tar.gz
$ cd redis-stable
$ make
$ sudo make install

Now, you can run a Redis server by running the command $ redis-server

Later on, we'll work with a Redis server that stores information in a trie, and we will be able to use commands to access that information within the tries.

To start testing out some commands, run redis-server in one Terminal, and then open a separate terminal and run "redis-cli ". For example, if your redis-server is setup correctly, if you type "redis-cli ping" you should get output of PONG.

Setting up Hiredis

Hiredis is a C client library that is used with the Redis server.
You will need to install the library in order to run tests with the Redis server.

Clone the hiredis git repository into the directory containing tests using:

$ git clone https://github.com/redis/hiredis.git

Then, inside the hiredis directory:

$ make
$ sudo make install
$ sudo ldconfig

Now, return to the testing directory and run redis-server. You are now set up to run tests on Redis.

Clone this wiki locally