Redis installation
Install under Window
Download address: https://github.com/dmajkic/redis/downloads.
The downloaded Redis supports 32bit and 64bit. Choose according to your actual situation, cp the 64bit content to the custom drive letter installation directory and name it redis. For example, C:\reids
opens a cmd window and uses the cd command to switch directories to C:\redis and run redis-server.exe redis.conf.
If you want convenience, you can add the redis path to the system environment variable, so that you don't have to enter the path again. The following redis.conf can be omitted. If omitted, the default one will be enabled. After inputting, the following interface will be displayed:
At this time, open another cmd window. Do not close the original one, otherwise you will not be able to access the server.
Switch to the redis directory and run redis-cli.exe -h 127.0.0.1 -p 6379.
Set key-value pairset myKey abc
Get key-value pairget myKey
Linux Install under
Download address: http://redis.io/download, download the latest document version.
The latest document version used in this tutorial is 2.8.17. Download and install:
$ wget http://download.redis.io/releases/redis-2.8.17.tar.gz $ tar xzf redis-2.8.17.tar.gz $ cd redis-2.8.17 $ make
After make is completed, the compiled redis service program redis-server will appear in the redis-2.8.17 directory. , there is also the client program redis-cli used for testing. The two programs are located in the installation directory src directory:
Start the redis service below.
$ cd src $ ./redis-server
Note that this method is used to start redis default allocation. You can also tell redis to use the specified configuration file through startup parameters and use the following command to start.
$ cd src $ ./redis-server redis.conf
redis.conf is a default configuration file. We can use our own configuration files if needed.
After starting the redis service process, you can use the test client program redis-cli to interact with the redis service. For example:
$ cd src $ ./redis-cli redis> set foo bar OK redis> get foo "bar"
Installation under Ubuntu
To install Redi on Ubuntu system, you can use the following command:
$sudo apt-get update $sudo apt-get install redis-server
Start Redis
$ redis-server
Check whether redis start up?
$ redis-cli
The above command will open the following terminal:
redis 127.0.0.1:6379>
127.0.0.1 is the local IP and 6379 is the redis service port. Now we enter the PING command.
redis 127.0.0.1:6379> ping PONG
The above shows that we have successfully installed redis.