当前位置:网站首页>Redis安装部署(Windows/Linux)
Redis安装部署(Windows/Linux)
2022-07-02 06:32:00 【Axi-ZYTao】
Redis安装部署(Windows/Linux)
一、Windows安装
1、安装前准备
(1)准备好redis安装包,解压好,
(2)将解压后绝对路径添加环境变量,系统变量path中。
2、启动服务端服务
双击安装路径下的redis-server.exe文件并保持该窗口开启(不要关闭)
3、启动客户端连接服务器
双击安装目录下的redis-cli.exe文件,执行ping命令,下行出现"PONG"则连接成功。
4、部署Redis服务
在安装目录下打开命令提示符,执行以下命令。(注:即使配置了系统环境变量,此命令仍需在Redis安装目录下执行,否则找不到redis.windows.conf文件就会报错;配置文件参数可以是redis.windows.conf,也可以是redis.windows-service.conf,此处执行哪个参数,后续redis配置文件就修改对应文件)
redis-server.exe --service-install redis.windows.conf --loglevel verbose
出现Redis sucessfully installed as a service则Redis服务安装成功,可打开任务管理器查看。
修改配置文件redis-windows.conf中连接数据库的密码;
5、测试服务
启动服务端服务,打开客服端,测试服务;
客户端测试,双击打开redis-cli.exe,输入ping验证cmd中使用以下命令验证:
redis-cli.exe -h 127.0.0.1 -p 6379 -a requirepass
注意:-h 服务器地址 -p 指定端口号 -a 在配置文件中设置的连接数据库的密码,默认无密码,可在redis-windows.conf中配置
能连接进去,说明测试成功。
6、桌面端管理工具
免费版桌面工具下载地址:https://github.com/qishibo/AnotherRedisDesktopManager/releases
登录连接后显示如下图:
二、Linux安装
1、安装前准备
linux先安装wget
yum -y install wget
2、下载并安装redis
# 进入安装系统路径
# cd /usr/local
# 创建下载redis安装包的目录
# mkdir soft
# 进入创建好的目录路径
# cd /usr/local/soft
# 在线下载redis安装包
# wget http://download.redis.io/releases/redis-5.0.7.tar.gz
# 解压redis安装包
# tar -zxvf redis-5.0.7.tar.gz
# 进入解压后的redis安装包
# cd redis-5.0.7
编译运行环境(会加载一些东西,比较慢)
# make
把redis安装目录下的src文件中这六个绿色的文件复制到/usr/local/bin路径下;
redis-server //启动服务
redis-benchmark //测试性能
redis-check-aof //检查aof持久化文件
redis-sentinel
redis-cli //客户端
同时,把redis.conf配置文件也复制到路径/usr/local/bin,共有以下几个文件
3、修改启动的配置文件
Redis默认不会后台启动,修改配置文件
# 编辑配置文件
# vi /usr/local/bin/redis.conf
# :set nu (显示行数,或者:set number)
#在redis.conf第136行附近,将daemonize 改为yes
启动redis并查进程
# redis-server redis.conf
# ps -ef | grep redis
4、启动客户端,端口6379
# redis-cli -p 6379
测试是否连接成功,输入ping,出现pong说明连接成功
新开一个窗口,查看进程,客户端启动成功
5、正式关闭redis服务
在redis-cli中
# shutdown (关闭服务)
# exit (会显示未连接,然后exit退出)
查询redis进程,没有了就是以及关闭成功了
6、卸载redis
关闭redis-server服务,关闭redis-cli服务
删除与redis安装有关的文件(可用locate或者find查找)
# rm -rf /usr/local/bin/redis-*
# rm -rf /usr/local/redis
边栏推荐
猜你喜欢
Luogu greedy part of the backpack line segment covers the queue to receive water
Linux安装Oracle Database 19c RAC
Openshift container platform community okd 4.10.0 deployment
QT -- how to set shadow effect in QWidget
Solid principle: explanation and examples
Minecraft插件服开服
Nacos 下载启动、配置 MySQL 数据库
MYSQL安装出现问题(The service already exists)
Function ‘ngram‘ is not defined
HCIA—應用層
随机推荐
Webflux responsive programming
Loadbalancer dynamically refreshes Nacos server
kubernetes部署loki日志系统
统计字符串中各类字符的个数
[blackmail virus data recovery] suffix Hydra blackmail virus
Viewing JS array through V8
sqli-labs第1关
Tcp/ip - transport layer
寻找链表中值域最小的节点并移到链表的最前面
Honeypot attack and defense drill landing application scheme
Kubernetes deploys Loki logging system
Select sort and insert sort
Sentinel easy to use
Qt的右键菜单
Sqli labs level 8 (Boolean blind note)
Gateway 简单使用
Illegal use of crawlers, an Internet company was terminated, the police came to the door, and 23 people were taken away
Makefile Fundamentals
Pointer initialization
sqli-labs第8关(布尔盲注)