Redis is an open-source and free-of-charge storage database based on memory and key-value pairs. Compared with memcached, redis only supports simple values. redis supports a wide range of value sets, it includes strings, lists, sets, and hashes.
$ Wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ Tar xzf redis-2.8.3.tar.gz
$ Redis-2.8.3 CD
$ Make
$ Sudo make install # The redis executable file is stored in/usr/local/bin.
Start the service:
$ Src/redis-Server
Open the client:
$ Src/redis-cli
Redis> set Foo bar
OK
Redis> Get foo
"Bar"
========================================================== ======================================
1. Download and install?
cd /tmpwget http://redis.googlecode.com/files/redis-2.2.13.tar.gztar -zxf redis-2.2.13.tar.gzcd redis-2.2.13makesudo make install |
In this case, the redis executable file is stored in/usr/local/bin.
2. Download the configuration file and the init Startup Script :?
wget https://github.com/ijonas/dotfiles/raw/master/etc/init.d/redis-serverwget https://github.com/ijonas/dotfiles/raw/master/etc/redis.confsudo mv redis-server /etc/init.d/redis-serversudo chmod +x /etc/init.d/redis-serversudo mv redis.conf /etc/redis.conf |
3. initialize the user and Log Path
Before starting redis for the first time, we recommend that you create a separate user for redis and create a new data and log folder.
?
sudo useradd redissudo mkdir -p /var/lib/redissudo mkdir -p /var/log/redissudo chown redis.redis /var/lib/redissudo chown redis.redis /var/log/redis |
4. How can I Enable Automatic startup and disable automatic shutdown?
sudo update-rc.d redis-server defaults |
5. Start redis :?
sudo /etc/init.d/redis-server start |
6. Start the client connection :?
$ redis-cliredis> set foo barOKredis> get foo"bar" |