swarm
This commit is contained in:
36
docker-swarm/mysql/README
Normal file
36
docker-swarm/mysql/README
Normal file
@ -0,0 +1,36 @@
|
||||
|
||||
# crm1环境下 部署 mysql
|
||||
|
||||
env $(cat ./env_crm1 | xargs) envsubst < ./docker-compose.yml | docker stack deploy --compose-file - crm1_mysql
|
||||
|
||||
[mysqladmin]
|
||||
user=
|
||||
|
||||
[mysqld]
|
||||
skip_name_resolve
|
||||
explicit_defaults_for_timestamp
|
||||
basedir=/opt/bitnami/mysql
|
||||
port=3306
|
||||
tmpdir=/opt/bitnami/mysql/tmp
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
pid_file=/opt/bitnami/mysql/tmp/mysqld.pid
|
||||
max_allowed_packet=16M
|
||||
bind_address=0.0.0.0
|
||||
log_error=/opt/bitnami/mysql/logs/mysqld.log
|
||||
slow_query_log=0
|
||||
slow_query_log_file=/opt/bitnami/mysql/logs/mysqld.log
|
||||
long_query_time=10
|
||||
character_set_server=utf8mb4
|
||||
collation_server=utf8mb4_unicode_ci
|
||||
plugin_dir=/opt/bitnami/mysql/lib/plugin
|
||||
|
||||
[client]
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
default_character_set=utf8mb4
|
||||
plugin_dir=/opt/bitnami/mysql/lib/plugin
|
||||
|
||||
[manager]
|
||||
port=3306
|
||||
socket=/opt/bitnami/mysql/tmp/mysql.sock
|
||||
pid_file=/opt/bitnami/mysql/tmp/mysqld.pid
|
42
docker-swarm/mysql/docker-compose.yml
Normal file
42
docker-swarm/mysql/docker-compose.yml
Normal file
@ -0,0 +1,42 @@
|
||||
version: '3.8'
|
||||
networks:
|
||||
default:
|
||||
name: ${NAMESPACE}
|
||||
external: true
|
||||
services:
|
||||
db:
|
||||
image: docker.io/bitnami/mysql:8.0
|
||||
ports:
|
||||
- '${NODE_PORT}:3306'
|
||||
environment:
|
||||
- TZ=Asia/Shanghai
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD}
|
||||
- MYSQL_DATABASE=${MYSQL_DATABASE}
|
||||
- MYSQL_ENABLE_SLOW_QUERY=0
|
||||
- MYSQL_LONG_QUERY_TIME=10
|
||||
- MYSQL_USER=${MYSQL_USER}
|
||||
- MYSQL_PASSWORD=${MYSQL_PASSWORD}
|
||||
- MYSQL_AUTHENTICATION_PLUGIN=mysql_native_password
|
||||
volumes:
|
||||
- 'data_db:/bitnami/mysql/data'
|
||||
healthcheck:
|
||||
test: ['CMD', '/opt/bitnami/scripts/mysql/healthcheck.sh']
|
||||
interval: 15s
|
||||
timeout: 5s
|
||||
retries: 6
|
||||
configs:
|
||||
- source: custome_config
|
||||
target: /opt/bitnami/mysql/conf/my_custom.cnf
|
||||
deploy:
|
||||
placement:
|
||||
constraints:
|
||||
- node.labels.${NAMESPACE}_mysql==1
|
||||
volumes:
|
||||
data_db:
|
||||
driver: local
|
||||
configs:
|
||||
custome_config:
|
||||
external: true
|
||||
name: ${CUSTOME_CONFIG}
|
||||
|
||||
|
7
docker-swarm/mysql/env_crm1
Normal file
7
docker-swarm/mysql/env_crm1
Normal file
@ -0,0 +1,7 @@
|
||||
NAMESPACE=crm1
|
||||
NODE_PORT=3306
|
||||
MYSQL_USER=gkxl650
|
||||
MYSQL_PASSWORD=gkxl650
|
||||
MYSQL_ROOT_PASSWORD=gkxl650
|
||||
MYSQL_DATABASE=zd_rescue
|
||||
CUSTOME_CONFIG=crm1_mysql_conf_v1
|
Reference in New Issue
Block a user