看看新版本有那些特性提升,测试用!先安装
网址:https://redis.io/download
获取:wget http://download.redis.io/releases/redis-4.0.6.tar.gz
解压:tar xzvf redis-4.0.6.tar.gz
从软件目录移动目录 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 loaded
[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
加载自运行
复制自身所带的配置文件
cp /usr/local/redis-4.0.6/utils/redis_init_script /etc/init.d/redis
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]#
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:安装新版redis4.0.6 - Python技术站