通过Docker-compose添加Percona Server For MySQL5.7服务器(使用Docker 18以上Percona Server for mysql(一))

 ̄綄美尐妖づ 提交于 2020-02-01 07:19:55

1.找到Perconna Server的GIthub的Docker Compose文件,具体地址如下

https://github.com/percona/percona-docker/blob/master/percona-server.57/docker-compose.yml

version: '2'
services:
  percona-server:
    image: percona/percona-server:5.7
    environment:
      MYSQL_ROOT_PASSWORD: secret
    ports:
      - "50002:3306"
    volumes:
      # create volumes for use
      - /opt/percona-server/mysql:/var/lib/mysql
      # bind mount my local my.cnf
      - /opt/percona-server/my.cnf:/etc/my.cnf.d/my.cnf

# uncomment sections below if you want to enable PMM
#  pmm-server:
#    image: percona/pmm-server:latest
#    ports:
#     - "443:443"
#    environment:
#     - SERVER_USER=pmm
#     - SERVER_PASSWORD=pmm
#  pmm-client-ps:
#    image: perconalab/pmm-client:latest
#    environment:
#     - PMM_SERVER=pmm-server:443
#     - PMM_USER=pmm
#     - PMM_PASSWORD=pmm
#     - DB_TYPE=mysql
#     - DB_HOST=percona-server
#     - DB_PORT=3306
#     - DB_USER=root
#     - DB_PASSWORD=secret

2.为什么将data目录和cnf目录映射到主机?

           2.1.把data目录映射出来便于管理数据库文件,了解数据库文件,/opt/percona-server/mysql目录要设置777权限

           2.2其次mysql5.7需要做一些配置优化

3.my.cnf配置如下,其他优化请根据服务器,自己调优:

[mysqld]
lower_case_table_names=1
sql_mode=ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION

 

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!