Redis Linux 安装运行实战全记录

Stella981
• 阅读 590

下载Redis

去Redis官网下载最新的Linux包,Redis官方没有Windows版的下载。

https://redis.io/

下载后把包上传到Linux服务器。

安装Redis

1、解压Redis包

> tar -zxvf redis-4.0.2.tar.gz

2、切换到Redis解压目录

> cd redis-4.0.2

3、编译Redis

> make

如报错按以下错误解决。

make: cc:命令未找到

make: *** [adlist.o] 错误 127

> yum install gcc

collect2: ld returned 1 exit status

make[1]: *** [redis-server] Error 1

make[1]: Leaving directory `/usr/local/redis/src'

make: *** [all] Error 2

> vi src/.make-settings,修改OPT=-O2 -march=x86-64

4、编译测试

> make test

报错解决。

make[1]: Entering directory /home/test/redis-4.0.2/src' CC Makefile.dep make[1]: Leaving directory /home/test/redis-4.0.2/src' make[1]: Entering directory /home/test/redis-4.0.2/src' You need tcl 8.5 or newer in order to run the Redis test make[1]: *** [test] Error 1 make[1]: Leaving directory /home/test/redis-4.0.2/src'

> wget http://downloads.sourceforge.net/tcl/tcl8.6.7-src.tar.gz

> tar -zxvf tcl8.6.7-src.tar.gz

> cd tcl8.6.7/unix/

> ./configure

> make

> make install

5、安装

切换到redis目录执行安装。

> make install

启动Redis

启动redis src目录下的redis-server命令来启动Redis服务。

> ./redis-server ../redis.conf

启动成功画面:

6651:C 17 Nov 09:24:43.145 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
6651:C 17 Nov 09:24:43.145 # Redis version=4.0.2, bits=64, commit=00000000, modified=0, pid=6651, just started
6651:C 17 Nov 09:24:43.145 # Configuration loaded
6651:M 17 Nov 09:24:43.147 # You requested maxclients of 10000 requiring at least 10032 max file descriptors.
6651:M 17 Nov 09:24:43.147 # Server can't set maximum open files to 10032 because of OS error: Operation not permitted.
6651:M 17 Nov 09:24:43.147 # Current maximum open files is 4096. maxclients has been reduced to 4064 to compensate for low ulimit. If you need higher maxclients increase 'ulimit -n'.
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.2 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 6651
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

6651:M 17 Nov 09:24:43.157 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
6651:M 17 Nov 09:24:43.158 # Server initialized
6651:M 17 Nov 09:24:43.158 # WARNING overcommit_memory is set to 0! Background save may fail under low memory condition. To fix this issue add 'vm.overcommit_memory = 1' to /etc/sysctl.conf and then reboot or run the command 'sysctl vm.overcommit_memory=1' for this to take effect.
6651:M 17 Nov 09:24:43.158 # WARNING you have Transparent Huge Pages (THP) support enabled in your kernel. This will create latency and memory usage issues with Redis. To fix this issue run the command 'echo never > /sys/kernel/mm/transparent_hugepage/enabled' as root, and add it to your /etc/rc.local in order to retain the setting after a reboot. Redis must be restarted after THP is disabled.
6651:M 17 Nov 09:24:43.158 * Ready to accept connections

连接Redis

启动redis src目录下的redis-cli命令来连接到Redis服务。

> ./redis-cli

连接成功:

127.0.0.1:6379>

另外推荐使用客户端连接工具:redis desktop manager。

https://redisdesktop.com/download

关注下面的公众号,回复 “答案” 获取50道Redis面试题及答案。

Redis Linux 安装运行实战全记录

点赞
收藏
评论区
推荐文章
blmius blmius
2年前
MySQL:[Err] 1292 - Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘CREATE_TIME‘ at row 1
文章目录问题用navicat导入数据时,报错:原因这是因为当前的MySQL不支持datetime为0的情况。解决修改sql\mode:sql\mode:SQLMode定义了MySQL应支持的SQL语法、数据校验等,这样可以更容易地在不同的环境中使用MySQL。全局s
Stella981 Stella981
2年前
Opencv中Mat矩阵相乘——点乘、dot、mul运算详解
Opencv中Mat矩阵相乘——点乘、dot、mul运算详解2016年09月02日00:00:36 \牧野(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fme.csdn.net%2Fdcrmg) 阅读数:59593
Stella981 Stella981
2年前
Linux 安装Redis 详细教程
在windows下使用redis只要下载解压后启动就可以了,但是在linux下和windows下还是有些区别的,下面我们详细看看linux下redis的安装、配置、使用过程。一、环境说明1.Linux操作系统  本文使用deepin15.7发行版,下载地址:https://www.deepin.org/2.redis安装包 
Wesley13 Wesley13
2年前
Ubuntu redis的安装
redis安装1、进入/usr/local/src目录cd/usr/local/src2、到官网去下载 redis稳定版(Stable)sudowget http://download.redis.io/releases/redis4.0.1.tar.gz3、解压red
Stella981 Stella981
2年前
CentOS 7 Redis 内网 安装 卸载
\不能连接外网,安装Redis服务器的过程https://redis.io/download(官网下载安装包,最新版)  或者直接命令行下载 wgethttp://download.redis.io/releases/redis5.0.4.tar.gzredis\.tar.gz放在安装目录/usr/local/redis/  
Stella981 Stella981
2年前
KVM调整cpu和内存
一.修改kvm虚拟机的配置1、virsheditcentos7找到“memory”和“vcpu”标签,将<namecentos7</name<uuid2220a6d1a36a4fbb8523e078b3dfe795</uuid
Stella981 Stella981
2年前
Redis安装部署
1.下载安装包官网地址:https://redis.io/download(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fredis.io%2Fdownload)2.解压tarxzvf redis5.0.5.tar.gz3.编译安装cdred
Stella981 Stella981
2年前
Redis安装教程及可视化工具RedisDesktopManager下载安装
Redis安装教程:1\.Windows下安装教程:下载:https://github.com/MSOpenTech/redis/releases(https://www.oschina.net/action/GoToLink?urlhttps%3A%2F%2Fgithub.com%2FMSOpenTech%2F
Stella981 Stella981
2年前
Redis在windows下安装过程
一、下载windows版本的Redis去官网找了很久,发现原来在官网上可以下载的windows版本的,现在官网以及没有下载地址,只能在github上下载,官网只提供linux版本的下载二、安装Redis1.这里下载的是Redisx643.2.100版本,我的电脑是win764位,所以下载64位版本的,在运行中输入cmd,然后
Python进阶者 Python进阶者
2个月前
Excel中这日期老是出来00:00:00,怎么用Pandas把这个去除
大家好,我是皮皮。一、前言前几天在Python白银交流群【上海新年人】问了一个Pandas数据筛选的问题。问题如下:这日期老是出来00:00:00,怎么把这个去除。二、实现过程后来【论草莓如何成为冻干莓】给了一个思路和代码如下:pd.toexcel之前把这