In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/02 Report--
Reference: docker official redis documentation
1. For those with special version requirements, you can view the tag version of redis image.
3.2.11,3.2,3 (3.2/Dockerfile) 3.2.11-32bit, 3.2-32bit, 3-32bit (3.2/32bit/Dockerfile) 3.2.11-alpine, 3.2-alpine, 3-alpine (3.2/alpine/Dockerfile) 4.0.9,4.0,4, latest (4.0/Dockerfile) 4.0.9-32bit, 4.0-32bit, 4-32bit, 32bit (4.0/32bit/Dockerfile) 4.0.9-alpine, 4.0-alpine 4-alpine, alpine (4.0/alpine/Dockerfile)
two。 Select the latest version of latest
Docker pull redis:latest [root@localhost~] # docker pull redis:latestlatest: Pulling from library/redis4d0d76e05f3c: Pull complete cfbf30a55ec9: Pull complete 82648e31640d: Pull complete fb7ace35d550: Pull complete 497bf119bebf: Pull complete 89340f6074da: Pull complete Digest: sha256:166788713c58c2db31c41de82bbe133560304c16c70e53a53ca3cfcf35467d8aStatus: Downloaded newer image for redis:latest
3. Start the container with a password
Docker run-- name redis-test-p 6379Viru 6379-d-- restart=always redis:latest redis-server-- appendonly yes-- requirepass "your passwd"
-p 6379VR 6379: map the port in the container to the host port (right to left)
Redis-server-appendonly yes: execute the redis-server startup command in the container and open the redis persistent configuration
Requirepass "your passwd": set authentication password
-restart=always: starts with docker startup
4. View the container
Docker ps [root@localhost~] # docker psCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMESa126ec987cfe redis:latest "docker-entrypoint.s …" 4 minutes ago Up 4 minutes 0.0.0.0 days ago Up 6379-> 6379/tcp redis-test3645da72ece6 portainer/portainer "/ portainer" 7 days ago Up 7 days 0.0.0.0 days ago Up 9000-> 9000/tcp sharp_lovelace118ba79de20a hwdsl2/ipsec-vpn-server "/ opt/src/run.sh" 12 days ago Up 12 days 0.0.0.0 6379/tcp redis-test3645da72ece6 portainer/portainer 500-> 500/udp 0.0.0.0 days ago Up 4500-> 4500/udp l2tp-vpn-server848fdba6de60 kylemanna/openvpn "ovpn_run" 12 days ago Up 12 days 1194/udp, 0.0.0.0 days ago Up 1194-> 1194/tcp openvpna273504f9646 mysql:5.6.38 "docker-entrypoint.s …" 8 weeks ago Up 5 days 0.0.0.03306/tcp mysql5.6.38 3306-> 3306/tcp mysql5.6.38
The id of the redis container is a126ec987cfe
5. View the process
Ps-ef | grep redis [root@localhost~] # ps-ef | grep redispolkitd 26547 26535 0 14:58? 00:00:00 redis-server *: 6379root 26610 26432 0 15:05 pts/0 00:00:00 grep-- color=auto redis
6. Enter the container to execute the redis client
Docker exec-it a126ec987cfe redis-cli-a'your passwd' [root@localhost~] # docker exec-it a126ec987cfe redis-cli-h 127.0.0.1-p 6379-a 'your passwd'127.0.0.1:6379 > pingPONG127.0.0.1:6379 > info# Serverredis_version:4.0.9redis_git_sha1:00000000redis_git_dirty:0redis_build_id:d3ebfc7feabc1290redis_mode:standaloneos:Linux 3.10.0-693.21.1.el7.x86_64 x8634.
-h 127.0.0.1: default is-h 127.0.0.1
-p 6379: not added to-p 6379 by default
Or connect without a password, as follows:
[root@localhost] # docker exec-it a126ec987cfe redis-cli127.0.0.1:6379 > ping (error) NOAUTH Authentication required.127.0.0.1:6379 > auth 'your passwd'OK127.0.0.1:6379 > pingPONG127.0.0.1:6379 > info# Serverredis_version:4.0.9redis_git_sha1:00000000redis_git_dirty:0redis_build_id:d3ebfc7feabc1290redis_mode:standaloneos:Linux 3.10.0-693.21.1.el7.x86_64 x86_64arch_bits:64
The above is the whole content of this article, I hope it will be helpful to your study, and I also hope that you will support it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.