Redis installation and deployment, redis deployment

Source: Internet
Author: User
Tags redis server

Redis installation and deployment, redis deployment

Redis is an advanced key-value database. It is similar to memcached, but data can be persistent and supports a wide range of data types. There are string, linked list, set and ordered set. Allows you to compute, merge, and merge sets (difference) on the server side. It also supports multiple sorting functions. So Redis can also be seen as a data structure server.

All Redis data is stored in the memory and then asynchronously stored to the disk (this is called the "semi-persistent mode "); you can also write every data change to an append only file (aof) (this is called "Full persistence mode ").

1 .:

$ Wget http://redis.googlecode.com/files/redis-2.6.13.tar.gz

2. Extract

$ Tar xzf redis-2.6.13.tar.gz

3. Compile

$ Redis-2.6.13 cd

$ Make

$ Make install

$ Cp redis. conf/etc/

Parameter introduction:

After the make install command is executed, an executable file is generated in the/usr/local/bin directory, they are redis-server, redis-cli, redis-benchmark, redis-check-aof, and redis-check-dump. Their functions are as follows:

Redis-server: daemon Startup Program of the Redis server

Redis-cli: Redis command line operation tool. You can also use telnet to operate based on its plain text protocol.

Redis-benchmark: Redis performance testing tool to test Redis's read/write performance in the current system

Redis-check-aof: data repair

Redis-check-dump: check the export tool

4. modify the system configuration file and execute the command

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

B) sysctl vm. overcommit_memory = 1 or execute echo vm. overcommit_memory = 1>/proc/sys/vm/overcommit_memory

Use numeric meanings:

0 indicates that the kernel will check whether there is enough available memory for use by the process. If there is enough available memory, the memory application will be allowed; otherwise, the memory application will fail, and return the error to the application process.

1 indicates that the kernel allows all physical memory allocation regardless of the current memory status.

2. indicates that the kernel is allowed to allocate more memory than the total physical memory and swap space.

5. Modify the redis configuration file

A) $ cd/etc

B) vi redis. conf

C) Modify daemonize yes --- to make the process run in the background

Parameter introduction:

Daemonize: whether to run in daemon mode

Pidfile: pid File Location

Port: the port number of the listener.

Timeout: Request timeout

Loglevel: log information level

Logfile: Location of the log file

Databases: number of databases Enabled

Save **: the frequency at which snapshots are saved. The first "*" indicates the duration and the third "indicates the number of write operations performed. Snapshots are automatically saved when a certain number of write operations are performed within a certain period of time. You can set multiple conditions.

Rdbcompression: whether to use Compression

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

Dir: directory for storing data snapshots (this is the Directory)

Appendonly: whether to enable appendonlylog. If it is enabled, a log is recorded for each write operation, which improves data risk resistance but affects efficiency.

Appendfsync: How to synchronize appendonlylog to the disk (three options are force-call fsync for each write, enable fsync once per second, and do not call fsync to wait for the system to synchronize itself)

6. Start redis

A) $ cd/usr/local/bin

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

7. Check whether startup is successful

A) $ ps-ef | grep redis

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.