[有道笔记地址]: (https://note.youdao.com/ynoteshare1/index.html?id=5f92f19349e001e98799da1f5bc4489b&type=note)
[root@bogon redis-5.0.5]# cd src && make install
CC Makefile.dep
Hint: It's a good idea to run 'make test' ;)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
[root@bogon src]# ./redis-server
15281:C 19 Jun 2019 21:59:59.728 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
15281:C 19 Jun 2019 21:59:59.728 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=15281, just started
15281:C 19 Jun 2019 21:59:59.728 # Warning: no config file specified, using the default config. In order to specify a config file use ./redis-server /path/to/redis.conf
15281:M 19 Jun 2019 21:59:59.730 * 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: 15281
`-._ `-._ `-./ _.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' | http://redis.io
`-._ `-._`-.__.-'_.-' _.-'
|`-._`-._ `-.__.-' _.-'_.-'|
| `-._`-._ _.-'_.-' |
`-._ `-._`-.__.-'_.-' _.-'
`-._ `-.__.-' _.-'
`-._ _.-'
`-.__.-'
15281:M 19 Jun 2019 21:59:59.736 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128.
15281:M 19 Jun 2019 21:59:59.736 # Server initialized
15281:M 19 Jun 2019 21:59:59.736 # 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.
15281:M 19 Jun 2019 21:59:59.736 # 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.
15281:M 19 Jun 2019 21:59:59.736 * Ready to accept connections
[root@bogon src]# ./redis-server /usr/java/redis-5.0.5/redis.conf
15855:C 19 Jun 2019 22:41:42.748 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
15855:C 19 Jun 2019 22:41:42.749 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=15855, just started
15855:C 19 Jun 2019 22:41:42.749 # Configuration loaded
[root@bogon src]# ps -aux | grep redis
root 15430 0.0 0.0 14072 1192 pts/2 S+ 22:06 0:00 redis-cli -h 0.0.0.0 -p 6379 -a password
root 15969 0.0 0.1 144020 2040 ? Ssl 22:51 0:00 ./redis-server 127.0.0.1:6379
root 15974 0.0 0.0 112708 980 pts/1 S+ 22:51 0:00 grep --color=auto redis
[root@bogon etc]# mkdir redis
[root@bogon etc]# cp /usr/java/redis-5.0.5/redis.conf /etc/redis/6379.conf
[root@bogon etc]# cp /usr/java/redis-5.0.5/utils/redis_init_script /etc/init.d/redisd
[root@bogon etc]# cd /etc/init.d/
[root@bogon init.d]# chkconfig redisd on
//
如果出现
service redisd does not support chkconfig,
是redisd不支持chkconfig,
使用vim编辑redisd文件,在第一行加入如下两行注释,保存退出
# chkconfig: 2345 90 10
# description: Redis is a persistent key-value database
注释的意思是,redis服务必须在运行级2,3,4,5下被启动或关闭,启动的优先级是90,关闭的优先级是10。
[root@bogon init.d]# service redisd start
/var/run/redis_6379.pid exists, process is already running or crashed
出现这个错误的时候,重启系统就好了,下面是开关服务的提示:
[root@bogon ~]# service redisd stop
Stopping ...
Waiting for Redis to shutdown ...
Redis stopped
[root@bogon ~]# service redisd start
Starting Redis server...
1829:C 19 Jun 2019 23:39:12.204 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo
1829:C 19 Jun 2019 23:39:12.204 # Redis version=5.0.5, bits=64, commit=00000000, modified=0, pid=1829, just started
1829:C 19 Jun 2019 23:39:12.204 # Configuration loaded