当前位置:网站首页>Redis database, which can be understood by zero foundation Xiaobai, is easy to learn and use!
Redis database, which can be understood by zero foundation Xiaobai, is easy to learn and use!
2022-07-26 11:47:00 【Wu_ Candy】
Preface
Redis(Remote Dictionary Server ), Remote dictionary service , Is an open source use ANSI C Language writing 、 Support network 、 Log type that can be memory based or persistent 、Key-Value database , And provide multilingual API.
Redis Is a high-performance key-value database . To ensure efficiency , The data is cached in memory .
Redis Periodically, updated data is written to disk or changes are written to an appended log file , And on this basis to achieve master-slave( Master-slave ) Sync .
—— Excerpt from : Baidu Encyclopedia
Installation steps
1. Download the source code
# Carry out orders :
wget http://download.redis.io/releases/redis-7.0.3.tar.gz
2. Decompress the source code
# Carry out orders :
tar -zxvf redis-7.0.3.tar.gz
3. Go to unzip directory
# Carry out orders :
cd redis-7.0.3
4. compile Redis
# Carry out orders :
make install
Be careful :
make After the command is executed and compiled , Will be in src Generate under directory 6 Executable files , Namely :
redis-server redis-cli redis-benchmark redis-check-aof redis-check-rdb redis-sentinel
5. take redis-server Put it in the specified directory
After compilation redis-server I put the file locally /Users/tools/redis-7.0.3/src In the catalog
Because in utils In the catalog redis_init_script Configured in the file redis-server The path is :/usr/local/bin/redis-server

Use the following command to redis-server Copy to the specified directory
cp /Users/tools/redis-7.0.3/src/redis-server /usr/local/bin
View version
1. see redis-server edition
redis-server --version

The above prompt message indicates that the configuration is successful
2. see redis-cli edition
redis-cli --version

The above prompt message indicates that the configuration is successful
start-up Redis The server
1. Start command
(1).redis-server --requirepass 123456 --port 1234 > redis.log &
(2).redis-server Profile path > redis.log &
2. Parameter interpretation
--requirepass 123456: Add connection authentication password 123456
--port 1234: Start the service at 1234 port , Do not use the default port 6379
> redis.log: Write the startup log redis.log In file , Do not output directly to the current screen
&: Put the service in the background
3. View running processes
jobs |grep Running

4. Be careful
Specify the port number or use the default port number 6379 front , First use netstat -a |grep 6379 Command to check whether the port is occupied , It can only be used if it is not occupied
When the use port is occupied , Start up redis-server During service, the log will give the following error prompt , Here we use 6379 The port is occupied as an example

start-up Redis client
# Connect locally initiated redis service
(1).redis-cli
(2).redis-cli -h host IP Address -p port

Start up redis-server The service , The order I used was : redis-server --requirepass 123456 > redis.log &
So when connecting redis Authentication password is required for service , Use command : auth 123456 Carriage return certification , If the password authentication is successful OK A hint of , As shown in the above figure redis Service connection successful
1. Store key value pairs
# Carry out orders :
set username candy
2. Read Key
# Carry out orders :
get username

3. Set timeout
# Deposit key:username,value:Tony The key value pair of is valid for 30 second
set username Tony ex 30
4. Check the key value lifetime
# Carry out orders :username- Key value
ttl username

The content shared today is quite basic , Be friendly to novices or little friends with little experience , We will continue to update about Redis Related articles of
边栏推荐
- Pytorch——基于mmseg/mmdet训练报错:RuntimeError: Expected to have finished reduction in the prior iteration
- ESP8266-Arduino编程实例-开发环境搭建(基于Arduino IDE)
- 3dunity game project actual combat - aircraft war
- Server memory failure prediction can actually do this!
- 外包干了四年,废了...
- 【云驻共创】为了写好代码,你坚持了哪些好习惯?
- System call capture and segmentation - RING3 layer LD_ Preload mechanism for library function hijacking
- 4.1 配置Mysql与注册登录模块
- 你敢信?开发一个管理系统我只用了两天时间
- Hashtable
猜你喜欢

MySQL deadlock analysis

剑指 Offer 25. 合并两个排序的链表

测试用例千万不能随便,记录由一个测试用例异常引起的思考

QT——LCDNumber

The latest heart-shaped puzzle applet source code + with flow master

Pyechart offline deployment

如何使用数据管道实现测试现代化

Meiker Studio - Huawei 14 day Hongmeng equipment development practical notes 8

Acwing727.菱形图案

Data visualization - White Snake 2: black snake robbery (2)
随机推荐
js使用WebUploader做大文件的分块和断点续传
程序员成长第二十八篇:管理者如何才能不亲力亲为?
3.1 创建菜单与游戏页面——上
MICCAI2022论文 | 进化多目标架构搜索框架:在COVID-19三维CT分类中的应用
你敢信?开发一个管理系统我只用了两天时间
沟通中经常用到的几个库存术语
Modeling essay series 150 SCLC engineering experiment 3-srule
【附下载】一款强大的Web自动化漏洞扫描工具——Xray
Esp8266 Arduino programming example - development environment construction (based on platformio)
Rigorous proof of Behrman's expectation equation
GA-RPN:引导锚点的建议区域网络
。。。。。。
浅谈Web Vitals
系统调用捕获和分析完结篇制作系统调用日志收集系统
FINEOS宣布2022年GroupTech Connect活动开放注册
武林头条-建站小能手争霸赛
【通信原理】第三章 -- 随机过程[上]
。。。。。。
System call capture and analysis conclusion making system call log collection system
An error occurred in the scrapy shell