Wednesday, February 22, 2012

How to: install and test Redis on centos 5

Redis is a lightweight key-value data store.  in terms of the key-value support, it offers several popular data collection types. let’s test it quickly. or check it here for the real tutorial ,

Download the source code,

wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz
tar xvf redis-2.4.8.tar.gz
cd redis-2.4.8
make


If you don’t have the C compiler, try yum install gcc to install the compiler. this may take a while, C has a lot libs/headers to download and update.
image
BY default, Redis pick up the port 6379, you can find it in the redis.conf setting,
image
then start the service ‘src/redis-server redis.conf’ which will run in forground by default.

you can change the settings in redis.conf by change demonize:yes, it will run in background.
you can tell the port 6379 is picked up the redis,

image

Now we can run the CLI client of redis, src/redis-cli
image

Here is the helloword test, set one key  with one value as string,
image

We also can define a TTL for this key by put a expire keyword, it will disappear in 120 seconds

image

then some other collection data types, like Hash
image
Check whether a key exists
image
get keys and values,
image

then we can use a C# app to do the same thing,

No comments:

 
Locations of visitors to this page