Redis use detailed tutorial, redis tutorial
I. Redis basics:
1. redis introduction and installation are more than 10 times faster than mysql
****************
1. Operations for retrieving the latest N data
2. Ranking application, top n operations
3. Applications that need to precisely set the expiration time
4. Counter
the slot position obtained, but if the number of primary partitions is changed, you need to reposition the slot partition range according to the actual partition number to access the Redis address according to Ceil (redisCRC16 (Redis $ Key value)%16384/intval (16384/Cluster master number) to obtain the corresponding Redis cluster server sequential address , and
) unixsocket and unixsocketperm
Configure the path and permission of the unix sock file, indicating that redis needs to listen for data requests from the unix socket file in the specified path. These configuration items are commented by default, that is, redis does not listen on unix socket by default.
6) timeout
Configure the connection timeout time, in seconds. After the timeout, The
In-depth introduction to the Redis-redis underlying data structure (I), in-depth introduction to redis-redis1. Overview
I believe everyone who has used Redis knows that Redis is a key-value-based distributed storage system, similar to Memcached, but it is better than Memcach
200 Redis instances on a server, and it crashes. The only way to do this is to make different types of data belong to different applications and separate from each other.So, is there a way for Redis to keep different application data separate from each other and stored on the same instance? is equivalent to the MySQL database, different application data is stored under different databases.Under
Read the catalogue:
Performance-related data metrics
Memory Utilization Used_memory
Total command Processing total_commands_processed
Delay Time
Memory Fragmentation Rate
Recycle key
Summarize
Performance-related data metricsAccess to the Redis server through the REDIS-CLI command line interface, and then use the Info command to get all the information related to the
(' limit ' = = ' Array (1, 2))); Returns the 1 element in the order position 2 (where 2 is the number, not the position), returns an array (3,17) $redis->sort (' tab ', Array (' limit ' = = Array (' alpha ' = ') ')) ; Sort by first character returns an array (17,2,3), because the first character of 17 is ' 1′ so the top of the line is $redis->sort (' tab ', Array (' ' limit ' = ' = ' = ' ordered ') )); Rep
(persistent to the rdb file). The default value is yes.Rdbcompression yes# Name of the local persistent database file. The default value is dump. rdb.Dbfilename dump. rdb# Working directory## Path of the database image backup file.#The path and file name must be configured separately because redis first writes the status of the current database to a temporary file during Backup. When the backup is complete,#Replace the temporary file with the file sp
In-depth introduction to the Redis-redis underlying data structure (below), simple introduction to redis-redisOverview:
Learning to use Redis doesn't actually need to study the implementation of its underlying data. We only need to know which common data types he has, and then use them skillfully, so that we can ha
configuration file/etc/redis/6379. conf.
[Plain]
[Root @ xsf003 utils] # vim/etc/redis/6379. conf
Find # requirepass foobared and remove the comment #, and replace foobared with your own password: hi, coder
[Plain]
Requirepass "hi, coder"
After saving the configuration file, restart the redis service.
[Plain]
[Root
://redis.io/download
It is best to use the Stable version (Stable version ).
Step 2: Compile the source program
Tar zxvf redis-2.8.19.tar.gz
Cd redis-2.8.19
Make
Cd src make install (pay attention to permission issues)
Online installation method:
$ Wget http://download.redis.io/releases/redis-2.8.19.tar.gz$ Tar xzf
I. Overview(can skip this paragraph directly) Redis has become more and more widely used as a NoSQL data service, and its greatest advantage over memcached is that it provides a richer data structure, so the application scenario is broader. The advent of Redis is a boon for the vast majority of web application developers, while a large number of open source perso
.
Advantages of Redis clusters:
Data is automatically split to different nodes.You can continue to process commands when some nodes in the cluster fail or are not reachable.Data sharding of Redis ClusterRedis cluster does not use consistent hash, but introduces the concept of hash slots.The Redis cluster has 16384 hash slots. After each key is verified by CRC16,
redis. conf to specify other directories.
── Etc
│ ── Redis. conf
── Var
Iii. Registration Service
① Write a service control script
Vi/etc/init. d/redis
#! /Bin/bash## Redis-this script starts and stops the
The Spring-data-redis Project (SDR) provides a higher level of abstraction for Redis's Key-value data store operations, similar to the spring framework for JDBC support.Project home: http://projects.spring.io/spring-data-redis/Project Document: http://docs.spring.io/spring-data/redis/docs/1.5.0.RELEASE/reference/html/This article mainly introduces the actual use
Background introduction:Currently, Redis does not have an official HA scenario similar to MySQL proxy or Oracle RAC.The master-slave switching scheme named Sentinel has been formally provided #Redis version 2.8 (attached, not tested)Therefore, how to automatically transfer in the event of a failure is a problem that needs to be solved.Through the search for some information on the Internet, it is recommende
Cainiao watching Redis (1), cainiao watching redis
I. Redis Introduction
Redis is an open-source software written in C language and can run on Linux. Currently, it does not support Windows. Redis is usually used for caching, data persistence, and message queue.
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.