当前位置:网站首页>Docker部署redis单机版本 - 修改redis密码和持久化方式
Docker部署redis单机版本 - 修改redis密码和持久化方式
2022-07-27 05:11:00 【超多多和刘宝宝的代码世界】
前言
之前部署过几次redis,都是直接把它拉下来然后直接启动,并没有设置太多的属性。后来部署过一个设置过的,但是第二次部署就忘了具体的流程了,这次下定决心记录一下。
一、拉redis镜像文件
无脑拉最新版本 :docker pull redis
二、如果进行文件和目录的挂载
1.创建文件夹
我们将/data/redis文件路径作为redis的挂载目录
那么就先创建这个文件夹: mkdirs /data/redis/
2.使用配置文件启动
不能在挂载目录没有这个文件时直接对文件进行挂载,所以必须要提前有这个文件
1 先启动一次redis
从启动的这次redis中把这个conf文件复制出来
2 从网上下载一个conf文件
http://www.redis.cn/download.html
3 修改conf配置文件
1.将bind 127.0.0.1 注释掉,让redis可以外部访问
2.protected-mode yes 注释掉
3.requirepass 123456 设置密码
还可以设置持久化方式等属性,自己百度
4 启动redis
docker run -p 6379:6379 --name redis -v /data/redis/redis.conf:/etc/redis/redis.conf -v /data/redis/data:/data -d redis redis-server /etc/redis/redis.conf --appendonly yes
挂载配置文件和data目录,并使用redis.conf文件启动,appendonly为redis持久化
总结
多记录才能更快解决问题
边栏推荐
猜你喜欢
随机推荐
Usage and differences among let, const and VaR
How to open a general commodity futures account
选择正规的资质好的期货公司开户
Web2.0的巨头纷纷布局VC,Tiger DAO VC或成抵达Web3捷径
User login - and create and verify SMS verification code
Which futures company has a low handling fee and a high refund?
洛谷陶陶摘苹果
Ubuntu:安装PostgreSQL
Self understanding and thinking
Personal collection code cannot be used for business collection
Dimitra 和 Ocean Protocol 解读农业数据背后的秘密
Project login and registration ideas
期货公司开户的具体事项
刷脸支付用户主要优势是智能化程度高
Okaleido上线聚变Mining模式,OKA通证当下产出的唯一方式
页面的配置
机器人编程与交叉学科的融合延伸
怎样才能拿到期货开户最低的手续费?
Department management of cloud e-office projects
维持登录,路由跳转









