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

第二十六章 Centos7下Docker安装Mariadb

一、查找Mariadb镜像

[root@staging ~]# docker search  mariadb:10.0.26

二、拉取Mariadb镜像

[root@staging ~]# docker pull mariadb:10.0.26

三、运行Mariadb

[root@staging ~]# docker run \
 -itd  \
 -p 13306:3306 \
 -v /data2/mariadb/conf:/etc/MysqL/conf.d \
 -v /data2/mariadb/data:/var/lib/MysqL \
 -v /data2/mariadb/log:/var/log/MysqL \
 -v /usr/share/zoneinfo/Asia/Shanghai:/etc/localtime \
 -e MysqL_ROOT_PASSWORD=123456 \
 --restart always \
 --privileged=true \
 --name mariadb \
 mariadb:10.0.26

四、验证Mariadb容器

[root@staging data2]# docker ps |grep mariadb
8f71d895b3f1   mariadb:10.0.26       "docker-entrypoint.s…"   2 minutes ago   Up 2 minutes           0.0.0.0:13306->3306/tcp, :::13306->3306/tcp

五、配置Mariadb

[root@staging ~]# cd /data2/mariadb/conf/
[root@staging conf]# cat client.cnf 
#
# These two groups are read by the client library
# Use it for options that affect all clients, but not the server
#

[client]
# This group is not read by MysqL client library,
# If you use the same .cnf file for MysqL and MariaDB,
# use it for MariaDB-only client options
[client-mariadb]
[root@staging conf]# cat MysqL-clients.cnf 
#
# These groups are read by MariaDB command-line tools
# Use it for options that affect only one utility
#

[MysqL]
[MysqL_upgrade]
[MysqLadmin]
[MysqLbinlog]
[MysqLcheck]
[MysqLdump]
[mysqlimport]
[MysqLshow]
[MysqLslap
[root@staging conf]# cat tokudb.cnf 
[mariadb]
# See https://mariadb.com/kb/en/how-to-enable-tokudb-in-mariadb/
# for instructions how to enable TokuDB
#
# See https://mariadb.com/kb/en/tokudb-differences/ for differences
# between TokuDB in MariaDB and TokuDB from http://www.tokutek.com/

#plugin-load-add=ha_tokudb.so
[root@staging conf]# cat server.cnf 
#
# These groups are read by MariaDB server.
# Use it for options that only the server (but not clients) should see
#
# See the examples of server my.cnf files in /usr/share/MysqL/
#

# this is read by the standalone daemon and embedded servers
[server]

# this is only for the MysqLd standalone daemon
[MysqLd]
datadir=/var/lib/MysqL
socket=/var/lib/MysqL/MysqL.sock
character_set_server=utf8
slow_query_log=on
slow_query_log_file=/var/log/MysqL/slow_query_log.log
long_query_time=2
explicit_defaults_for_timestamp = 1
innodb_large_prefix=on
max_connections=3000
innodb_file_format = BARRACUDA
# this is only for embedded server
[embedded]

# This group is only read by MariaDB servers, not by MysqL.
# If you use the same .cnf file for MysqL and MariaDB,
# you can put MariaDB-only options here
[mariadb]

# This group is only read by MariaDB-10.0 servers.
# If you use the same .cnf file for MariaDB of different versions,
# use this group for options that older servers don't understand
[mariadb-10.0]

六、重启Mariadb

#1.重启MysqL
[root@staging conf]# docker  restart  mariadb
mariadb

#2.查看MysqL日志,发现MysqL正常启动,日志时间也与系统时间保持一致
[root@staging ~]# docker logs -f  mariadb
220112 15:01:55 [Note] Server socket created on IP: '::'.
220112 15:01:55 [Warning] 'proxies_priv' entry '@% root@cf6ad44a4433' ignored in --skip-name-resolve mode.
220112 15:01:55 [Note] MysqLd: ready for connections.
Version: '10.0.26-MariaDB-1~jessie'  socket: '/var/lib/MysqL/MysqL.sock'  port: 3306  mariadb.org binary distribution

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

相关推荐