[root@chenbaohui home]# redis-server 7997:C 01 Apr 2025 04:29:21.197 # oO0OoO0OoO0Oo Redis is starting oO0OoO0OoO0Oo 7997:C 01 Apr 2025 04:29:21.197 # Redis version=6.2.6, bits=64, commit=00000000, modified=0, pid=7997, just started 7997:C 01 Apr 2025 04:29:21.197 # Warning: no config file specified, using the default config. In order to specify a config file use redis-server /path/to/redis.conf 7997:M 01 Apr 2025 04:29:21.198 * Increased maximum number of open files to 10032 (it was originally set to 1024). 7997:M 01 Apr 2025 04:29:21.198 * monotonic clock: POSIX clock_gettime _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 6.2.6 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._|'` _.-'| Port: 6379 | `-._ `._ / _.-' | PID: 7997 `-._ `-._ `-./ _.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | https://redis.io `-._ `-._`-.__.-'_.-' _.-' |`-._`-._ `-.__.-' _.-'_.-'| | `-._`-._ _.-'_.-' | `-._ `-._`-.__.-'_.-' _.-' `-._ `-.__.-' _.-' `-._ _.-' `-.__.-'
7997:M 01 Apr 2025 04:29:21.199 # WARNING: The TCP backlog setting of 511 cannot be enforced because /proc/sys/net/core/somaxconn is set to the lower value of 128. 7997:M 01 Apr 2025 04:29:21.199 # Server initialized 7997:M 01 Apr 2025 04:29:21.199 # 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. 7997:M 01 Apr 2025 04:29:21.200 * Ready to accept connections
执行vi命令修改redis.conf文件 ,找到damonize no 将其修改为 damonize yes 表示以守护进程的方式启动redis,不会占用主进程
# By default Redis does not run as a daemon. Use 'yes'if you need it. # Note that Redis will write a pid file in /var/run/redis.pid when daemonized. # When Redis is supervised by upstart or systemd, this parameter has no impact. daemonize yes
# IF YOU ARE SURE YOU WANT YOUR INSTANCE TO LISTEN TO ALL THE INTERFACES # JUST COMMENT OUT THE FOLLOWING LINE. # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ bind 0.0.0.0 -::1
# The working directory. # # The DB will be written inside this directory, with the filename specified # above using the 'dbfilename' configuration directive. # # The Append Only File will also be created inside this directory. # # Note that you must specify a directory here, not a file name. #dir ./ dir /root/