update
This commit is contained in:
21
mysql/Demo/SingleNode/README.md
Normal file
21
mysql/Demo/SingleNode/README.md
Normal file
@@ -0,0 +1,21 @@
|
||||
# 部署 MySQL 单节点
|
||||
|
||||
- 按实际环境修改
|
||||
- docker-compose.yml
|
||||
- mysql/my.cnf
|
||||
|
||||
- 创建目录
|
||||
```
|
||||
grep '\<source:' docker-compose.yml | cut -d: -f2 | xargs mkdir -p
|
||||
```
|
||||
|
||||
- 启动
|
||||
```
|
||||
docker-compose up -d
|
||||
```
|
||||
|
||||
- 查看日志,直至出现 "MySQL is ready for connections."
|
||||
```
|
||||
docker-compose logs mysql
|
||||
```
|
||||
|
27
mysql/Demo/SingleNode/docker-compose.yml
Normal file
27
mysql/Demo/SingleNode/docker-compose.yml
Normal file
@@ -0,0 +1,27 @@
|
||||
version: "3.7"
|
||||
|
||||
services:
|
||||
mysql:
|
||||
image: harbor.colben.cn/general/mysql:8
|
||||
container_name: mysql
|
||||
restart: "on-failure"
|
||||
stop_grace_period: 5m
|
||||
privileged: true
|
||||
networks:
|
||||
mysql:
|
||||
ports:
|
||||
- 3306:3306
|
||||
volumes:
|
||||
- type: bind
|
||||
source: ./mysql/my.cnf
|
||||
target: /etc/my.cnf
|
||||
- type: bind
|
||||
source: ./mysql/binlog
|
||||
target: /var/lib/mysql-bin
|
||||
- type: bind
|
||||
source: ./mysql/db
|
||||
target: /var/lib/mysql
|
||||
- type: bind
|
||||
source: ./mysql/log
|
||||
target: /var/log/mysql
|
||||
|
19
mysql/Demo/SingleNode/mysql/my.cnf
Normal file
19
mysql/Demo/SingleNode/mysql/my.cnf
Normal file
@@ -0,0 +1,19 @@
|
||||
[mysqld]
|
||||
mysqlx = OFF
|
||||
skip-name-resolve = 1
|
||||
max-user-connections = 600
|
||||
|
||||
## this should be less than 80% of total memory
|
||||
innodb-buffer-pool-size = xxxxG
|
||||
|
||||
## this should be half of "innodb-buffer-pool-size"
|
||||
innodb-buffer-pool-instances = xxxx
|
||||
|
||||
# binlog
|
||||
server-id = 1
|
||||
log-bin = /var/lib/mysql-bin/master
|
||||
binlog-format = ROW
|
||||
binlog-expire-logs-seconds = 172800
|
||||
gtid-mode = ON
|
||||
enforce-gtid-consistency = TRUE
|
||||
|
Reference in New Issue
Block a user