惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
F
Fortinet All Blogs
Blog — PlanetScale
Blog — PlanetScale
GbyAI
GbyAI
MongoDB | Blog
MongoDB | Blog
月光博客
月光博客
The Cloudflare Blog
量子位
T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
B
Blog
MyScale Blog
MyScale Blog
T
The Blog of Author Tim Ferriss
The GitHub Blog
The GitHub Blog
G
Google Developers Blog
D
DataBreaches.Net
V
Visual Studio Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Last Week in AI
Last Week in AI
U
Unit 42
博客园 - 聂微东
有赞技术团队
有赞技术团队
A
About on SuperTechFans

博客园 - 笨功夫才是真功夫

TortoiseSVN实现excel文件差异比对(集成ExcelMerge)[转] git仓库迁移 centos7.6 nginx配置ssl证书 在Debian12上安装mysql 8.0 Mysql8.0设置大小写不敏感解决方案[转] debian下常见问题 vue开发环境搭建 bash脚本的输入参数解析 python常用脚本 mysql数据库备份脚本 docker环境下安装RabbitMQ Linux系统设置开机启动(草稿) 在Windows10部署kibana Elasticsearch监控 Flink cdc实践(陆续更新) 在windows下安装mysql 8.1 VMware虚拟机开机自动启动 停止windows10的系统更新 elasticsearch安装-集群 elasticsearch安装-单实例
redis安装和运维
笨功夫才是真功夫 · 2024-03-11 · via 博客园 - 笨功夫才是真功夫

一 安装

1 安装redis单例

操作系统:debian 12

1.1 在linux中安装

# 直接安装, 开机自启动
apt install redis-server

# 检查安装情况
systemctl status redis-server

systemctl start redis-server   # 启动
systemctl stop redis-server    # 停止
systemctl restart redis-server # 重启
# 检查是否已经设置开机自动启动
systemctl is-enabled redis-server  
systemctl enable  redis-server     # 设置为开机自动启动
systemctl disable redis-server     # 禁止开机自动启动



# 配置远程访问
vim /etc/redis/redis.conf
#a 注释
bind 127.0.0.1 ::1
#b 修改保护模式为no
protected-mode no
# 重新redis
systemctl restart redis-server

#在其他电脑上验证连通性
telnet xxx 6379

卸载

直接使用apt卸载

apt purge --auto-remove redis-server

手动删除redis命令和配置文件:

 whereis redis-server

 whereis redis-cli

 rm /usr/bin/redis-*
 rm -rf /etc/redis/
 rm -rf /var/log/redis/
 rm -rf /var/log/redis/
 rm -rf /var/lib/redis/
 rm /etc/init.d/redis-server

1.2 在docker中安装

# 拉镜像
docker pull redis:6.2.6

# 下载redis.conf文件, 注意需匹配版本
# 本地新建目录/dockerapp/redis/conf|data|logs
# 运行容器
docker run --restart=always --hostname redis01 --name redis6.2.6 \
        -p 6379:6379 \
        -v /dockerapp/redis/conf/redis.conf:/etc/redis/redis.conf \
        -v /dockerapp/redis/data:/data \
        -v /dockerapp/redis/logs:/logs \
        -d redis:6.2.6 redis-server /etc/redis/redis.conf
# 检查容器情况
docker ps
docker exec -it xxxxxx /bin/bash

# 检查挂在目录的情况
ls /dockerapp/redis/data

#在其他电脑上验证连通性
telnet xxx 6379