We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docker pull redis
分别挂载redis配置文件 和 数据目录
mkdir -p ~/docker/redis/conf ~/docker/redis/data cd ~/docker/redis/conf
wget http://download.redis.io/redis-stable/redis.conf
chmod 777 redis.conf
vi ~/docker/redis/conf/redis.conf bind 127.0.0.1 # 这行要注释掉,解除本地连接限制 protected-mode no # 默认yes,如果设置为yes,则只允许在本机的回环连接,其他机器无法连接。 daemonize no # 默认no 为不守护进程模式,docker部署不需要改为yes,docker run -d本身就是后台启动,不然会冲突 requirepass 123456 # 设置密码 appendonly yes # 持久化
docker run --name redis \ -p 6379:6379 \ -v ~/docker/redis/conf/redis.conf:/etc/redis/redis.conf \ -v ~/docker/redis/data:/data \ --privileged=true \ -d redis redis-server /etc/redis/redis.conf --appendonly yes
说明: -p 6379:6379:端口映射,前面是宿主机,后面是容器。 –name redis:指定该容器名称。 -v 挂载文件或目录:前面是宿主机,后面是容器。 --privileged=true 设置权限 -d redis redis-server /etc/redis/redis.conf:表示后台启动redis,以配置文件启动redis,加载容器内的conf文件。 appendonly yes:开启redis 持久化。
The text was updated successfully, but these errors were encountered:
No branches or pull requests
服务部署--redis
安装redis镜像
创建挂载目录
分别挂载redis配置文件 和 数据目录
获取官方redis配置文件
配置权限
修改默认配置文件 最好用编辑器打开查询并修改对应配置项
启动redis容器
说明:
-p 6379:6379:端口映射,前面是宿主机,后面是容器。
–name redis:指定该容器名称。
-v 挂载文件或目录:前面是宿主机,后面是容器。
--privileged=true 设置权限
-d redis redis-server /etc/redis/redis.conf:表示后台启动redis,以配置文件启动redis,加载容器内的conf文件。
appendonly yes:开启redis 持久化。
The text was updated successfully, but these errors were encountered: