【Mac开发环境搭建】Docker安装Redis、Nacos

文章目录

Dokcer安装Redis

拉取镜像

Bash 复制代码
docker pull redis

创建配置文件

XML 复制代码
# bind 127.0.0.1 -::1
bind 0.0.0.0 

# 是否启用保护模式
protected-mode no

# redis端口
port 6379

# 密码设置(需要密码就取消下面的注释)
# requirepass root12345678

tcp-backlog 511

# 用户多少秒没有操作就断开连接,设置为0为不断开
timeout 0

# 后端连接会经常断开,设置为60不断开
tcp-keepalive 60

# 是否以守护线程的方式运行
daemonize no

pidfile /var/run/redis_6379.pid

loglevel notice

logfile ""

databases 16

always-show-logo no

set-proc-title yes

proc-title-template "{title} {listen-addr} {server-mode}"

# 将数据持久化到dump.rdb的频率
 save 3600 1
 save 300 100
 save 60 10000

stop-writes-on-bgsave-error yes

rdbcompression yes

rdbchecksum yes

dbfilename dump.rdb

rdb-del-sync-files no

dir ./

replica-serve-stale-data yes

replica-read-only yes

repl-diskless-sync no

repl-diskless-sync-delay 5

repl-diskless-load disabled

repl-disable-tcp-nodelay no

replica-priority 100

acllog-max-len 128

lazyfree-lazy-eviction no
lazyfree-lazy-expire no
lazyfree-lazy-server-del no
replica-lazy-flush no

lazyfree-lazy-user-del no

lazyfree-lazy-user-flush no

oom-score-adj no

oom-score-adj-values 0 200 800

disable-thp yes

# 是否需要持久化存储
appendonly yes
appendfilename "appendonly.aof"
appendfsync everysec

no-appendfsync-on-rewrite no

auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 64mb

aof-load-truncated yes

aof-use-rdb-preamble yes

lua-time-limit 5000


slowlog-log-slower-than 10000

slowlog-max-len 128

latency-monitor-threshold 0

notify-keyspace-events ""

list-max-ziplist-size -2

list-compress-depth 0

set-max-intset-entries 512

zset-max-ziplist-entries 128
zset-max-ziplist-value 64

hll-sparse-max-bytes 3000

stream-node-max-bytes 4096
stream-node-max-entries 100

activerehashing yes

client-output-buffer-limit normal 0 0 0
client-output-buffer-limit replica 256mb 64mb 60
client-output-buffer-limit pubsub 32mb 8mb 60

hz 10

dynamic-hz yes

rdb-save-incremental-fsync yes

jemalloc-bg-thread yes

创建容器

Bash 复制代码
docker run -p 6379:6379 --name redis \
-v /Users/mac/Dev/DockerData/Redis/data:/data \
-v /Users/mac/Dev/DockerData/Redis/conf/redis.conf:/etc/redis/redis.conf \
-d redis redis-server /etc/redis/redis.conf

连接测试

Redis连接工具[Quick Redis]

下载链接:https://www.quick123.net/

设置Redis自启动

如果想要启动Docker就自动启动Redis容器,可以在命令中运行如下命令

Bash 复制代码
 docker update redis --restart=always

Docker安装Nacos

Bash 复制代码
docker run \
-d -p 8848:8848 \
-p 9848:9848 \
--name nacos \
-e MODE=standalone \
-e TIME_ZONE='Asia/Shanghai' \
nacos/nacos-server:v2.1.2

启动成功之后,可以通过http://localhost:8848/nacos/index.html来访问控制台

相关推荐
Overt0p2 分钟前
抽奖系统(6)
java·spring boot·redis·设计模式·rabbitmq·状态模式
纯洁的小魔鬼4 分钟前
Dockerfile 指令
docker·镜像·dockerfile
乐观主义现代人16 分钟前
redis 源码学习笔记
redis·笔记·学习
释怀不想释怀21 分钟前
Docker(安装软件)
运维·docker·容器
jmxwzy34 分钟前
Redis
数据库·redis·缓存
零叹36 分钟前
Redis热Key——大厂是怎么解决的
数据库·redis·缓存·热key
王五周八37 分钟前
基于 Redis+Redisson 实现分布式高可用编码生成器
数据库·redis·分布式
win x39 分钟前
Redis事务
数据库·redis·缓存
超龄超能程序猿1 小时前
Docker常用中间件部署笔记:MongoDB、Redis、MySQL、Tomcat快速搭建
笔记·docker·中间件
奔波霸的伶俐虫1 小时前
windows docker desktop 安装修改镜像学习
学习·docker·容器