redis.service
2024-08-09systemctl enable redis.service;systemctl start redis.service
1、cat << EOF > /lib/systemd/system/redis.service
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
#PIDFile=/usr/local/bin/redis.pid
ExecStart=/usr/local/bin/redis-server /usr/local/bin/redis.conf
#ExecReload=/bin/kill -s HUP $MAINPID
#ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF
2、redis.service后台启动
daemonize yes
cat << EOF > redis.conf
bind 127.0.0.1
port 6379
requirepass 12345678
maxmemory 128mb
daemonize yes
EOF
3、redis内存过度分配
WARNING Memory overcommit must be enabled!
vi /etc/sysctl.conf
vm.overcommit_memory=1
4、Increased maximum number of open files to 10032 (it was originally set to 1024).
ulimit -a
ulimit -n 65535