first, security settings
All of the operations in front of us are not securely certified, i.e. you can do whatever you want with the Redis server. This is obviously unreasonable. Below we will set the client to connect to the server after any operation requires password authentication.
Note that because the Redis speed is quite fast, we said that its set operation can be up to 110000 (110,000) times per second, and the get operation can be up to 81,000 times per second (different server configuration performance, of course). If you have a better server, an external user can make a 15K password attempt in a second, which means you need to specify a very strong password to prevent brute force.
1.1 Set Password:
The operation is simple, just need to find "# Requirepass foobared" in the Redis profile (for example, my, redis.conf), and then add the appropriate configuration underneath it, for example, I set the password to Lamplijie, which is configured as follows:
1.2 Authentication password: (restart server)
1.3 Two ways of authorizing:
second, master-slave replication
Master-slave replication allows multiple salve servers to own and masterserver the same database copy. This allows for load balancing, failback (i.e., once the primary server is hung up, a slave server can become the primary server and continue to serve).
the features of Redis master-slave replication are as follows:
Master can have multiple salve
Multiple salve can connect to the same master, and can connect to other slave so that salve can become master
Master-slave replication does not block primary, and master can continue to process client requests while synchronizing data
the process for Redis master-slave replication is as follows:
Slave connect with master, send sync Sync command
Master initiates a background process, saves the database snapshot to a file, and the master master process continues to collect new write commands and caches
After the background has finished saving, send this file to salve
Salve save this file to your hard disk
2.1 Related Configurations
Configuring the Salve server is simple, just add the following configuration to the Salve configuration file:
2.2 Verifying master-slave replication
First set a pair of key-value pairs on the primary server (port 6379):
Then, on the slave server (port 6378), take the value corresponding to this key:
can be taken, stating that the configuration was successful.
2.3 Judging master and slave servers
So how do we tell which is Master (master) which is the salve (slave) server, just call the info command, for example, we hit the info command in the Slave command window, as shown in:
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
redis--Security Settings & Master-slave replication