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

The method of building Redis environment

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The editor will share with you how to build a Redis environment. I hope you will gain a lot after reading this article. Let's discuss it together.

Preface

In the course of the actual development project, if you want to use cache, then the first thing that comes to mind must be Redis, but why most people will not understand or think about Redis, only know that it can be used as a cache, faster than the database, I happen to be such a person; so, when I want to write an introduction to Redis, I can't even talk about it. This is also the reason why I am not familiar with Redis and mainstream in-memory databases; however, in the days to come, I must increase my thinking and depth on the framework, so that I have some precipitation on the back of the technical road. I hope that when someone asks me to briefly introduce Redis in the future, I will not be unable to talk about it; maybe this is why I want to write a series of Redis blogs!

I. Construction of Redis environment

Download redis stable Edition

Curl-o redis.tar.gz http://download.redis.io/releases/redis-stable.tar.gz

Extract the redis package

Tar-zxvf redis-stable.tar.gz-C. / / this command unzips the tar.gz package to the current directory

Compile and install redis

Go to the directory of the unzipped Redis and compile and install Redis using the following command

Sudo make & & make install PREFIX=/usr/local/redis

Edit configuration Redis profile

Sudo cp redis.conf / usr/local/redis/conf/

Start the Redis service

. / redis-server.. / conf/redis.conf & / / run in the background when starting

Start the output log:

45894 Nov 2018 22 11 bits=64 19.922 # Redis version=5.0.0, bits=64, commit=00000000, modified=0, pid=45894, just started45894:C 02 Nov 2018 22 Configuration loaded45894:M 02 Nov 2018 22 Increased maximum number of open files to 10032 (it was originally set to 256). _. _.-`. `_. '' -. _ Redis 5.0.0 (00000000Universe 0) 64 bit.-``.- ```. ```\ / _., _'-. _ (.-`|` ) Running in standalone mode | `-. _`...-.`` -. _ |'`_. -'| Port: 6379 |` -. _ `. _ / _. -'| PID: 45894` -. _ `-. _`. / _. -'_. -'| `-. `-. _` -'_. | | `-. _` -. _ _. -'_. -'| http://redis.io `-. _` -. _ _. -'. | | `-. _` -. _ `. -'_. -'| |` -. _ `-. -'_. -'. _. -'`-. _`. -'. 45894 Nov M 02 Nov 2018 22 Nov 11 Nov 19.933 # Server initialized45894:M

Verify the Redis service

Verify using the network tool telnet

TerrydeMacBook-Air:bin terrylmay$ telnet 127.0.0.1 6379Trying 127.0.0.1...Connected to localhost.Escape character is'^]'.

Verify using the system process ps

TerrydeMacBook-Air:bin terrylmay$ ps-ef | grep redis 45894 44430 0 10:11 afternoon ttys000 0grep redis 00.04. / redis-server 127.0.0.1 grep redis 6379 / / one is the Redis service 501 45897 44430 0 10:11 afternoon ttys000 00.00 grep redis / / ps query process itself

At this point, a stand-alone Redis service has been built!

Use Redis to store data

Redis CLI connects to Redis service

TerrydeMacBook-Air:bin terrylmay$. / redis-cli127.0.0.1:6379 > 127.0.0.1 set name terrylmayOK127.0.0.1:6379 > get name "terrylmay" 127.0.0.1 set name terrylmayOK127.0.0.1:6379 > after reading this article, I believe you have a certain understanding of the method of building a Redis environment, want to know more about it, welcome to follow the industry information channel, thank you for reading!

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