Redis installation configuration, backup recovery

Source: Internet
Author: User
Tags redis version

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"

    • To test Redis performance:

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

    • To turn off Redis:

#/USR/LOCAL/REDIS/BIN/REDIS-CLI Shutdown

    • Redis Backup Recovery

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.