安裝新版redis4.0.6

看看新版本有那些特性提高,測試用!先安裝php

網址:https://redis.io/downloadredis

獲取:wget http://download.redis.io/releases/redis-4.0.6.tar.gzvim

解壓:tar xzvf redis-4.0.6.tar.gztcp

從軟件目錄移動目錄
mv redis-4.0.6 /usr/local/
cd redis-4.0.6/
解壓目錄
[root@@@@@@ redis-4.0.6]# ls
00-RELEASENOTES  CONTRIBUTING  deps     Makefile   README.md   runtest          runtest-sentinel  src    utils
BUGS             COPYING       INSTALL  MANIFESTO  redis.conf  runtest-cluster  sentinel.conf     tests
編譯
redis-4.0.6]# make
[root@@@@@@ redis-4.0.6] cd src
[root@@@@@@ redis-4.0.6] mkdir ../../redis
[root@@@@@@ src] make install PREFIX=/usr/local/redis (網上好多教程須要完成後在移動到這裏?只不過沒用到PREFIX)
[root@@@@@@ src]# cd ../../redis/bin
[root@@@@@@@ bin]# ls
redis-benchmark  redis-check-aof  redis-check-rdb  redis-cli  redis-sentinel  redis-server
[root@@@@@@@ bin]# ./redis-server
5790:C 22 Jan 16:00:16.699 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5790:C 22 Jan 16:00:16.699 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=5790, just started
5790:C 22 Jan 16:00:16.699 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
                _._                                                  
           _.-``__ ''-._                                             
      _.-``    `.  `_.  ''-._           Redis 4.0.6 (00000000/0) 64 bit
  .-`` .-```.  ```\/    _.,_ ''-._                                   
 (    '      ,       .-`  | `,    )     Running in standalone mode
 |`-._`-...-` __...-.``-._|'` _.-'|     Port: 6379
 |    `-._   `._    /     _.-'    |     PID: 5790
  `-._    `-._  `-./  _.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |           http://redis.io        
  `-._    `-._`-.__.-'_.-'    _.-'                                   
 |`-._`-._    `-.__.-'    _.-'_.-'|                                  
 |    `-._`-._        _.-'_.-'    |                                  
  `-._    `-._`-.__.-'_.-'    _.-'                                   
      `-._    `-.__.-'    _.-'                                       
          `-._        _.-'                                           
              `-.__.-'                                               

5790:M 22 Jan 16:00:16.700 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
5790:M 22 Jan 16:00:16.700 # Server initialized
5790:M 22 Jan 16:00:16.700 # 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.
5790:M 22 Jan 16:00:16.700 # 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.
5790:M 22 Jan 16:00:16.700 * Ready to accept connections

 

後臺運行(當前模式關閉後 Linux關閉 redis也會關閉)
mv redis-4.0.6/redis.conf redis/etc
vim redis/etc/redis.conf
daemonize no 更改yes 136行測試

 bin]# ./redis-server /usr/local/redis/etc/redis.conf  從新加載
5868:C 22 Jan 16:27:26.417 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
5868:C 22 Jan 16:27:26.417 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=5868, just started
5868:C 22 Jan 16:27:26.417 # Configuration loadedthis

[root@@@@@ bin]# ./redis-cli
127.0.0.1:6379> exit
[root@@@@@ bin]# netstat -tunpl|grep 6379
tcp        0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      5869/./redis-server spa

 

加載自運行rest

複製自身所帶的配置文件code

cp /usr/local/redis-4.0.6/utils/redis_init_script  /etc/init.d/redisserver

vim redis  根據本身的文件名配置(重點)

#!/bin/sh # # chkconfig:2345 90 10 # description:Redis is a persistent key-value database REDISPORT=6379 EXEC=/usr/local/redis/bin/redis-server CLIEXEC=/usr/local/redis/bin/redis-cli PIDFILE=/var/run/redis_${REDISPORT}.pid CONF="/usr/local/redis/etc/redis.conf"

測試:

[root@##### init.d] service redis start Starting Redis server... 6431:C 22 Jan 18:15:32.913 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 6431:C 22 Jan 18:15:32.913 # Redis version=4.0.6, bits=64, commit=00000000, modified=0, pid=6431, just started 6431:C 22 Jan 18:15:32.913 # Configuration loaded [root@#### utils]# netstat -tunpl |grep redis tcp 0      0 127.0.0.1:6379          0.0.0.0:*               LISTEN      6432/redis-server 1 [root@##### utils]# service redis stop Stopping ... Redis stopped [root@iz2ze6hca4hfg1a0ekonzoz utils]# netstat -tunpl |grep redis [root@iz2ze6hca4hfg1a0ekonzoz utils]# 
相關文章
相關標籤/搜索