Redis Installation Deployment

Source: Internet
Author: User
Tags benchmark redis server

Redis is an advanced Key-value database. It is similar to memcached, but the data can be persisted and the supported data types are rich. There are strings, lists, collections, and ordered collections. Supports the addition, intersection and complement (difference) of the compute sets on the server side, and supports a variety of sorting functions. So Redis can also be viewed as a data structure server.

All redis data is stored in memory and then periodically asynchronously saved to disk (this is called "semi-persistent mode"), and each data change can be written to a append only file (AOF) (this is called "Full persistence mode").

1. :

$ wget http://download.redis.io/releases/redis-3.0.3.tar.gz

2. Unzip

$ tar xzf redis-3.0.3.tar.gz

3. Compile

$ CD redis-3.0.3

$ make

$make Install

$CP redis.conf/etc/

Parameter description:

When the make install command finishes executing, the executable is generated in the/usr/local/bin directory, respectively, Redis-server, REDIS-CLI, Redis-benchmark, Redis-check-aof, Redis-check-dump, they function as follows:

Redis-server:redis Server Daemon Startup program

Redis-cli:redis command-line operation tool. You can also use Telnet to manipulate it based on its plain text protocol.

Redis-benchmark:redis Performance Testing tool to test Redis's read and write performance under current system

REDIS-CHECK-AOF: Data Repair

Redis-check-dump: Check the Export tool

4. Modify the system configuration file, execute the command

A) echo Vm.overcommit_memory=1 >>/etc/sysctl.conf

b) Sysctl Vm.overcommit_memory=1 or perform echo Vm.overcommit_memory=1 >>/proc/sys/vm/overcommit_memory

Use numeric meanings:

0, indicates that the kernel will check for sufficient available memory to be used by the process, and if sufficient memory is available, the memory request is allowed; otherwise, the memory request fails and the error is returned to the application process.

1, which means that the kernel allows all physical memory to be allocated regardless of the current memory state.

2, which indicates that the kernel allows allocating more memory than the sum of all physical memory and swap space

5. Modifying a Redis configuration file

A) $ cd/etc

b) VI redis.conf

c) Modify Daemonize Yes---to enable the process to run in the background

Parameter description:

Daemonize: Whether to run daemon mode later

Pidfile:pid File Location

Port: Port number for listening

Timeout: Request time-out

Loglevel:log Information level

Logfile:log File Location

Databases: number of open databases

Save *: How often the snapshot is saved, the first * indicates how long, and the third * indicates how many times the write operation is performed. Snapshots are automatically saved when a certain number of writes are performed within a certain amount of time. You can set multiple conditions.

Rdbcompression: Whether to use compression

Dbfilename: Data Snapshot file name (only file name, excluding directory)

Dir: Save directory for Data snapshot (this is the directory)

AppendOnly: If the appendonlylog is turned on, each write will record a log, which will improve the data anti-risk ability, but affect the efficiency.

Appendfsync:appendonlylog How to sync to disk (three options, each write is forced to call Fsync, Fsync per second, do not call Fsync wait for the system to synchronize itself)

6. Start Redis

A) $ cd/usr/local/bin

b)./redis-server/etc/redis.conf

7. Check whether the start is successful

A) $ ps-ef | grep Redis

%%%%%

Go to the installation redis-3.0.3 's path and enter its client:

  $ src/redis-cli  redis> set foo bar  OK  redis> get foo  "bar"

Transferred from: http://www.cnblogs.com/zhuhongbao/archive/2013/06/04/3117997.html

RELATED Links: Redis official website Http://redis.io/download

Redis driver for Erlang on GitHub: Https://github.com/wooga/eredis

Have fun O (∩_∩) o~

Redis Installation Deployment

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.