Redis Common configuration:
1, the use of master and slave mutual master from the way, two important commands:
Redis 127.0.0.1:6379> slaveof NO One
Redis 127.0.0.1:6379> slaveof 10.10.51.236 6379
2, modified to the background process mode: daemonize Yes
3. Ports: Port 6379
PS: Be careful not to bind the IP to Redis, otherwise the VIP cannot be used.
4. Number of databases: Databases 1
5. Both master and slave enable RDB persistence setting: Save "" (default)
6, from the library: slaveof 10.10.51.236 6379
7, from the library, when the master Service set the password: Masterauth 123456
8. Configure Redis Library access password: requirepass123456
9. Close Read Only: Slave-read-only no
10. Turn off aof log function: AppendOnly No
11, non-mutual master from the way: Turn off the RDB and AOF functions of master (turn off persistence), while shutting down the slave aof, keep only the slave rdb for persistence.
Redis Common commands:
1. Start Redis
/usr/local/redis/bin/redis-server/usr/local/redis/etc/redis.conf/usr/local/redis/bin/redis-cli-h 10.10.52.160-p 6380
2. View Redis Status
NETSTAT-TUNPL | grep Redis
3. Start keepalived
Service keepalived Start
4, check the status of Keepalived
Service keepalived Status
5, check the status of Haproxy
PS aux | grep haproxy
6, Tanqi Haproxy
- F /usr/local/haproxy/haproxy.cfg
7. Start Redis with a specific host and port
./redis-cli-h 10.10.52.160-p 6380
8. Enter a password to log in to Redis
10.10.52.160:6380> Auth MyPassword
Master hangs up the boot step:
1, the master Kick out from the Haproxy
2, Slave-->redis 10.10.52.159:6380> slaveof NO One
3. Start Master
4, Master-->redis 10.10.52.160:6380> slaveof 10.10.52.159 6380
5, waiting for data synchronization
6. Connect Master Join in Haproxy
7. Kill Slave Redis (10.10.52.159)
8, Master-->redis 10.10.52.160:6380> slaveof NO One
9. Start slave
The Haproxy algorithm has the following 8 types:
First, Roundrobin, said the simple polling, this does not say, this is the load balancer basically have;
Second, STATIC-RR, said according to the weight, suggest concern;
Third, Leastconn, said that the least connected to the first processing, the proposed attention;
Four, source, said according to the request of the IP, the proposed attention;
V. Uri, which represents the URI according to the request;
VI, Url_param, represents the URL parameter according to the request ' balance Url_param ' requires an URL parameter name
Seven, HDR (name), indicating that each HTTP request is locked according to the HTTP request header;
Viii. Rdp-cookie (name), which indicates that each TCP request is locked and hashed according to the cookie (name).
--Solemn statement: This article is only for the author's personal notes, please do not reprint! ——
Redis Daily Use Essays