Home  >  Article  >  Database  >  Redis installation guide covers Windows, Linux, Docker

Redis installation guide covers Windows, Linux, Docker

咔咔
咔咔Original
2020-05-19 18:15:181501browse

This article implements the function

  1. Redis installation tutorial on windows

  2. Redis installation on centos

  3. Use docker to install Redis

Implementation environment

  1. ##centos7.3

  2. docker

  3. VM virtual machine


##window installation redis tutorial


The version of redis on window is up to 3.2


Download address:

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

You will see after entering Go to such a page, click Download


Redis installation guide covers Windows, Linux, Docker# and then unzip the downloaded file and put it under your own drive letter

Redis installation guide covers Windows, Linux, DockerClick redis-server to start the redis service, and then open a terminal to use redis

Redis installation guide covers Windows, Linux, Dockerwindow installation of redis is very simple, you can do it during the learning process Use window to learn, but the actual work is still based on Linux.

linux installation Redis


On Linux, you can use yum to install, or you can use source code to install. Here Kaka uses compiled installation. The installation version is 4.0

Download the redis installation package

wget

http://download.redis.io/releases/redis-4.0.8.tar.gz

Redis installation guide covers Windows, Linux, DockerUnzip the installation package

tar xzvf redis-4.0.8.tar.gz

Redis installation guide covers Windows, Linux, Docker

Enter the installation package

cd redis-4.0.8Execute make


Then Move redis-4.0.8 to /usr/local

mv redis-4.0.8 /usr/local

Redis installation guide covers Windows, Linux, DockerModify redis.conf configuration

Set password


##Comment bind 127.0.0.1 (this can only be connected using the local machine, so it needs to be commented out)Redis installation guide covers Windows, Linux, Docker


Redis installation guide covers Windows, Linux, DockerThe default is non-daemon mode

Exit after completing the above operationsRedis installation guide covers Windows, Linux, Docker

Then enter /sur/local/redis/src and execute

When using redis, remember to enter a password. If you don’t want to enter a password, you can do the above operation without setting a passwordRedis installation guide covers Windows, Linux, Docker


The above is the installation of redis on linuxRedis installation guide covers Windows, Linux, Docker

Here I’ll talk about turning off the redis service. This is not turned off because the password is set, so we need to add the password to turn off the redis service

Redis installation guide covers Windows, Linux, Docker

You can see that there is a redis process running now

Redis installation guide covers Windows, Linux, Docker

The correct shutdown method redis-cli -a fang1996 shutdown

Redis installation guide covers Windows, Linux, Docker

Docker installation redis

Prerequisite: You have docker on centos

First pull the redis4.0 image

docker pull redis:4.0

View the image docker image ls

At this time the redis image has been pulled down

Redis installation guide covers Windows, Linux, Docker

I have defined a network here 172.10.0.0/16

##docker network create --subnet=172.10.0.0/16 mynetwork

Create redis container: docker run -itd --name redis --net mynetwork -p 6380:6379 --ip 172.10.0.2 redis:4.0Redis installation guide covers Windows, Linux, Docker

Enter docker in the redis container exec -it redis /bin/bashRedis installation guide covers Windows, Linux, Docker

There is no redis.conf configuration file in the container at this time. Exit the container and copy a copy to the redis containerRedis installation guide covers Windows, Linux, Docker

docker cp / usr/local/redis-4.0.8/redis.conf a782d31cc4ac:/etc/

Redis installation guide covers Windows, Linux, Docker

Then you can use redis.conf to open it


When creating a container, you only need to add redis-server /etc/redis.conf after the command

Test

Redis installation guide covers Windows, Linux, Docker

The above is all the process

The above is the detailed content of Redis installation guide covers Windows, Linux, Docker. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn