The following column Redis Tutorial will introduce to you how to use Redis to implement the ranking function. I hope it will be helpful to friends in need!
1. Copy redis and install the current /usr/local/redis-4.0.8/utils/redis_init_script to /etc/init.d /redis file;
cp /usr/local/redis-4.0.8/utils/redis_init_script /etc/init.d/redis
Copy after login
2. Modify the /etc/init.d/redis file. Modify the installation directory of related files for redis installation
#!/bin/sh # chkconfig: 2345 10 90 # description: Start and Stop redis # Simple Redis init.d script conceived to work on Linux systems # as it does use of the /proc filesystem. 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"
Copy after login
##
#!/bin/sh # chkconfig: 2345 10 90 # description: Start and Stop redis
Copy after login
Remarks:
The above comment means that the redis service must be started or shut down in run levels 2, 3, 4, and 5. The startup priority is 90 and the shutdown priority is 10. Copy it from the redis installation directory, it may not be there, you need to add it; otherwise the chkconfig command will fail;3. Start the settings after booting, execute the command:- Add redis service:
chkconfig --add redis
Copy after login