当前位置:网站首页>Redis installation mode for windows and Linux systems

Redis installation mode for windows and Linux systems

2022-06-24 05:04:00 User 5005176

Window Lower installation

Download address :https://github.com/MSOpenTech/redis/releases.

Redis Support 32 Bit and 64 position . This needs to be selected according to the actual situation of your system platform , Here we download Redis-x64-xxx.zip Compress package to C disc , After decompressing , Rename the folder redis.

Open folder , The contents are as follows :

Open one cmd window Use cd Command to switch the directory to C:\redis function :

redis-server.exe redis.windows.conf

If it's convenient , You can put redis Path to the system's environment variable , In this way, there is no need to lose the way , The one in the back redis.windows.conf It can be omitted , If omitted , Will enable the default . After typing , The following interface will be displayed :

At this time, another one will be opened cmd window , Don't close the original , Otherwise, you won't be able to access the server .

Switch to redis Run in directory :

redis-cli.exe -h 127.0.0.1 -p 6379

Set key value pairs :

set myKey abc

Take out the key value pair :

get myKey

Linux Lower installation

Download address :http://redis.io/download, Download the latest stable version .

The latest documentation 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

make After finishing redis-2.8.17 Compiled... Will appear in the directory redis Service program redis-server, There are also client programs for testing redis-cli, Two programs are located in the installation directory src Under the table of contents :

Start below redis service .

$ cd src
$ ./redis-server

Pay attention to this way to start redis The default configuration is used . You can also tell redis Use the specified configuration file to start .

$ cd src
$ ./redis-server ../redis.conf

redis.conf Is a default profile . We can use our own configuration file as needed .

start-up redis After service process , You can use the test client program redis-cli and redis Service interaction . such as :

$ cd src
$ ./redis-cli
redis> set foo bar
OK
redis> get foo
"bar"

Ubuntu Lower installation

stay Ubuntu System installation Redis You can use the following command :

$sudo apt-get update
$sudo apt-get install redis-server

start-up Redis

$ redis-server

see redis Whether to start ?

$ redis-cli

The above command will open the following terminals :

redis 127.0.0.1:6379>

127.0.0.1 It's local IP ,6379 yes redis Service port . Now let's type in PING command .

redis 127.0.0.1:6379> ping
PONG

The above shows that we have successfully installed redis.

stay Cloud Studio Run in Redis

Let's introduce how to Cloud Studio Install in 、 Use Redis:

  • step1: visit Tencent cloud Developer Platform , register / Login account .
  • step2: Select from the operating environment code list on the right :"ubuntu"
  • step3: Execute the command at the terminal below : sudo apt-get update sudo apt-get install redis-server
  • step4: start-up Redis: redis-server
  • step5: see redis Whether to start : redis-cli

The above command will open the following terminals :

redis 127.0.0.1:6379>

127.0.0.1 It's local IP ,6379 yes redis Service port . Now let's type in PING command :

redis 127.0.0.1:6379> ping
PONG

The above shows that we have successfully installed redis.

原网站

版权声明
本文为[User 5005176]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/08/20210825144705908e.html