当前位置:网站首页>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
边栏推荐
- Matlab drawing (ultra detailed)
- 客户案例 | 聚焦流程体验,助银行企业APP迭代
- Soul continues to make efforts to list its social channels in Hong Kong. Why is "soul style social" popular?
- To improve the baby's allergy, take yiminshu. Azg and aibeca love la Beijia work together to protect the growth of Chinese babies
- Brief introduction of chip, memory and its key indicators I
- Dsgan degenerate network
- Day012 一维数组的应用
- The issuing process of individual developers applying for code signing certificates
- regular expression
- CASS11.0.0.4 for AutoCAD2010-2023免狗使用方法
猜你喜欢

Esxi virtual machine starts, and the module "monitorloop" fails to power on

Express接收请求参数

jest单测样式问题【identity-obj-proxy】npm包

C语言怎么学?这篇文章给你完整答案

Auto encoder (AE), denoising auto encoder (DAE), variable auto encoder (VAE) differences

Derivative, partial derivative and gradient

Norms of vectors and matrices

How to delete or replace the loading style of easyplayer streaming media player?

客户案例 | 聚焦流程体验,助银行企业APP迭代

Many of the world's top 500 enterprises gathered at the second digital Expo, and the digital industry curtain is about to open!
随机推荐
AI:业余时间打比赛—挣它个小小目标—【阿里安全×ICDM 2022】大规模电商图上的风险商品检测比赛
GoLand writes Go program
如何让最小 API 绑定查询字符串中的数组
Numpy array and image conversion
EasyCVR设备管理列表页面搜索时,分页数据不显示的问题修复
[unity URP] the code obtains the universalrendererdata of the current URP configuration and dynamically adds the rendererfeature
DNA modified near infrared two region GaAs quantum dots | GaAs DNA QDs | DNA modified GaAs quantum dots
Peptide nucleic acid oligomer containing azobenzene monomer (nh2-tnt4, n-pnas) Qiyue biological customization
DataScience:数据生成之在原始数据上添加小量噪声(可自定义噪声)进而实现构造新数据(dataframe格式数据存储案例)
仿真模型简单介绍
Problems related to compilation and training of Darknet yolov3 and Yolo fast using CUDA environment of rtx30 Series graphics card on win10 platform
vscode运行命令报错:标记“&&”不是此版本中的有效语句分隔符。
About the new features of ES6
Two ways of multi GPU training of pytorch
ES6新特性(入门)
DNA(脱氧核糖核酸)供应|碳纳米管载核酸-DNA/RNA材料|DNA/RNA核酸修饰磁性纳米颗粒
Why can cross entropy loss be used to characterize loss
基于SSM学生成绩管理系统
Build cloud native operating environment
Dimension problems and contour lines