记一次服务器搭建redis中出现的问题

记一次服务器搭建redis中出现的问题

安装以及基本命令

使用的是centos7。

  1. 安装epel源
yum install epel-release
  1. 安装redis
yum install redis
  1. 启动redis服务
# 启动redis
service redis start
# 停止redis
service redis stop
# 查看redis运行状态
service redis status
# 查看redis进程
ps -ef | grep redis
systemctl start redis.service   #启动redis服务

systemctl stop redis.service   #停止redis服务

systemctl restart redis.service   #重新启动服务

systemctl status redis.service   #查看服务当前状态

systemctl enable redis.service   #设置开机自启动

systemctl disable redis.service   #停止开机自启动 
  1. 设置开机自启
chkconfig redis on
  1. 进入
redis-cli

keys *
  1. redis-client客户端安装

链接:https://pan.baidu.com/s/1Dz-t1-PnTcMXBiRJx5fbng
提取码:8fvp

在安装过程中遇到的问题

  1. gcc依赖

在安装过程中,因为redis是c语言开发,安装前需要安装gcc环境依赖

yum install -y gcc 
  1. 启动redis后,需要重新配置一下redis.conf,配置如下
 vim /etc/redis.conf
 
 1. protected-mode 后面参数改成no //因为要本地连接服务器上的redis,需要把protect关掉
 2. requirepass 需要设置密码(即后面的参数) 
 3. bind那行配置需要注释掉

设置好后,打开本地client客户端

Name:随便设置

Host:要连接的redis地址

Auto: 设置的密码

原文地址:https://www.cnblogs.com/zjhzjhhh/p/15027279.html