linux 安装redis方法,及出现异常解决方法

官网地址:http://redis.io/

官网下载地址:http://redis.io/download

1. 下载Redis源码(tar.gz),并上传到Linux

2. 解压缩包:tar zxvf redis-2.8.17.tar.gz

3. 进入解压缩后的文件夹:cd redis-2.8.17

4. 编译源码:make

(1)若出现如下提示,则说明未安装gcc,使用命令安装gcc:yum install gcc

[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/src‘
    CC adlist.o
/bin/sh: cc: command not found
make[1]: *** [adlist.o] Error 127
make[1]: Leaving directory `/root/redis-2.8.17/src‘
make: *** [all] Error 2

(2)若出现如下提示,则将make改为make MALLOC=libc,推测是因为编译库的问题。

[root@localhost redis-2.8.17]# make
cd src && make all
make[1]: Entering directory `/root/redis-2.8.17/src‘
    CC adlist.o
In file included from adlist.c:34:
zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directory
zmalloc.h:55:2: error: #error "Newer version of jemalloc required"
make[1]: *** [adlist.o] Error 1
make[1]: Leaving directory `/root/redis-2.8.17/src‘
make: *** [all] Error 2
  1. 安装编译后的文件:make install,redis可执行文件将被复制到/usr/local/bin/,但没有配置,手动复制配置:cp redis.conf /usr/local/bin

  2. 设置Redis密码,编辑刚刚复制的配置文件:vi redis.conf,解除requirepass参数的注释,并设置值,例如:requirepass ljx520

  3. 使用配置文件启动Redis数据库:./redis-server redis.conf

如果看到如下的界面,那么恭喜你,Redis已安装成功

16751:C 11 Jun 2019 10:46:09.333 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
16751:C 11 Jun 2019 10:46:09.333 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=16751, just started
16751:C 11 Jun 2019 10:46:09.333 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
16751:M 11 Jun 2019 10:46:09.334 * Increased maximum number of open files to 10032 (it was originally set to 1024).
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 5.0.5 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 16751
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

16751:M 11 Jun 2019 10:46:09.335 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
16751:M 11 Jun 2019 10:46:09.335 # Server initialized
16751:M 11 Jun 2019 10:46:09.335 # 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.
16751:M 11 Jun 2019 10:46:09.335 # 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.
16751:M 11 Jun 2019 10:46:09.335 * Ready to accept connections

原文:https://blog.csdn.net/wzygis/article/details/51705559

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值