Operating environment: CentOS release 6.3 (Final)
Redis version: redis-2.8.13
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
# CD redis-2.8.13
# Make Prefix=/usr/local/redis Install
# CP redis.conf/etc/
# grep-v "#"/etc/redis.conf |grep-v "^$" >>/root/redis.conf filters the lines and blank lines that begin with # under REDIS.CONF and appends to the/root/redis.conf file In
# CP redis.conf/etc/redis.conf copy redis.conf to/etc/redis.conf directory
Before starting the Redis service, you need to configure the following kernel parameters, or the Redis script will error when restarting or stopping Redis, and cannot automatically synchronize data to disk before stopping the service:
# vi/etc/sysctl.conf on the last line to add:
Vm.overcommit_memory = 1 1, which means that the kernel allows all physical memory to be allocated regardless of the current state of memory.
Two ways to start Redis
1. # nohup/usr/local/redis/bin/redis-server/etc/redis.conf &
2. Another way to start Redis is to perform in the background:
To modify a configuration file:
# vim/etc/redis.conf
Change Daemonize No to daemonize Yes
Then start Redis:
#/usr/local/redis/bin/redis-server/etc/redis.conf &
Using Redis:
#/USR/LOCAL/REDIS/BIN/REDIS-CLI
127.0.0.1:6379> Set GJR 123456
Ok
127.0.0.1:6379> Get GJR
"123456"
Enter the Redis Bin directory:
# cd/usr/local/redis/bin/
[Email protected] bin]#/redis-benchmark-h 127.0.0.1-p 6379-c 1000-n 10000
Parameter description:-C 1000-n 100.001 million concurrent requests 10,000 times
#/USR/LOCAL/REDIS/BIN/REDIS-CLI Shutdown
Stop the Redis service before backing up Redis:
#/USR/LOCAL/REDIS/BIN/REDIS-CLI Shutdown
# CP Dump.rdb Dump.rdb.bak Backup data
# RM-RF DUMP.RDB Delete data
# CP Dump.rdb.bak DUMP.RDB Recovery data
#/usr/local/redis/bin/redis-server/etc/redis.conf & Start Redis
[Email protected] bin]#./redis-cli
127.0.0.1:6379> Get test01 Query Results
"123456"
127.0.0.1:6379> Get GJR
"123456"
127.0.0.1:6379> Get test02
"987654"
127.0.0.1:6379> exit
This article is from the "david0512" blog, make sure to keep this source http://gjr0512.blog.51cto.com/6518687/1591129
Redis installation configuration, backup recovery