Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure Redis

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly shows you "how to install and configure Redis", the content is simple and easy to understand, the organization is clear, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to install and configure Redis" this article.

yum install gcc-c ++

The following log appears indicating successful installation. Package gcc-c++-4.8.5-39.el7.x86_64 already installed and latest version

Loaded plugins: fastestmirrorDetermining fastest mirrorsbase | 3.6 kB 00:00:00 docker-ce-stable | 3.5 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 2.9 kB 00:00:00 nginx | 2.9 kB 00:00:00 updates | 2.9 kB 00:00:00 (1/7): epel/x86_64/group_gz | 95 kB 00:00:00 (2/7): epel/x86_64/updateinfo | 1.0 MB 00:00:00 (3/7): docker-ce-stable/x86_64/primary_db | 45 kB 00:00:00 (4/7): extras/7/x86_64/primary_db | 205 kB 00:00:00 (5/7): updates/7/x86_64/primary_db | 3.0 MB 00:00:00 (6/7): epel/x86_64/primary_db | 6.8 MB 00:00:00 (7/7): nginx/x86_64/primary_db | 55 kB 00:00:02 Package gcc-c ++-4.8.5-39.el7.x86_64 already installed and latest versionNothing to do [root@root~]#II, Download and install Redis

Execute the command: wget http://download.redis.io/releases/redis-5.0.7.tar.gz Unzip after download. Then execute the make and make install commands.

[root@root/]#cd usr/java [root@root java]#mkdir redis [root@root java]#cd redis/[root@root redis]#wget http://download.redis.io/releases/redis-5.0.7.tar.gz [root@root redis]#tar-zxvf redis-5.0.7.tar.gz [root@root redis]#cd redis-5.0.7 [root@root redis-5.0.7]#make [root@root redis-5.0.7]#make install

Start Redis by typing the command: redis-server redis. conf. See the following page for successful startup.

[root@root redis-5.0.7]# redis-server redis.conf _._ _.-``__ ''-._ _.-`` `. `_. ''-._ Redis 5.0.7 (00000000/0) 64 bit .-`` .-```. ```\/ _.,_ ''-._ ( ' , .-` | `, ) Running in standalone mode |`-._`-...-` __...-.``-._| '` _.- '| Port: 6379 | `-._ `._ / _.- ' | PID: 12513 `-._ `-._ `-./ _.- ' _.- ' |`-._`-._ `-.__.- ' _.- '_.- '| | `-._`-._ _.- '_.- ' | http://redis.io `-._ `-._`-.__.- '_.- ' _.- ' |`-._`-._ `-.__.- ' _.- '_.- '| | `-._`-._ _.- '_.- ' | `-._ `-._`-.__.- '_.- ' _.- ' `-._ `-.__.- ' _.- ' `-._ _.- ' `-.__.- '

However, there is no way to do anything under this tab page, because after using Ctrl + c at this time, it becomes like this. That is to say, Redis is closed, and this way is the foreground startup.

^C13082:signal-handler (1594381754) Received SIGINT scheduling shutdown... 13082:M 10 Jul 2020 19:49:14.132 # User requested shutdown... 13082:M 10 Jul 2020 19:49:14.132 * Saving the final RDB snapshot before exiting.13082:M 10 Jul 2020 19:49:14.135 * DB saved on disk13082:M 10 Jul 2020 19:49:14.135 * Removing the pid file.13082:M 10 Jul 2020 19:49:14.135 # Redis is now ready to exit, bye bye... IV. Background startup

Open the redis. conf file. This is also the profile of Redis.

[root@root redis-5.0.7]#vim redis. conf #After opening, press/type daem in the command window and enter

Modified as yes

daemonize yes

Redis does not run as a daemon by default. It can be modified through this configuration item. Use yes to enable the daemon. After enabling the daemon, Redis will write the pid to a pidfile in the file/var/run/redis_6379.pid.

started again

[root@root redis-5.0.7]#redis-server redis. conf 13352: C 10 Jul 2020 19:54: 34.301 #oO0OoO0OO Redis is starting oO0OoO0O13352: C 10 Jul 2020 19:54: 34.301 #Redis version = 5.0.7, bits = 64, commit = 000000, modified = 0, pid = 13352, just started13352: C 10 Jul 2020 19:54: 34.301 #Configuration loaded v, Connect Redis [root@root redis-5.0.7]#redis-cli 127.0.0.1: 6379> pingPONG127.0.0.1: 6379> config get requirepass #Check password 1)"requirepass" 2)"" 127.0.0.1:6379>

set a password

We found out that Redis doesn't require a password. How do you set it?

requirpass foobared: Set the Redis connection password. If the connection password is configured, the client needs to provide the password through the AUTH password command when connecting to Redis. The default is OFF.

1. Temporary settings

config set requirepass 123456

2. Permanent settings

[root@root redis-5.0.7]#vim redis. conf #After opening, press/type requirepass in the command window and enter

Find the content as shown in the picture, and set your password by releasing the comment.

Then restart Redis.

[root@root redis-5.0.7]# redis-server redis.conf [root@root redis-5.0.7]# redis-cli 127.0.0.1:6379> ping(error) NOAUTH Authentication required.127.0.0.1:6379> auth xxxOK127.0.0.1:6379> pingPONG127.0.0.1:6379>

You can see that the first ping prompts me that I need authentication. auth xxx This is the password entered after the connection. You can also enter:

[root@root redis-5.0.7]#redis-cli-p 6379-a xxx Above is "How to install and configure Redis" All the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to 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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report