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 /tmp wget http://redis.googlecode.com/files/redis- 2 . 2 . 13 .tar.gz tar -zxf redis- 2 . 2 . 13 .tar.gz cd redis- 2 . 2 . 13 make sudo 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-server wget https://github.com/ijonas/dotfiles/raw/master/etc/redis.conf sudo mv redis-server /etc/init.d/redis-server sudo chmod +x /etc/init.d/redis-server sudo 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 redis sudo mkdir -p /var/lib/redis sudo mkdir -p /var/log/redis sudo chown redis.redis /var/lib/redis sudo 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-cli redis> set foo bar OK redis> get foo "bar" |