当前位置:网站首页>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
边栏推荐
- PNA peptide nucleic acid modified peptide suc Tyr Leu Val PNA | suc ala Pro Phe PNA 11
- Alibaba cloud SMS authentication third-party interface (fast use)
- What is special about the rehabilitation orthopedic branch of 3D printing brand?
- deepsort源码解读(七)
- 【12】 Understand the circuit: from telegraph to gate circuit, how can we "send messages from thousands of miles"?
- NAT (network address translation)
- Linux安装Redis操作
- Recommended by the world's most technologically competent smart contract security audit company in 2022
- Speech and language processing (3rd ed. draft) Chapter 2 - regular expression, text normalization, editing distance reading notes
- Pymysql query result conversion JSON
猜你喜欢

Deepsort工作原理分析

ES6 new features (getting started)

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

基于SSM音乐网站管理系统

How to make the minimum API bind the array in the query string

Soul submitted an application for listing in Hong Kong stocks, accelerating the diversified and scene based layout of social gathering places

Linux安装与卸载MySql

Sunflower popularizes Science in an all-round way to avoid loopholes for your remote control equipment in time

Reasoning speed of model

关于ES6的新特性
随机推荐
【12】 Understand the circuit: from telegraph to gate circuit, how can we "send messages from thousands of miles"?
TS学习(八) :TS中的类
Do it yourself container
Matlab drawing (ultra detailed)
网易云信亮相 GIAC 全球互联网架构大会,解密新一代音视频架构在元宇宙场景的实践...
deepsort源码解读(一)
O2O电商线上线下一体化模式分析
After adding a camera (camera) to the UAV in gazebo, the UAV cannot take off
Qi Yue: thiol modified oligodna | DNA modified cdte/cds core-shell quantum dots | DNA coupled indium arsenide InAs quantum dots InAs DNA QDs
关于ES6的新特性
ES6的新特性(2)
DNA(脱氧核糖核酸)供应|碳纳米管载核酸-DNA/RNA材料|DNA/RNA核酸修饰磁性纳米颗粒
MySQL的基本语句(1)—增删改查
Numpy array and image conversion
Significance of NVIDIA SMI parameters
New features of ES6 (2)
Problems related to pytorch to onnx
阿里云短信验证第三方接口(快速使用)
Two ways of multi GPU training of pytorch
FTX US launched FTX stocks, striding forward to the mainstream financial industry