Linux安装Redis

栏目: 数据库 · 发布时间: 7年前

内容简介:作者:张文龙概述:在阿里云Centos7上安装Redis,root权限安装。先在/opt下建立redis目录,在redis目录下安装。

作者:张文龙

概述:在阿里云Centos7上安装Redis,root权限安装。先在/opt下建立 redis 目录,在redis目录下安装。

1、下载
wget http://download.redis.io/releases/redis-4.0.12.tar.gz
###############################
插曲:如果报错-bash:wget: command not found,则表明没有安装wget,需要安装,安装命令如下:
yum -y install wget
###############################

2、解压
tar -xzvf <文件>

3、cd redis-4.0.12 然后 执行:make && make install
然后会在src目录下会出现redis服务程序redis-server,还有用于测试的客户端程序redis-cli
###############################
插曲 :tcl 脚本安装:https://blog.csdn.net/yanci_/article/details/79959388
###############################

4、为了方便管理配置文件及启动,创建bin,etc
mkdir bin 
mkdir etc

5、移动文件
(1)将 redis.conf 移动到 etc 目录下
mv /opt/redis/redis-4.0.12/redis.conf /opt/redis/redis-4.0.12/etc
(2)将 mkreleasehdr.sh ,redis-benchmark ,redis-check-aof ,redis-cli redis-server, 文件移动到 bin 目录下(网上说还得将redis-check-dump放进去,我这里安装完后没有此文件 )
mv mkreleasehdr.sh redis-benchmark redis-check-aof redis-cli redis-server /opt/redis/redis-4.0.12/bin

6、备份配置文件 redis.conf:
 (1) cd /opt/redis/redis-4.0.12/etc  // 进入 etc
 (2) cp redis.conf redis.conf.bak   // 备份 redis.conf文件

7、 
(1)配置reids为后台驻留程序
     vi redis.conf //
  找到 daemonize 改为 daemonize yes

Linux安装Redis

(2)配置redis log文件路径。

Linux安装Redis

(3)配置redis远程连接
     #注释掉所有bind 127.0.0.1
     #bind 127.0.0.1 ::1
     #bind 127.0.0.1
     bind 0.0.0.0

Linux安装Redis

Linux安装Redis

8、启动,停止,连接
   (1) 进入bin 目录 执行 redis-server /opt/redis/redis-4.0.12/etc/redis.conf
 (2)停止(在安装目录下执行) ./bin/redis-cli shutdown
 (3)再次启动后,测试是否启动成功,在bin目录下连接
      ./redis-cli -h 127.0.0.1 -p 6379 -a LONG // 连接
 (4)再次停止 ./bin/redis-cli shutdown 发现报错,那就用kill命令停止吧!!
     (error) NOAUTH Authentication required.


9、安装好了之后可以通过 RedisDesktopManager 客户端 工具 连接Redis。

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Learn Python 3 the Hard Way

Learn Python 3 the Hard Way

Zed A. Shaw / Addison / 2017-7-7 / USD 30.74

You Will Learn Python 3! Zed Shaw has perfected the world’s best system for learning Python 3. Follow it and you will succeed—just like the millions of beginners Zed has taught to date! You bring t......一起来看看 《Learn Python 3 the Hard Way》 这本书的介绍吧!

随机密码生成器
随机密码生成器

多种字符组合密码

Base64 编码/解码
Base64 编码/解码

Base64 编码/解码

HSV CMYK 转换工具
HSV CMYK 转换工具

HSV CMYK互换工具