Docker-compose常用软件部署(Mysql、Redis、RabbitMQ) 废话不多说,下面就直接给出部署文件已经启动脚本,这个会持续更新。以下的部署方式均是单例部署。高可用或者其他部署方案我会单独写相应的文章。 mysql数据
废话不多说,下面就直接给出部署文件已经启动脚本,这个会持续更新。以下的部署方式均是单例部署。高可用或者其他部署方案我会单独写相应的文章。
version: ‘3‘
# docker network create mysql_bridge
networks:
mysql_bridge:
driver: bridge
services:
mysql-server:
image: docker.io/mysql:5.7
container_name: mysql-server
restart: always
environment:
# 指定root密码。不指定则会启动失败
- MYSQL_ROOT_PASSWord:123456
volumes:
# 同步本地时间
- /etc/localtime:/etc/localtime:ro
# 初始化执行的sql
# - ./init:/docker-entrypoint-initdb.d/
# db配置
- ./conf/my.cnf:/etc/my.cnf
# db文件存放地址
- ./db_data:/var/lib/mysql
ports:
- 3306:3306
networks:
- mysql_bridge
#! /usr/bin/bash
# 定义一个名称变量
network_name="mysql_bridge"
filterName=`docker network ls | grep $network_name | awk ‘{ print $2 }‘`
if [ "$filterName" == "" ]; then
# 不存在就创建
docker network create $network_name
echo "Created network $network_name success!!"
fi
docker-compose -f ./compose-mysql.yaml up -d
docker ps -a
docker logs -f mysql-server
version: ‘3‘
# docker network create redis_bridge
networks:
redis_bridge:
driver: bridge
services:
redis-server:
image: docker.io/redis:latest
container_name: redis-server
restart: always
command: redis-server --requirepass "123456"
volumes:
- /etc/localtime:/etc/localtime:ro
- ./redis_data:/var/lib/redis
ports:
- 6379:6379
networks:
- redis_bridge
#! /usr/bin/bash
# 定义一个名称变量
network_name="redis_bridge"
filterName=`docker network ls | grep $network_name | awk ‘{ print $2 }‘`
if [ "$filterName" == "" ]; then
# 不存在就创建
docker network create $network_name
echo "Created network $network_name success!!"
fi
docker-compose -f ./compose-redis.yaml up -d
docker ps -a
docker logs -f redis-server
version: ‘3‘
# docker network create rabbitmq_bridge
networks:
rabbitmq_bridge:
driver: bridge
services:
rabbitmq:
image: rabbitmq:management-alpine
container_name: rabbitmq-server
restart: always
volumes:
- /etc/localtime:/etc/localtime:ro
- ./data:/var/lib/rabbitmq
environment:
- RABBITMQ_DEFAULT_USER=ming
- RABBITMQ_DEFAULT_PASS=ming123456
ports:
- "15672:15672"
- "5672:5672"
logging:
driver: "JSON-file"
options:
max-size: "200k"
max-file: "10"
networks:
- rabbitmq_bridge
#! /usr/bin/bash
# 定义一个名称变量
network_name="rabbitmq_bridge"
filterName=`docker network ls | grep $network_name | awk ‘{ print $2 }‘`
if [ "$filterName" == "" ]; then
# 不存在就创建
docker network create $network_name
echo "Created network $network_name success!!"
fi
docker-compose -f ./compose-rabbitmq.yaml up -d
docker ps -a
docker logs -f rabbitmq-server
Docker-compose常用软件部署(mysql、redis、rabbitmq)
--结束END--
本文标题: Docker-compose常用软件部署(mysql、redis、rabbitmq)
本文链接: https://lsjlt.com/news/7297.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
2024-10-23
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
2024-10-22
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0