Installing redis and using in python

This is a post on installing redis and using it in python. If you are unknow about redis then let me tell you: Redis is an open source storage engine which stores data in key/values. It is also reffered as data structure server.  Stings, hashes, lists, sets and sorted sets can be stored in redis server.

To install redis, can follow the follwing steps.
1. wget http://download.redis.io/redis-stable.tar.gz
2. tar -xvzf redis-stable.tar.gz
3. cd redis-stable
4. make
5. cd src
6. ./redis-server

First step is to download redis. Second to extract the file. Third change the directory to the extracted directory. Fourth to compile redis. Fifth step to change directory to the compiled redis. Then sixth to run redis server. Once redis server is running you're ready to go

Below is an example in python interactive shell about how to use redis. 

>>> import redis #import redis module
>>> r = redis.StrictRedis(host='localhost', port=6379, db=0) #make connection to server
>>> r.set('foo', 'bar') #set value of foo to 'bar'
True
>>> r.get('foo') #access foo that we set in the previous step
'bar'


Comments

Popular posts from this blog

Automate file upload in Selenium IDE

How To Install and Configure Nextcloud

Bruteforce a router to hack admin password using Hydra