在linux安装redis

阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6

1将下载的redis-5.0.2.tar.gz拉到/opt文件夹下

2解压文件到当前目录下

tar -zvxf redis-5.0.2.tar.gz

3将解压出来的文件名修改为redis

4由于redis是c语言编写的所以我们需要先安装gcc安装的命令如下yum -y install gcc

5安装成功后输入 : gcc -v 查看版本

6然后进入到redis目录进入redis然后输入make控制台会输出一些编译的信息

7编译成功后输入make install ,自此redis就安装成功了

8输入redis-server 启动redis,启动成功。

启动redis服务三种启动方式
1)前台启动在任何目录下执行 redis-server
2)后台启动在任何目录下执行 redis-server &
3)启动redis服务时指定配置文件redis-server redis.conf & 这种主要用于你改了配置文件的情况比如你把默认端口号改了你就用这个正常也用这个

9修改redis密码注意requirepass前面不能有空格

################################## SECURITY ###################################

# Require clients to issue AUTH <PASSWORD> before processing any other
# commands.  This might be useful in environments in which you do not trust
# others with access to the host running redis-server.
#
# This should stay commented out for backward compatibility and because most
# people do not need auth (e.g. they run their own servers).
#
# Warning: since Redis is pretty fast an outside user can try up to
# 150k passwords per second against a good box. This means that you should
# use a very strong password otherwise it will be very easy to break.
#
requirepass 123456

# Command renaming.
#

redis的客户端链接是redis-cli有密码的需要输入auth 密码显示OK才表示链接上退出是exit

[root@localhost redis]# redis-cli
127.0.0.1:6379> auth 123456
OK
127.0.0.1:6379> exit
[root@localhost redis]# 

10编写sh启动脚本保存为sh

#/bin/bash
redis-server redis.conf &

10编写sh关闭脚本保存为sh

#/bin/bash
redis-cli shuntdown
阿里云国内75折 回扣 微信号:monov8
阿里云国际,腾讯云国际,低至75折。AWS 93折 免费开户实名账号 代冲值 优惠多多 微信号:monov8 飞机:@monov6
标签: linuxredis