“This is the 11th day of my participation in the Gwen Challenge in November. See details: The Last Gwen Challenge in 2021”
Hi, family, I’m bug bug, here I go again. Let’s talk about something today. OK, let’s continue with the Ubuntu series. Listen and learn! Good cut?
I. Environmental description
Environment: Ubuntu20.04
Second, the preface
Redis is introduced:
I. Redis concept:
>> Redis:REmote DIctionary Server Is an in-memory cache database developed by Italian Salvatore Sanfilippo (online name: Antirez). Is a completely open source free, written in C language, comply with the BSD protocol, high performance (key/value) distributed memory database, memory based running and support persistence NoSQL database. For detailed concepts, please refer to Baidu encyclopedia.
Two, redis advantages:
>1. High scalability >2. Distributed computing >3. Low cost >4. Architectural flexibility, semi-structured data >5. No complicated relationship
Three, Redis shortcomings:
>1. No standardization >2. Limited query functionality (so far) >3. The final consensus is an unintuitive program
Four, redis classification:
type
Some representative
The characteristics of
Column storage
Hbase, Cassandra, Hypertable
As the name implies, data is stored in columns. The biggest feature is easy to store structured and semi-structured data, easy to do data compression, for a certain column or several columns of the query has a very large I/O advantage.
Document storage
Mongo, CouchDB
Documents are stored in a JSON-like format, and the content is document-like. This gives you the opportunity to index certain fields and implement some of the functionality of a relational database.
The key – value stored
Tokyo Abinet /Tyrant, BerkeleyDB, MemcacheDB, Redis
You can quickly query the value of the key. Generally, the store accepts the value regardless of the format. (Redis includes other features)
Figure storage
Tokyo Abinet /Tyrant, BerkeleyDB, MemcacheDB, Redis
Optimal storage of graphical relationships. Using traditional relational database to solve the low performance, and design is not convenient to use.
Object storage
Of those, Versant
Through the similar object-oriented language syntax operation database, through the way of objects access data.
XML database
BerkeleyDB、 XML、 BaseX
Store XML data efficiently and support XML internal query syntax such as XQuery and Xpath.
Five, Redis resources:
> 1. Redis website: Redis > 2. Redis online test: Try Redis > 3. Redis novice tutorial: | rookie Redis tutorial tutorial
Here, for xiaobai series of teaching, Bug bug has opened a special column, interested friends can pay attention to “Ubuntu Zero Basic Teaching”, Bug bug do so much just for one thing is to teach you, teaching will not charge tuition! For those who are helpful to you, please don’t forget to give a thumbs-up to bug bacteria. Your encouragement is the biggest support for me! So then, business as usual! The bugs are going to start class
So then, business as usual! Bug bacteria will start the class oh ~ about Redis specific concepts and specific application scenarios, in fact, now say a little empty, later we will introduce Redis related to the characteristics of the time will be introduced in detail. Now let’s directly install (because the mainstream is to use Redis on the Linux server, very few on the Windows system, so I take the Linux version of Redis as an example to install).
Redis installation:
#1. Get the latest software package
sudo apt update
sudo apt install redis-server
Copy the code
#2 after the installation, the Redis server will start automatically. Check whether Redis is started successfully
Sudo systemctl status redis-server or service redis-server statusCopy the code
Ps: As shown in the figure above: Active: Active (Running) : Redis is running and started successfully.
Redis process default port 6379
ps -aux|grep redis-server
Copy the code
To verify this, listen on Redis port 6379:
ss -an | grep 6379
Copy the code
#4. Set Redis to automatically start upon startup:
sudo systemctl enable redis-server.service
Copy the code
#5. Configure Redis
Redis does not allow remote connections by default. You can only connect to the Redis server from 127.0.0.1 (localhost) – on the machine where the Redis server is running.
Open the Redis configuration file using the following command:
vi /etc/redis/redis.conf
Copy the code
#5.1 Find the corresponding line and change it to the following:
#bind 0.0.0.0 ::1 // comment out this line protected-mode noCopy the code
Save this file and restart the Redis service for the application to take effect:
Sudo systemctl restart redis-server or sudo service redis-server restartCopy the code
#6. Disable the firewall. You can also whitelist port 6379 separately.
Ufw disable // Firewall disabled ufw enable // Firewall enabledCopy the code
Install Redis server, automatically install Redis command line client program. Command line enter redis-cli
If the password is set 123456 redis-cli -a 123456
Redis -cli redis-cli -a 123456 // The redis password is setCopy the code
The ps: Redis command is case insensitive
#8, attach common commands
To start the Redis service, run sudo systemctl start redis-server or service redis-server start to disable the Redis service. Run the following command to restart the redis service: sudo systemctl stop redis-server or service redis-server stop Sudo systemctl restart redis-server or service redis-server restartCopy the code
———————————————————————————————-
In summary, it is the dry goods brought by bug bacteria this period, if not enough to eat, the bug bacteria think again ~~
———————————————————————————————-
Recommend:
- How to install jdk1.8 and environment variable configuration on Ubuntu20.04
- How to install IDEA and IDEA stomp guide on Ubuntu20.04
- How to install maven and environment variable configuration on Ubuntu20.04
- How to set up Chinese UI and Chinese input method on Ubuntu20.04
- Ubuntu20.04 hardware time is inconsistent with system time
. .
For more articles on Ubuntu, check out Bug Bug’s Ubuntu Zero-based Teaching column, which will continue to be updated. Teach you how to understand Ubuntu! I use my hands to make your dreams come true.
If you find this article helpful, please do not forget to put it in the lower left corner of the article,
Direct pia to light it up!!
If I were you, don’t hesitate to go straight to my favorites to eat ashes! No matter later use not on, first eat ash again, ha ha ha ha ha ha ha belch ~~
If this article has been helpful, please put your thumb in the bottom left corner of the article. (# ^. ^ #);
If you like the articles shared by Bug bug, please send bug bug a note! The danjun ‘ᴗ, you guys will have a cameo appearance with you.
If you have any questions about this article, please leave a comment below or join the group [Group number: 708072830].
In view of limited personal experience, all views and technical research points, if you have any objection, please directly reply to participate in the discussion (no offensive comments, thank you);
Copyright notice: This article is the blogger’s original article, reprint please attach the original source link and this article statement, all rights reserved, piracy will investigate! (* ^ del ^ *).