1. Preface
From the contact Redis also has two years, usually use it to do cache layer, it gives me the impression is very powerful, built-in data structure is complete, plus Redis5.0 arrival, added a lot of features. The biggest new feature of Redis5.0 is a data structure stream, which is a powerful new and robust multicast-enabled message queue that can be used to learn a little bit. The reason why write this article is because the company's computer has always been installed Redis visualization tools, it is very convenient to use, it is necessary to install a computer at home, in the process of installation is also encountered before some small problems, so write this blog record.
2. Software Installation
Software version:
1. CentOS 7
2, Redis3.2
3, redis-desktop-manager-0.8.8.384
Baidu Cloud (visualization tool): PAN.BAIDU.COM/S/1A2UV9MHIKGKGFTF6BFOQDG Password: AHFW
Official website: redisdesktop.com/download
2.1. Installing Redis
CentOS 7 Direct Yum Installation
Yum Install Redis // This method is not the latest version of the direct installation
Installing the latest version requires the installation of the Remi Software Source:
Yum install -y http:///rpms.famillecollet.com/enterprise/remi-release-7.rpmYum Install Redis
After the installation is complete, start the Redis test to see if the installation was successful:
1. Start
Service Redis start or systemctl start Redis
2, check whether to start
Ps-a|grep Redis
3. View the files created at the time of installation
RPM-QL Redis
4. View Redis version
REDIS-CLI--version
5. Set the boot start
Chkconfig Redis on
Or
Systemctl Enable Redis.service
See the following to indicate a successful start
To connect to Redis:
Redis-cli
2.2, Installation Redis-desktop-manager
Install directly under Windows
Refer to official website
3, test the connection and throw the problem 3.1, test the connection
The following issues may occur with direct links:
3.2, throw the problem
1, Redis installed by default only in localhost access, if the remote access may be limited, can not connect
2, in the Linux host, generally open the firewall, so we through the Reids default port 6379 Access, may be limited
3, in the above example, we directly use the REDIS-CLI direct connection can be accessed. If the permission is allowed to Telnet, no authentication mechanism will cause security issues
4, assuming that the open remote connection permissions, and set the authentication mechanism, then the master-slave replication of Redis and how to deal with it?
4. Problem solving 4.1, problem 1
We can fix it by modifying the Redis configuration file
A, comment out bind 127.0.0.1 allow all IP access to Redis
b, will be modified to: Protected-mode No (Redis3.2 new)
whereis Redis // Find profile path vi /etc/redis.conf systemctl Restart Redis // Save and restart the configuration file after modifying it.
When this problem is resolved, the Redis software itself allows remote connections, but we also need to resolve the firewall issues before we can connect remotely.
4.2. Question 2
CentsOS7 firewall to firewall, no longer the previous iptables, so the way to open ports a little different.
open ports are as follows: Firewall-cmd--zone=public--add-port=6379/tcp--permanent--zone // Scope--add-port=6379/tcp // Add port in the format: Port/Communication protocol --permanent // Permanent, no restart after restart firewall without this parameter : Systemctl stop Firewalld.service systemctl start Firewalld.servicesystemctl Restart Firewalld.service
To test the connection:
Connection Successful
4.2. Question 3
There are two ways to set the authentication mechanism for a password, including configuration file modification (permanent) and command-line modification (temporary, invalid after restarting the service)
A, configuration file modification
Will remove the comments in front of #requirepass foobared and change to your password requirepass password, and finally restart Redis
Test:
You can see from the command line below that if you do not enter a password, you will not get the data, that is, set the password verification mechanism successfully
The same with graphical tools:
B, command-line modification
Config get requirepass // get check password config set requirepass mypassword2 // Set Password
4.4. Question 4
If master set a password, slave also set the corresponding password parameter otherwise cannot be copied normally.
Locate the following line in the config file in slave, remove the comment, and change the password.
#masterauth
(These are some of their own ideas, if there is insufficient or wrong place please point out)
The leaf http://www.cnblogs.com/phpstudy2015-6/with the wind
Original address: www.cnblogs.com/phpstudy2015-6/p/9536831.html
Statement: This blog article for the original, only represents my work in the study in a certain time to summarize the views or conclusions. Please give the original link in the article page