【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来访问控制台

相关推荐
心灵宝贝1 小时前
Mac 桌面动态壁纸软件|Live Wallpaper 4K Pro v19.7 安装包使用教程(附安装包)
macos
爬山算法4 小时前
Redis(66)Redis如何实现分布式锁?
数据库·redis·分布式
缘的猿4 小时前
Docker 与 K8s 网络模型全解析
docker·容器·kubernetes
恋红尘5 小时前
Redis面试八股
数据库·redis·面试
运维栈记5 小时前
使用Grafana监控K8S中的异常Pod
docker·kubernetes·grafana
东城绝神7 小时前
《Linux运维总结:基于X86_64+ARM64架构CPU使用docker-compose一键离线部署consul 1.21.5容器版集群》
linux·运维·docker·架构·consul
小醉你真好8 小时前
17、Centos9 安装 1Panel
linux·docker·运维开发
William.csj9 小时前
Mac——文件夹压缩的简便方法
macos
北冥有鱼被烹9 小时前
【问题】Mac 的 Finder 中没有桌面选项如何处理?(访达 -> 设置 -> 边栏 -> 勾选桌面)
macos
阿维的博客日记9 小时前
Redis学习笔记-QuickList
redis·笔记·学习