当前位置:网站首页>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
边栏推荐
- [error reported]exception: found duplicate column (s) in the data schema: `value`;
- 数据中台建设(二):数据中台简单介绍
- 702 horsepower breaks through 100 in only 4.5 seconds! The strongest pickup truck comes, safe and comfortable
- Integrity constraints of SQL Server database
- 3dunity game project actual combat - aircraft war
- Pyechart离线部署
- Back to the top of several options (JS)
- 五万美元的年薪是如何花光的
- 打造绿色数据中心,Colt DCS 是认真的!
- 【附下载】一款强大的Web自动化漏洞扫描工具——Xray
猜你喜欢

Record errors encountered by individuals

Summary of common cmake commands

Leetcode / Scala - sum of two numbers, three numbers, four numbers, and N numbers

swagger2.9.2教程 与swagger3.0.0教程

征婚故事

【附下载】一款强大的Web自动化漏洞扫描工具——Xray

X 2 Earn必须依靠旁氏启动?Gamefi的出路在哪?(上)

Mlx90640 infrared thermal imager temperature sensor module development notes (6)
![[idea] how to create a new project](/img/33/f210d59ccd3664487f401929dac24c.png)
[idea] how to create a new project

Harbor2.2 用户角色权限速查
随机推荐
Data Lake (19): SQL API reads Kafka data and writes it to iceberg table in real time
Query advanced alias
Practice of microservice in solving Library Download business problems
你敢信?开发一个管理系统我只用了两天时间
Creation and modification of basic tables and data in them by SQL statements of SQL Server
10 reduce common "tricks"
元宇宙GameFi链游系统开发NFT技术
Win10 uses NVM to install node, NPM, and cnpm
Cmake常用命令总结
Hashtable
线上一个隐匿 Bug 的复盘
Esp8266 Arduino programming example - know esp8266
QT——LCDNumber
Caused by: scala. MatchError: None (of class scala.None$)
Exploration on cache design optimization of community like business
Pyechart offline deployment
【附下载】一款强大的Web自动化漏洞扫描工具——Xray
JS use webuploader to do blocking and breakpoint continuation of large files
测试用例千万不能随便,记录由一个测试用例异常引起的思考
社区点赞业务缓存设计优化探索