Skip to main content

Posts

Showing posts from February, 2016

Redis- Data Types

There are 5 types of data types: Strings: Redis string is a sequence of bytes. Strings in Redis are binary safe, having fixed length, So, one can store anything up to 512 megabytes in one string. 127.0.0.1:6379> SET name "Dinesh Sachdev" OK 127.0.0.1:6379> get name "Dinesh Sachdev" Hashes: It is a collection of key value pairs. Every hash can store up to 232 - 1 field-value pairs (more than 4 billion). 127.0.0.1:6379> HMSET user:1 username dineshSachdev password dinesh123 address 123 OK 127.0.0.1:6379> HGETALL user:1 1) "username" 2) "dineshSachdev" 3) "password" 4) "dinesh123" 5) "address" 6) "123" 127.0.0.1:6379> HGET user:1 username "dineshSachdev" 127.0.0.1:6379> HGET user:1 password "dinesh123" Lists: Redis Lists are simply lists of strings, sorted by insertion order. You can add elements to a Redis List on the head or on the tail. 127....

Install and Use Redis

Redis is an open source, BSD licensed, advanced key-value store. Redis holds its database entirely in memory, using the disk only for persistence. Redis can replicate data to any number of slaves. Installing Redis Download the latest stable release tarball or wget http://download.redis.io/releases/redis-stable.tar.gz Untar it:            tar xzf redis-stable.tar.gz Change Directory or make entry to '.bashrc':           cd redis-stable Proceed to with the make command:           make Run the recommended make test:           make test Start Redis hduser@slave:~$ redis-server 8413:C 02 Feb 13:29:24.587 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 8413:M 02 Feb 13:29:24.591 # You requested maxclients of 10000 requiring at least 10032 max file descriptors....