Redis--installation and configuration (Linux and Windows)

1. Install Redis under Linux

1.1 Download and install

# 安装gcc
yum install gcc
# 下载redis wget下载或者直接去 http://redis.io/download 官网下载
wget http://download.redis.io/releases/redis-5.0.8.tar.gz
# 把下载好的redis解压
tar xzf redis-5.0.8.tar.gz
# 进入到解压好的redis‐5.0.3目录下,进行编译与安装
cd redis-5.0.8
make
make install

1.2 Modify the configuration file

Modify the redis configuration you want as needed.

# 编辑redis.conf配置文件
vim redis.conf
# Redis使用后台模式
daemonize yes
# 关闭保护模式
protected-mode no
# 注释以下内容开启远程访问
# bind 127.0.0.1
# 修改启动端口为6381
port 6381

1.3 Start Redis

# 启动并指定配置文件
src/redis‐server redis.conf(注意要使用后台启动,所以修改redis.conf里的daemonize改为yes)                      
# 验证启动是否成功
ps -ef|grep redis
# 进入redis客户端
1. src/redis-cli
2. redis-cli -h 192.168.239.131 -p 6379  (指定ip 端口连接redis)  
# 退出客户端
quit

# 退出redis服务
1. pkill redis‐server
2. kill 进程号
3. src/redis‐cli shutdown

# 设置redis密码
config set requirepass 123456
# 验证密码
auth 123456
# 查看密码
config get requirepass

2. Install Redis under Windows

2.1 Download

https://download.csdn.net/download/weixin_42201180/13985435

2.2 Directly decompress and use

1. Open the cmd command window
2. Enter the file path you just unzipped
3. Then enter the redis-server redis.windows.conf command
![Insert the picture description here](https://img-blog.csdnimg.cn/20201230153250303.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4IubmV0L70FF_size,direct) Unzip and find **redis-server.exe** and double-click to start it.

Guess you like

Origin blog.csdn.net/weixin_42201180/article/details/111991211