docker-compose---安装挂载本地文件启动mariadb问题
更新时间:2023年03月16日 11:06:58 作者:chihaihai
这篇文章主要介绍了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文件,version版本参考:
https://docs.docker.com/compose/compose-file/compose-versio
docker-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一键部署WordPress博客的方法
这篇文章主要介绍了docker-compose一键部署WordPress博客,本文分步骤给大家讲解的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2022-04-04docker-compose部署nacos 2.2.3的详细过程
这篇文章主要介绍了docker-compose部署nacos 2.2.3的详细过程,本文给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下2023-11-11
最新评论