Linux安装redis,启动配置不生效(指定启动加载配置文件)

原创 2018年04月15日 08:58:38

一、今天有个同学问我,为什么明明安装了redis,修改了配置,启动的时候,配置还是不生效。如下图是安装后的redis文件图。

root@iZbp17cj14ulhfrlj02rkaZ:~/redis-4.0.9# ls
00-RELEASENOTES  COPYING    Makefile   redis.conf       runtest-sentinel  tests
BUGS             INSTALL    README.md  runtest          sentinel.conf     utils
CONTRIBUTING     MANIFESTO  deps       runtest-cluster  src
root@iZbp17cj14ulhfrlj02rkaZ:~/redis-4.0.9#

二、想加载上图中的redis.conf,进入到src中寻找到启动文件redis-server

root@iZbp17cj14ulhfrlj02rkaZ:~/redis-4.0.9/src# ls
Makefile      endianconv.c      pqsort.h           sentinel.o
adlist.c      endianconv.h      pqsort.o           server.c
adlist.h      endianconv.o      pubsub.c           server.h
adlist.o      evict.c           pubsub.o           server.o
ae.c          evict.o           quicklist.c        setproctitle.c
ae.h          expire.c          quicklist.h        setproctitle.o
ae.o          expire.o          quicklist.o        sha1.c
ae_epoll.c    fmacros.h         rand.c             sha1.h
ae_evport.c   geo.c             rand.h             sha1.o
ae_kqueue.c   geo.h             rand.o             siphash.c
ae_select.c   geo.o             rax.c              siphash.o
anet.c        geohash.c         rax.h              slowlog.c
anet.h        geohash.h         rax.o              slowlog.h
anet.o        geohash.o         rax_malloc.h       slowlog.o
aof.c         geohash_helper.c  rdb.c              solarisfixes.h
aof.o         geohash_helper.h  rdb.h              sort.c
asciilogo.h   geohash_helper.o  rdb.o              sort.o
atomicvar.h   help.h            redis-benchmark    sparkline.c
bio.c         hyperloglog.c     redis-benchmark.c  sparkline.h
bio.h         hyperloglog.o     redis-benchmark.o  sparkline.o
bio.o         intset.c          redis-check-aof    syncio.c
bitops.c      intset.h          redis-check-aof.c  syncio.o
bitops.o      intset.o          redis-check-aof.o  t_hash.c
blocked.c     latency.c         redis-check-rdb    t_hash.o
blocked.o     latency.h         redis-check-rdb.c  t_list.c
childinfo.c   latency.o         redis-check-rdb.o  t_list.o
childinfo.o   lazyfree.c        redis-cli          t_set.c
cluster.c     lazyfree.o        redis-cli.c        t_set.o
cluster.h     lzf.h             redis-cli.o        t_string.c
cluster.o     lzfP.h            redis-sentinel     t_string.o
config.c      lzf_c.c           redis-server       t_zset.c
config.h      lzf_c.o           redis-trib.rb      t_zset.o
config.o      lzf_d.c           redisassert.h      testhelp.h
crc16.c       lzf_d.o           redismodule.h      util.c
crc16.o       memtest.c         release.c          util.h
crc64.c       memtest.o         release.h          util.o
crc64.h       mkreleasehdr.sh   release.o          valgrind.sup
crc64.o       module.c          replication.c      version.h
db.c          module.o          replication.o      ziplist.c
db.o          modules           rio.c              ziplist.h
debug.c       multi.c           rio.h              ziplist.o
debug.o       multi.o           rio.o              zipmap.c
debugmacro.h  networking.c      scripting.c        zipmap.h
defrag.c      networking.o      scripting.o        zipmap.o
defrag.o      notify.c          sds.c              zmalloc.c
dict.c        notify.o          sds.h              zmalloc.h
dict.h        object.c          sds.o              zmalloc.o
dict.o        object.o          sdsalloc.h
dump.rdb      pqsort.c          sentinel.c

三、启动时指定加载的配置文件

root@iZbp17cj14ulhfrlj02rkaZ:~/redis-4.0.9/src# ./redis-server /root/redis-4.0.9/redis.conf
4384:C 14 Apr 23:35:14.742 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
4384:C 14 Apr 23:35:14.742 # Redis version=4.0.9, bits=64, commit=00000000, modified=0, pid=4384, just started
4384:C 14 Apr 23:35:14.742 # Configuration loaded
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.9 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 4384
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

4384:M 14 Apr 23:35:14.744 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
4384:M 14 Apr 23:35:14.744 # Server initialized
4384:M 14 Apr 23:35:14.744 # 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.
4384:M 14 Apr 23:35:14.744 # 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.
4384:M 14 Apr 23:35:14.744 * DB loaded from disk: 0.000 seconds
4384:M 14 Apr 23:35:14.744 * Ready to accept connections

四、如下图所示,加载的配置文件,你修改的信息均会生效。

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/wd2014610/article/details/79946498

Linux安装JDK,MySQL,Tomcat,Redis等软件

Linux安装软件 安装JDK 第一步 查看系统中是否存在JDk 第二步 安装JDK 第三步 配置环境变量 第四步 使配置的环境变量生效 第五步 查看环境变量 第六步 和JDK版本 安装MySQL 第...
  • masteryee
  • masteryee
  • 2018-04-08 16:57:03
  • 50

Redis安装(单机)

1.下载redis源代码,我的版本是4.0.9 官方下载地址:https://redis.io/download 或者此处下载: 链接:https://pan.baidu.com/s/1Xh75...
  • qq_26710805
  • qq_26710805
  • 2018-04-02 17:17:51
  • 57

解决linux上启动redis后配置文件未生效的问题

修改redis.conf后,重启redis,发现修改的配置未生效,原来是需要在启动redis的时候在命令中加上配置文件,命令如下./redis-server /usr/local/redis-3.2....
  • shiyong1949
  • shiyong1949
  • 2017-10-10 20:48:32
  • 1352

Linux下指定配置文件启动redis方式

本人之前对redis一窍不通,最近项目需要,研究了下,如有不对之处,欢迎指出: 本人使用的redis版本为:redis-3.0.7.tar.gz 在window下安装到:D:\Redis ;并修改了r...
  • woweipingzui
  • woweipingzui
  • 2016-03-25 13:06:32
  • 16625

redis 启动时指定配置文件

redis 启动时指定配置文件需要通过 redis 服务启动才行; 安装服务的教程:http://blog.csdn.net/justinytsoft/article/details/5458091...
  • justinytsoft
  • justinytsoft
  • 2017-01-19 11:40:01
  • 4725

redis3.2 最新版本启动配置文件redis.conf详细说明

Redis启动的时候,可以指定配置文件,如下: /usr/local/redis/bin/redis-server /usr/local/redis/etc/redis.conf &      ...
  • mchdba
  • mchdba
  • 2016-07-01 21:30:32
  • 14047

redis主要启动主要参数与配置文件说明(redis 2.8)

redis主要启动主要参数与配置文件说明(redis 2.8) 分类:redis 阅读(1834) 评论() 一、redis启动参数通过redis-server –help来查看主要启动参数:用法...
  • zj380475045
  • zj380475045
  • 2017-05-19 14:34:30
  • 1096

redis window密码配置文件启动

1:d: 2:cd D:\java\redis-2.4.5-win32-win64\64bit 3:redis-server.exe redis.conf
  • god8816
  • god8816
  • 2017-01-31 14:16:22
  • 720

nginx 匹配配置文件启动

nginx的启动命令是: /usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf -c制定配置文件的路径,不加-ng...
  • frank_good
  • frank_good
  • 2015-02-12 10:00:16
  • 3351

Windows Redis配置不生效解决方案

Windows Redis默认配置文件,Redis配置不生效解决方案, Windows Redis自启动配置不生效解决方案,Windows Redis增加自动启动服务   Windows版的Re...
  • ctx645634642
  • ctx645634642
  • 2017-08-17 11:42:13
  • 258
收藏助手
不良信息举报
您举报文章:Linux安装redis,启动配置不生效(指定启动加载配置文件)
举报原因:
原因补充:

(最多只允许输入30个字)