当前位置:网站首页>Using docker to install and deploy redis on CentOS
Using docker to install and deploy redis on CentOS
2022-07-27 07:00:00 【Cau1i】
1 Reference documents
[Redis - Official Image | Docker Hub](https://hub.docker.com/_/redis)
2 install Redis
Pull Redis Mirror image .
docker pull redisCreate corresponding directories and files locally .
mkdir -p /usr/local/docker/redis mkdir -p /usr/local/docker/redis/data touch /usr/local/docker/redis/redis.confEdit profile , You can download the configuration file from the official website redis.conf.
vim /docker/redis/redis.conf# Redis The default is not to run as a daemon , This configuration item can be modified , Use yes Enable daemons daemonize no # Appoint Redis Listening port , The default port is 6379 port 6379 # The bound host address , Do not bind the local of the container 127.0.0.1 Address , Because it cannot be accessed outside the container bind 0.0.0.0 # If you need a password, open requirepass 123456 # Persistence appendonly yesstart-up docker Containers .
docker run -p 6379:6379 --name redis --restart=always -v /usr/local/docker/redis/redis.conf:/etc/redis/redis.conf -v /usr/local/docker/redis/data:/data -d redis redis-server /etc/redis/redis.conf
explain :
- docker run redis # from redis Mirror run container
- -p 6379:6379 # Map local 6379 Port to container 6379 port ,: The former is the local port
- –name redis # Set the container name to redis, Convenient for future use docker ps Conduct management
- –restart=always # Always restart the container when it exits
- -v /usr/local/docker/redis/redis.conf:/etc/redis/redis.conf # Associate local /usr/local/docker/redis/redis.conf File into container /etc/redis/redis.conf,: The former is the local directory
- -v /usr/local/docker/redis/data:/data # Associate local /docker/redis/data Go into the container /data Catalog , This is storage redis Catalog of data , To facilitate future upgrades redis, And data can be preserved
- -d # Background start , Use this method to start , be redis.conf in daemonize Must be set to no, Otherwise it will fail to start redis-server /etc/redis/redis.conf # Start in the container redis-server The order of , Mainly for loading configuration
start-up Redis.
# To access containers , You can use docker exec -it redis bash # Or use it directly redis-cli Access inside container redis docker exec -it redis redis-cli
3 to open up Redis Firewall port
Query whether the specified port is opened .
firewall-cmd --query-port=3306/tcpAdd the specified port to be opened .
firewall-cmd --add-port=3306/tcp --permanentLook again , It is found that the query is still no, You need to execute firewall command overloading .
firewall-cmd --reload
边栏推荐
- Unittest suite and runner
- Build cloud native operating environment
- Cyclegan parsing
- Redis快速学习
- Matlab drawing (ultra detailed)
- Soul continues to make efforts to list its social channels in Hong Kong. Why is "soul style social" popular?
- 基于SSM学生学籍管理系统
- regular expression
- DNA (deoxyribonucleic acid) supply | carbon nanotube nucleic acid loaded dna/rna material | dna/rna nucleic acid modified magnetic nanoparticles
- New features of ES6 (2)
猜你喜欢

What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!

PNA modified polypeptide arms PNA PNA DNA suc aapf PNA suc - (ALA) 3 PNA

强网杯2021 pwn 赛题解析——babypwn

阿里云短信验证第三方接口(快速使用)

齐岳:巯基修饰寡聚DNA|DNA修饰CdTe/CdS核壳量子点|DNA偶联砷化铟InAs量子点InAs-DNA QDs

New features of ES6 (2)

To improve the baby's allergy, take yiminshu. Azg and aibeca love la Beijia work together to protect the growth of Chinese babies

DNA(脱氧核糖核酸)供应|碳纳米管载核酸-DNA/RNA材料|DNA/RNA核酸修饰磁性纳米颗粒

Express接收请求参数

PNA peptide nucleic acid modified peptide suc Tyr Leu Val PNA | suc ala Pro Phe PNA 11
随机推荐
Create a container that does not depend on any underlying image
Sunflower: don't worry when you encounter computer vulnerabilities, understand clearly and then judge sunflower: don't worry when you encounter computer vulnerabilities, understand clearly and then ju
智能安防视频平台EasyCVR出现通道列表为空情况的原因是什么?
DNA research experiment application | cyclodextrin modified nucleic acid cd-rna/dna | cyclodextrin nucleic acid probe / quantum dot nucleic acid probe
仿真模型简单介绍
基于SSM学生学籍管理系统
Norms of vectors and matrices
客户案例 | 聚焦流程体验,助银行企业APP迭代
脱氧核糖核酸DNA修饰氧化锌|DNA修饰纳米金颗粒|DNA偶联修饰碳纳米材料
A cross domain problem of golang
Problems related to compilation and training of Darknet yolov3 and Yolo fast using CUDA environment of rtx30 Series graphics card on win10 platform
Multimodal database | star ring technology multimode database argodb "one database for multiple purposes", building a high-performance Lake warehouse integrated platform
关于ES6的新特性
Add virtual network card and configure OP route in win10
Use -wall to clear code hidden dangers
Express framework
Cyclegan parsing
jest单测样式问题【identity-obj-proxy】npm包
What "hard core innovations" does Intel have in the first half of 2022? Just look at this picture!
Numpy array and image conversion