Ubuntu redis standalone online installation tutorial, ubunturedis
Online installation of standalone Edition
1. Online Installation
apt-install redis-server
2. Configuration File
etc/redis/redis.conf
3. Set redis Remote Access
Modify
vi /etc/redis/redis.conf
Comment out this line of bind 127.0.0.1
4. Restart redis
service redis-server restart
5. Add User Password
Modify
vi /etc/redis/redis.conf
Add
requirepass yourpwd
Common redis types
String
Hash
List performance consumption
Set
SortedSet is especially performance-consuming, and the sorting remains unique.
Source code installation download Installation File
wget https://download.redis.io/releases/redis-3.0.5.tar.gztar -zxvf redis-3.0.5.tar.gz
Compile and install
cd redis-3.0.5make && make install
An error may occur here, causing compilation to fail (as follows)
make[1]: Entering directory /redis/src'CC adlist.oIn file included from adlist.c:34:zmalloc.h:50:31: error: jemalloc/jemalloc.h: No such file or directoryzmalloc.h:55:2: error: #error "Newer version of jemalloc required"make[1]: *** [adlist.o] Error 1make[1]: Leaving directory/redis/src'make: * [all] Error 2
The reason is that the jemalloc memory distributor is not installed. you can install jemalloc or directly enter
make MALLOC=libc && make install
Cluster Overview
All redis nodes are interconnected through the PING-PONG mechanism, and the binary protocol is used internally to optimize the transmission speed and bandwidth.
Node fail takes effect only when more than half of nodes in the cluster fail to be detected.
3. The client directly connects to the redis node without the intermediate proxy layer. The client does not need to connect to all nodes in the cluster and connect to any available node in the cluster.
Redis-cluster maps all physical nodes to the 0-16383 slot, and the cluster maintains the node <-> slot <-> value
The redis cluster has 16383 built-in hash slots. When you need to place a key-value in the redis cluster, redis first uses the crc16 algorithm to calculate a result for the key, in this way, each key corresponds to a hash slot ranging from 0 to 16384. redis maps the hash slots to different nodes based on the number of nodes.
Cluster down
When any master of the cluster fails and the current master does not have a Server Load balancer instance, the cluster enters the fail status,
If more than half of the Cluster's master nodes are down, whether or not the slave cluster is in the fail status.
When The cluster is unavailable, all operations on The cluster are unavailable and The cluster is down error is received