当前位置:网站首页>Redis (II) - redis installation instructions
Redis (II) - redis installation instructions
2022-07-21 21:12:00 【Super_ Leng】
Redis Installation instructions
Most enterprises are based on Linux Server to deploy the project , and Redis The official did not provide Windows Version of the installation package (Windows Version provided by Microsoft ). So the next step is based on Linux System to install Redis.
Selected here Linux Version is CentOS 7.
Redis The official website address of :https://redis.io/
1. Stand alone installation Redis
1.1. install Redis rely on
Redis Is based on C language-written , So first you need to install Redis The required gcc rely on :
yum install -y gcc tcl
1.2. Upload the installation package and unzip it
And then Redis Upload the installation package to any directory of the virtual machine :
for example , I put it /usr/local/src Catalog :
If the directory cannot upload files , You can modify permissions :
chmod a+w /usr/local/src/
decompression :
tar -xzf redis-6.2.6.tar.gz
After decompressing :
Get into redis Catalog :
cd redis-6.2.6
Run the compile command :
make && make install
If there is no error , The installation should be successful .
The default installation path is /usr/local/bin
Under the table of contents :
The directory has been configured to the environment variable by default , Therefore, you can run these commands in any directory . among :
- redis-cli: yes redis The command line client provided
- redis-server: yes redis Server startup script
- redis-sentinel: yes redis Sentinel startup script
1.3. start-up
redis There are many ways to start , for example :
- The default startup
- Specify the configuration to start
- Boot from boot
1.3.1. The default startup
After installation , Enter... In any directory redis-server Command to start Redis:
redis-server
Pictured :
This startup belongs to The front desk starts
, Will block the entire session window , Close the window or press CTRL + C
be Redis stop it . It is not recommended to use .
1.3.2. Specify the configuration to start
If you want to make Redis With backstage
Mode start , You have to modify Redis The configuration file , Just before we unzipped redis Under the installation package (/usr/local/src/redis-6.2.6
), Name is redis.conf:
Let's back up this configuration file first :
cp redis.conf redis.conf.bck
And then modify redis.conf Some configurations in the file :
vi redis.conf
After entering , Input /bind Rapid positioning bind The location of
Press i key Enter edit mode
After editing , Press ESC Post key , Input again :wq Save and exit
# Listening address , The default is 127.0.0.1, Will result in local access only . It is amended as follows 0.0.0.0 It can be in any IP visit , The production environment should not be set to 0.0.0.0
bind 0.0.0.0
# Daemon , It is amended as follows yes After, it can run in the background
daemonize yes
# password , Access after setting Redis You must enter a password
requirepass 123321
Redis Other common configurations :
# Listening port
port 6379
# working directory , The default is the current directory , Which is running redis-server When the command , journal 、 Files such as persistence will be saved in this directory
dir .
# Number of databases , Set to 1, Stands for using only 1 Databases , The default is 16 Databases , Number 0~15
databases 1
# Set up redis Maximum memory available
maxmemory 512mb
# Log files , The default is empty. , Do not log , You can specify the log file name
logfile "redis.log"
start-up Redis:
# Get into redis The installation directory
cd /usr/local/src/redis-6.2.6
# start-up
redis-server redis.conf
# see Redis process
ps -ef | grep redis
# kill -9 process id, Kill process
Out of Service :
# utilize redis-cli To execute shutdown command , Just stop Redis service ,
# Because the password was configured before , So it needs to pass -u To specify the password
redis-cli -u 123321 shutdown
1.3.3. Boot from boot
We can also realize self startup through configuration .
First , Create a new system service file :
vi /etc/systemd/system/redis.service
The contents are as follows :
[Unit]
Description=redis-server
After=network.target
[Service]
Type=forking
ExecStart=/usr/local/bin/redis-server /usr/local/src/redis-6.2.6/redis.conf
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Then reload the system services :
systemctl daemon-reload
Now? , We can use the following set of commands to operate redis 了 :
# start-up
systemctl start redis
# stop it
systemctl stop redis
# restart
systemctl restart redis
# Check the status
systemctl status redis
Execute the following command , It can make redis Boot from boot :
systemctl enable redis
2.Redis client
installation is complete Redis, We can operate Redis, To achieve data CRUD 了 . It needs to use Redis client , Include :
- Command line client
- Graphical desktop client
- Programming client
2.1.Redis Command line client
Redis After the installation is completed, the command-line client comes with it :redis-cli, Use as follows :
redis-cli [options] [commonds]
One of the common ones is options Yes :
-h 127.0.0.1
: Specify the... To connect to redis Node IP Address , The default is 127.0.0.1-p 6379
: Specify the... To connect to redis Port of node , The default is 6379-a 123321
: Appoint redis Access code for
Among them commonds Namely Redis Operation command of , for example :
- redis-cli -a Input password
ping
: And redis The server does a heartbeat test , The server will normally returnpong
Don't specify commond when , Will enter redis-cli
Interactive console :
- First use redis-cli Access control
- Enter after entering auth + password
2.2. Graphical desktop client
GitHub The great God of wrote Redis Graphical desktop client , Address :https://github.com/uglide/RedisDesktopManager
But the warehouse provides RedisDesktopManager Source code , Not provided windows Installation package .
The installation package can be found in the following warehouse :https://github.com/lework/RedisDesktopManager-Windows/releases
2.2.1. install
After decompression , Run the installer to install :
Here slightly .
After installation , Found in the installation directory rdm.exe file :
Double click to run :
2.2.2. Establishing a connection
Click on the top left Connect to Redis The server
Button :
Fill in the pop-up window Redis Service information :
Click OK , This link will appear in the left menu :
Click to establish a connection :
Redis The default is 16 A warehouse , Number from 0 to 15. The number of warehouses can be set through the configuration file , But no more than 16, And you can't customize the warehouse name .
If it is based on redis-cli Connect Redis service , Can pass select Command to select the database :
# choice 0 Signal library
select 0
边栏推荐
- 浅析 SQL Server 的 CROSS APPLY 和 OUTER APPLY 查询 - 第一部分
- 并发编程(二十八) - LongAdder原理
- How to match multiple point clouds step by step
- 浅谈 | 嵌套连接
- Cannot convert from "boost:: shared\u PTR < pcl:: rangeimage >" to "const std:: shared\u PTR < const pcl:: pointcloud < pcl:: pointwit"
- Peoplecode 运算符
- 上榜 | Navicat 入选信通院发布《全球数据库产业图谱》
- peoplecode 根据上下文引用来赋值
- Sushimaker and sushibar interpretation of sushiswap
- C language 2022 Shanxi upgraded C language knowledge points
猜你喜欢
Oracle 连接表
MetaForce原力元宇宙之我見,教你迅速搞懂滑落機制
Compile and run typescript with vscode plug-in coderunner. When the output has Chinese, there is garbled code
基于双数组实现Set功能(基于Solidity)
peoplecode 对象和类
yum check 时报错libmysqlclient.so.18()(64bit)
[epidemic analysis -- data collection]
[authority promotion] search ideas and utilization methods of raising rights exp
浅析 SQL Server 的 CROSS APPLY 和 OUTER APPLY 查询 - 第二部分
SQL 汇总数据
随机推荐
MetaForce原力元宇宙之我见,教你迅速搞懂滑落机制
Find the least common multiple
使用 MySQL 慢速查询日志
CentOS 7 如何使用rpm安装单节点的MySQL
Segmentation based on normal differentiation
Concurrent programming (XXXI) - principle of reetrantreadwritelock
浅析 SQL Server 的 CROSS APPLY 和 OUTER APPLY 查询 - 第一部分
C language 2022 Shanxi upgraded C language knowledge points
并发编程(三十) - ThreadLocal 原理与实践
易语言学习笔记(四)--js解密,图形验证码,滑块,鱼刺多线程
Concurrent programming (30) - ThreadLocal principle and Practice
并发编程(十九)-JUC之AQS
佛萨奇2.0-Metaforce原力链上操作抢跑教程
String reverse order (detailed)
易语言学习笔记(一)
[authority promotion] search ideas and utilization methods of raising rights exp
SQL 汇总数据
投票 | 选出您希望Navicat支持的数据库
peoplecode 对象和类
Fossage 2.0 yuan universe - what kind of spark will classical matrix plus NFT erase?