In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly shows you "CentOS 7.4 how to install redis 4.0", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "CentOS 7.4 how to install redis 4.0" this article.
1. Redis single instance installation
1. Install the dependency package
[root@VM_2_13_centos redis] # yum install gcc*
2. Get the installation file
[root@VM_2_13_centos redis] # wget http://download.redis.io/releases/redis-4.0.9.tar.gz
3. Decompress the file
[root@VM_2_13_centos redis] # tar zxvf redis-4.0.9.tar.gz
[root@VM_2_13_centos redis] # ll
Total 1708
Drwxrwxr-x 6 root root 4096 Mar 27 00:04 redis-4.0.9
-rw-r--r-- 1 root root 1737022 Mar 27 00:04 redis-4.0.9.tar.gz
4. Compile and install
[root@VM_2_13_centos redis-4.0.9] # make
[root@VM_2_13_centos redis-4.0.9] # make PREFIX=/usr/local/redis install
Cd src & & make install
Make [1]: Entering directory `/ usr/local/redis/redis-4.0.9/src'
CC Makefile.dep
Make [1]: Leaving directory `/ usr/local/redis/redis-4.0.9/src'
Make [1]: Entering directory `/ usr/local/redis/redis-4.0.9/src'
Hint: It's a good idea to run 'make test';)
INSTALL install
INSTALL install
INSTALL install
INSTALL install
INSTALL install
5. Check the version of redis
[root@VM_2_13_centos] # redis-server-- version
Redis server vault 4.0.9 sha=00000000:0 malloc=jemalloc-4.0.3 bits=64 build=c97ec2b5e9b86914
6. Start redis
[root@VM_2_13_centos redis] # / usr/local/redis/bin/redis-server / etc/redis/redis.conf
[root@VM_2_13_centos redis] # netstat-tuplan | grep 6379
Tcp 0 0 127.0.0.1 6379 0.0.0.0 LISTEN 5305/redis-server 1
[root@VM_2_13_centos redis] # ps-ef | grep redis
Root 5305 1 0 21:38? 00:00:00 / usr/local/redis/bin/redis-server 127.0.0.1:6379
Root 5356 30807 0 21:39 pts/1 00:00:00 grep-color=auto redis
7. Log in through the client
[root@VM_2_13_centos ~] # redis-cli
127.0.0.1purl 6379 >
Note: if you want to uninstall redis, delete the redis in the / usr/local/redis/bin/ directory. To uninstall cleanly, you can also delete the unzipped and compiled redis packages and the configured redis.conf.
II. Security configuration
1. Set the password
The default installation of redis does not set a password and can be configured in redis.conf
[root@VM_2_13_centos ~] # vim / etc/redis/redis.conf
Requirepass qcloud@2018
Or configure through the command
127.0.0.1 purl 6379 > CONFIG set requirepass qcloud@2018
Because the performance of Redis is extremely high, and Redis does not actively delay after entering the wrong password (considering the single-threaded model of Redis), attackers can crack the password of Redis by exhaustive method (more than 100,000 passwords can be tried in 1 second). Therefore, complex passwords must be selected when setting up, which can be generated by random password generator.
Note: when configuring Redis replication, if the master database has a password set, you need to set the password of the master database through the masterauth parameter in the configuration file of the slave database, so that the slave database will automatically use the AUTH command to authenticate when connecting to the master database.
Verify whether the password is valid and whether authentication is required
[root@VM_2_13_centos ~] # redis-cli
127.0.0.1purl 6379 >
127.0.0.1 6379 > keys *
(error) NOAUTH Authentication required.
127.0.0.1purl 6379 >
127.0.0.1 purl 6379 > auth qcloud@2018
OK
127.0.0.1purl 6379 >
127.0.0.1 6379 > keys *
(empty list or set)
2. Disable high-risk commands
At present, this command can be used normally
127.0.0.1 purl 6379 > flushall
OK
Close redis, but because the password is set above, it must be verified successfully before it can be closed.
[root@VM_2_13_centos ~] # redis-cli shutdown
(error) NOAUTH Authentication required.
[root@VM_2_13_centos] # redis-cli-a qcloud@2018 shutdown
[root@VM_2_13_centos ~] #
[root@VM_2_13_centos ~] # ps-ef | grep redis
Root 6144 5406 0 21:54 pts/0 00:00:00 grep-color=auto redis
Modify the configuration file redis.conf by adding the following line:
[root@VM_2_13_centos ~] # vim / etc/redis/redis.conf
Rename-command FLUSHALL ""
Rename-command CONFIG ""
Rename-command EVAL ""
Restart redis
[root@VM_2_13_centos ~] # redis-server / etc/redis/redis.conf
[root@VM_2_13_centos ~] #
[root@VM_2_13_centos ~] # redis-cli
127.0.0.1purl 6379 >
127.0.0.1 6379 > keys *
(error) NOAUTH Authentication required.
127.0.0.1purl 6379 >
127.0.0.1 purl 6379 > auth qcloud@2018
OK
127.0.0.1purl 6379 >
127.0.0.1 purl 6379 > flushall
(error) ERR unknown command 'flushall'
127.0.0.1purl 6379 >
127.0.0.1 purl 6379 > config
(error) ERR unknown command 'config'
127.0.0.1purl 6379 >
127.0.0.1 purl 6379 > eval
(error) ERR unknown command 'eval'
Through the above error report, we can find that the three commands disabled in the configuration file cannot be used.
3. Binding can only be accessed locally
[root@VM_2_13_centos ~] # vim / etc/redis/redis.conf
Bind 127.0.0.1
4. Set redis to enable self-startup
[root@VM_2_13_centos ~] # vim / etc/rc.d/rc.local
/ usr/local/redis/bin/redis-server / etc/redis/redis.conf &
The above is all the contents of the article "how to install CentOS 7.4 and redis 4.0". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.