= Redis = == Install Redis 2.6.12 on Slackware64 14 == SlackBuild Redis page [[http://slackbuilds.org/repository/14.0/system/redis/]]. Build SlackBuild for Redis 2.6.12: * cd /tmp * wget http://slackbuilds.org/slackbuilds/14.0/system/redis.tar.gz * tar xvzf redis.tar.gz * cd redis * wget http://redis.googlecode.com/files/redis-2.6.12.tar.gz * su * ./redis.SlackBuild * installpkg /tmp/redis-2.6.12-x86_64-1_SBo.tgz Built package for Slackware64 14: [[attachment:redis-2.6.12-x86_64-1_SBo.tgz]] == Install Redis 2.6.14 on Slackware 14 == SlackBuild Redis page [[http://slackbuilds.org/repository/14.0/system/redis/]]. Build SlackBuild for Redis 2.6.14: * su * cd /tmp * wget http://slackbuilds.org/slackbuilds/14.0/system/redis.tar.gz * tar xvzf redis.tar.gz * cd redis * wget http://redis.googlecode.com/files/redis-2.6.14.tar.gz * ./redis.SlackBuild * installpkg /tmp/redis-2.6.14-i486-1_SBo.tgz Built package for Slackware 14: == Start Redis service on Slackware == Run the following commands: * chmod 755 /etc/rc.d/rc.redis * /etc/rc.d/rc.redis start It listens in port '''6379''' and stores it's data on '''/var/lib/redis/''', as configured in '''/etc/redis.conf'''. == Tutorial The Little Redis Book == Tutorial in [[http://openmymind.net/redis.pdf]]. == Connect to a Redis server == To connect to a Redis server, the '''redis-cli''' command may be used. Usage examples: * redis-cli -h -p * redis-cli -h 127.0.0.1 -p 6379 == Setting and getting keys == The basic anatomy of a command is: * To set a key named '''unixcommand:bc''' with the value '''{command:'bc' , description:'bc - An arbitrary precision calculator language' , syntax:'bc [ -hlwsqv ] [long-options] [ file ... ]'}''' the command would be: * set unixcommand:bc "{command:'bc' , description:'bc - An arbitrary precision calculator language' , syntax:'bc [ -hlwsqv ] [long-options] [ file ... ]'}" To get the key value the command would be: * get unixcommand:bc === Redis hash key === Set an hash key with multiple keys with values: * hmset (...) * hmset test:properties prop1 value1 prop2 value2 prop3 value3 Gets key values for an hash key: * hmget (...) * hmget test:properties prop1 prop3 Get all keys and values for an hash key: * hmgetall * hmgetall test:properties Get keys for an hash key: * hkeys * hkeys test:properties Get keys for an hash key: * hkeys * hkeys test:properties Delete key from an hash key: * hdel * hdel test:properties prop2 === Redis list ===