1. Installation link
Environment preparation
Installing the compilation Environment Yum Install-y GCC gcc-c++
Prepare the Redis source code package wget http://download.redis.io/redis-stable.tar.gz
Start installation
Extract source code package TAR-ZXVF redis-stable.tar.gz
Switch to Redis directory CD redis-stable
Make &&make Install
Make install will have several programs under/usr/local/bin/
[Email protected] redis-stable]# cd/usr/local/bin/[[email protected] bin]# lltotal 26340-rwxr-xr-x. 1 root root 5580287 Jan 17:49 redis-benchmark #性能测试工具-rwxr-xr-x. 1 root root 22177 Jan 17:49 redis-check-aof #AOF检测工具-rwxr-xr-x. 1 root root 7826304 Jan 17:49 redis-check-rdb #RDB检测工具-rwxr-xr-x. 1 root root 5708996 Jan 17:49 redis-cli #命令行客户端lrwxrwxrwx. 1 root root 17:49 redis-sentinel-redis-server-rwxr-xr-x. 1 root root 7826304 Jan 17:49 redis-server #服务器
2. Start the Operation process
1) Direct Start
Run the Redis-server command directly, start with the default configuration, and of course you can modify the configuration in REDIS-CLI
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/8C/B7/wKiom1h1klizF70AAAC9I8oZsLM168.png "title=" 11. PNG "alt=" Wkiom1h1klizf70aaac9i8ozslm168.png "/>
2) Init script startup
In the work we used to start the way, initialize the script to store the location/
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M02/8C/B4/wKioL1h1ksaA-RAqAABxyKQDxXA059.png "title=" 11. PNG "alt=" Wkiol1h1ksaa-raqaabxykqdxxa059.png "/>
At work we need to configure how Redis runs and persist files, where log files are stored, and so on:
① configuration initialization script, copy the script to the/etc/init.d/directory, named Redis_ port number, where the port number for Redis listener, you can modify the sixth row of the script Redisport variable value is the same port number
[Email protected] utils]# cp/root/redis-stable/utils/redis_init_script/etc/init.d/redis_6379
② creating the required folders
[[email protected] utils]# mkdir-p/etc/redis/var/redis/6379 #配置文件 and persistent files
③ Modify the configuration file, copy the configuration file to/etc/redis/6379.conf, and then edit the parameters
[Email protected] redis-stable]# cp/root/redis-stable/redis.conf/etc/redis/6379.conf
Daemonize Yes #守护进程模式
Pidfile/var/run/redis_6379.pid #PID文件位置
Port Port number #redis监听端口号
dir/var/redis/6379 #持久化文件存放位置
The Redis service can now be started using/etc/init.d/redis_6379 start or service redis_6379 start.
④ Setup automatically starts with the system
UPDATE-RC.D redis_6379 defaults (if not used)
650) this.width=650; "src=" Https://s1.51cto.com/wyfs02/M01/8C/B8/wKiom1h1lwOB6L30AABjl_pJmQY254.png "title=" 11. PNG "alt=" Wkiom1h1lwob6l30aabjl_pjmqy254.png "/>
Then command to add power-on self-boot
[Email protected] redis-stable]# chkconfig redis_6379 on[[email protected] redis-stable]# chkconfig--list |grep redis_6 379redis_6379 0:off1:off2:on3:on4:on5:on6:off
3. Stop Redis
Forcibly terminate Ctrl+d, or kill-p
Redis may be synchronizing the in-memory data to the hard disk, forcing the termination of Redis may lose data, and the correct stop method should be to send the shutdown command to Redis
[Email protected] redis-stable]# REDIS-CLI SHUTDOWN
This article is from the "richylu____ Records" blog, so be sure to keep this source http://richylu.blog.51cto.com/1481674/1890993
Installation of Redis