微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

docker compose安装挂载本地文件启动mariadb问题怎么解决

这篇“docker compose安装挂载本地文件启动mariadb问题怎么解决文章的知识点大部分人都不太理解,所以小编给大家总结了以下内容内容详细,步骤清晰,具有一定的借鉴价值,希望大家阅读完这篇文章能有所收获,下面我们一起来看看这篇“docker compose安装挂载本地文件启动mariadb问题怎么解决文章吧。

docker-compose 安装挂载本地文件启动mariadb

docker pull mariadb:xxx

创建本地文件夹与配置文件

注:记得使用chown授权避免权限不足无法写入的错误

[mariadbd]
skip-host-cache
skip-name-resolve

[mysqld]
datadir=/var/lib/MysqL
log-error=/var/log/MysqL/MysqLd.log
pid-file=/var/run/MysqLd/MysqLd.pid
log_bin=/var/log/MysqL/MysqL-bin
binlog_format=row
max-binlog-size=512m
expire_logs_days=180
log_bin_index=/var/log/MysqL/MysqL-bin.index

slow_query_log_file=/var/log/MysqL/mariadb-slow.log
long_query_time = 0.5
server-id=1

skip-external-locking                           

max_connections         = 1000
connect_timeout         = 5
wait_timeout            = 600
max_allowed_packet      = 16M
thread_cache_size       = 128
sort_buffer_size        = 4M
bulk_insert_buffer_size = 16M
tmp_table_size          = 32M
max_heap_table_size     = 32M

default_storage_engine  = InnoDB
# you can't just change log file size, requires special procedure
#innodb_log_file_size   = 50M
#innodb_buffer_pool_size = 256M
innodb_log_buffer_size  = 8M
innodb_file_per_table   = 1
innodb_open_files       = 400
innodb_io_capacity      = 400
innodb_flush_method     = O_DIRECT

#tunning memory
innodb_buffer_pool_size = 512m
innodb_buffer_pool_instances=10
sort_buffer_size=12M
read_buffer_size=8M
read_rnd_buffer_size=50M
join_buffer_size=8M
query_cache_size=256M
thread_concurrency=4                                   #cpu核数 * 2


!include /etc/MysqL/mariadb.cnf
!includedir /etc/MysqL/conf.d/

创建compose文件

mariadb集群搭建—galera Cluster+Proxysql

version: '3.7'
services:
  mariadb:
    image: mariadb:10.6.5
    container_name: "mariadb_alone"
    restart: always
    environment:
      MysqL_USER: "root"
      MysqL_ROOT_PASSWORD: "199651Ch@"
      TZ: "Asia/Shanghai"
    ports:
      - "3306:3306"
    user: "0"  
    volumes:
      # 容器与宿主机时间同步
      - /etc/localtime:/etc/localtime
      - ./data:/var/lib/MysqL
      - ./log:/var/log/MysqL
      - ./run:/var/run/MysqLd
      - ./conf/mariadb.cnf:/etc/mariadb.cnf

执行启动

docker-compose up -d 后台启动

docker compose安装挂载本地文件启动mariadb问题怎么解决

以上就是关于“docker compose安装挂载本地文件启动mariadb问题怎么解决”这篇文章内容,相信大家都有了一定的了解,希望小编分享内容对大家有帮助,若想了解更多相关的知识内容,请关注编程之家行业资讯频道。

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐