Notice: Constant WP_DEBUG already defined in /var/www/html/wordpress/wp-content/plugins/changyan/sohuchangyan.php on line 12

Notice: Constant WP_DEBUG_LOG already defined in /var/www/html/wordpress/wp-content/plugins/changyan/sohuchangyan.php on line 13

Notice: Constant WP_DEBUG_DISPLAY already defined in /var/www/html/wordpress/wp-content/plugins/changyan/sohuchangyan.php on line 14
Docker 虚拟机之 Redis【zoues.com】 – zoues

LOADING

Follow me

Docker 虚拟机之 Redis【zoues.com】
六月 10, 2017|DockerPaaS

Docker 虚拟机之 Redis【zoues.com】

Docker 虚拟机之 Redis【zoues.com】

本文节选自《Netkiller Virtualization 手札》

1.9.2. Redis

1.9.2.1. 获取 Redis 镜像

docker pull redis

  # docker pull redis   Using default tag: latest latest: Pulling from library/redis 10a267c67f42: Pull complete  5b690bc4eaa6: Pull complete  4cdd94354d2a: Pull complete  71c1f30d820f: Pull complete  c54584150374: Pull complete  d1f9221193a6: Pull complete  d45bc46b48e4: Pull complete  Digest: sha256:548a75066f3f280eb017a6ccda34c561ccf4f25459ef8e36d6ea582b6af1decf Status: Downloaded newer image for redis:latest     

1.9.2.2. 启动一个 Redis 实例

# docker run --name my-redis -d redis 10207174e18f61290f9c869e6437fa787e459e07b076b82cedf800a8c37c515d     

查看启动情况

  # docker ps  CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS               NAMES 10207174e18f        redis               "docker-entrypoint..."   8 minutes ago       Up 8 minutes        6379/tcp            my-redis     

1.9.2.3. 进入 Redis

  # docker run -it --link my-redis:redis --rm redis redis-cli -h redis -p 6379 redis:6379> set name neo OK redis:6379> get name "neo" redis:6379> exit       

1.9.2.4. 启动一个 Redis 实例并映射 6379 端口

  # docker rm my-redis my-redis  # docker stop my-redis my-redis  # docker run --name my-redis -d -p 6379:6379 redis 10207174e18f61290f9c869e6437fa787e459e07b076b82cedf800a8c37c515d  # docker ps -a                                     CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES 1c4540d8617f        redis               "docker-entrypoint..."   2 seconds ago       Up 1 second         0.0.0.0:6379->6379/tcp   my-redis     

检查端口

  # ss -lnt | grep 6379 LISTEN     0      128         :::6379                    :::*        

1.9.2.5. 维护容器

使用下面命令进入容器维护 Redis

  # docker exec -it my-redis /bin/bash root@1c4540d8617f:/data#

Donations (打赏)

We accept PayPal through:

https://www.paypal.me/netkiller

Wechat (微信) / Alipay (支付宝) 打赏:

http://www.netkiller.cn/home/donations.html

作者相关文章:

Spring boot with HTTPS SSL

Spring boot with Git version

Oracle 表空间管理

数据加密字段加密

《Netkiller Virtualization 手札》Docker 卷管理

PHP高级编程之守护进程

Spring boot with Docker

Spring boot with Service

Spring boot with PostgreSQL

Struts2 S2-046, S2-045 Firewall(漏洞防火墙)

应用程序的通信成本

攻城狮的自我营销

压力测试中存在的问题

数据库与图片完美解决方案

数据库进程间通信解决方案

数据库进程间通信解决方案之MQ

Linux 系统安全与优化配置

Tomcat 安全配置与性能优化

PHP 安全与性能

Linux 系统与数据库安全

运维必备技能 WEB 日志分析


转载请注明出处与作者声明,扫描二维码关注作者公众好,不定期更新文章

Docker 虚拟机之 Redis

no comments
Share