十二、安装redis3.2

 2023-09-09 阅读 17 评论 0

摘要:安装 [root@boxiaoyuan boxiaoyuan]# docker pull redis:3.2 3.2: Pulling from redis2557373f5bdd: Pulling fs layer 7905a4b7e832: Pull complete 299490b78710: Pull complete a1577a76a447: Pull complete 5094fb6db209: Pull complete fcd252e0a9f2: Pull complete

安装

[root@boxiaoyuan boxiaoyuan]# docker pull redis:3.2
3.2: Pulling from redis2557373f5bdd: Pulling fs layer 
7905a4b7e832: Pull complete 
299490b78710: Pull complete 
a1577a76a447: Pull complete 
5094fb6db209: Pull complete 
fcd252e0a9f2: Pull complete 
479a363f72c9: Pull complete 
452d9d985c26: Pull complete 
0531c6664ced: Pull complete 
0817b34f5d76: Pull complete 
dd1b9a0ab5a8: Pull complete 
38ca84254b8b: Pull complete 
71f8d26b0d8e: Pull complete 
12277c2121f1: Pull complete 
9db68528a0cf: Pull complete 
2bf07517a9eb: Pull complete 
Digest: sha256:43d2f5e7338ef56b3bda52f1ba7b9b58866c07141e834f64267afb51c89e5086
Status: Downloaded newer image for redis:3.2

启动

[root@boxiaoyuan boxiaoyuan]# docker run -p 6379:6379 -v /boxiaoyuan/redis/data:/data -v /boxiaoyuan/redis/conf/redis.conf:/usr/local/etc/redis/redis.conf -d redis:3.2 redis-server /usr/local/etc/redis/redis.conf --appendonly yes 
0ec530ed2e6abb24df724086d6a45cb3eda24db8e72681bce0f61cfa1cce378b

--appendonly yes 表示是否开启持久化AOF

[root@boxiaoyuan boxiaoyuan]# docker ps
CONTAINER ID        IMAGE               COMMAND                CREATED             STATUS              PORTS                     NAMES
0ec530ed2e6a        redis:3.2           "docker-entrypoint.s   49 seconds ago      Up 49 seconds       0.0.0.0:6379->6379/tcp    tender_babbage      
32f015550d38        mysql:5.6           "docker-entrypoint.s   35 minutes ago      Up 35 minutes       0.0.0.0:12345->3306/tcp   boxiaoyuanmysql     
6654d40fd2f0        boxiaoyuantomcat9   "/bin/sh -c '/usr/lo   About an hour ago   Up About an hour    0.0.0.0:9080->8080/tcp    mytomcat9           
[root@boxiaoyuan boxiaoyuan]# 

连接

[root@boxiaoyuan boxiaoyuan]# docker exec -it 0ec530ed2e6a redis-cli
127.0.0.1:6379> set ke1 v1
OK
127.0.0.1:6379> set ke2 v2
OK
127.0.0.1:6379> set ke3 v3
OK
127.0.0.1:6379> shutdown 

查看持久化文件

[root@boxiaoyuan data]# pwd
/boxiaoyuan/redis/data
[root@boxiaoyuan data]# ls
appendonly.aof
[root@boxiaoyuan data]# cat appendonly.aof 
*2
$6
SELECT

转载于:https://www.cnblogs.com/zhuzhaoli/p/11180909.html

版权声明:本站所有资料均为网友推荐收集整理而来,仅供学习和研究交流使用。

原文链接:https://hbdhgg.com/5/31664.html

发表评论:

本站为非赢利网站,部分文章来源或改编自互联网及其他公众平台,主要目的在于分享信息,版权归原作者所有,内容仅供读者参考,如有侵权请联系我们删除!

Copyright © 2022 匯編語言學習筆記 Inc. 保留所有权利。

底部版权信息