大橙子网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

MariaDB-10.1yum安装方法

MariaDB-yum仓库搭建方法:

鸡西梨树ssl适用于网站、小程序/APP、API接口等需要进行数据传输应用场景,ssl证书未来市场广阔!成为成都创新互联公司的ssl证书销售渠道,可以享受市场价格4-6折优惠!如果有意向欢迎电话联系或者加微信:18980820575(备注:SSL证书合作)期待与您的合作!

相关参考网站:

http://yum.mariadb.org/

https://mariadb.com/kb/en/mariadb/yum/

MariaDB 10.X

centos6 repo

# MariaDB 10.1 CentOS repository list - created 2015-11-20 14:01 UTC

# http://mariadb.org/mariadb/repositories/

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.1/centos6-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

 

centos7 repo

[mariadb]

name = MariaDB

baseurl = http://yum.mariadb.org/10.1/centos7-amd64

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

MariaDB 5.X

centos6 repo

[mariadb]

name = MariaDB-5.5.39

baseurl=https://downloads.mariadb.com/files/MariaDB/mariadb-5.5.39/yum/rhel6-amd64/

# alternative: baseurl=http://archive.mariadb.org/mariadb-5.5.39/yum/rhel6-amd64/

gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

gpgcheck=1

 

安装MariaDB 10.1

yum install MariaDB-server MariaDB-client -y

 

初始化数据库:

/usr/bin/MySQL_install_db --datadir=/data/mysql --user=mysql

 

配置参数:

vim /etc/my.cnf.d/server.cnf

[mysqld]

server-id = 1

datadir = /data/mysql

log_error = /data/mysql/err.log

log_bin = mysql-bin

slow_query_log = ON

slow_query_log_file = /data/mysql/slow.log

long_query_time = 2

skip-name-resolve

lower_case_table_names = 1

innodb_file_per_table = 1

back_log = 50

max_connections = 2000

max_connect_errors = 1000000

thread_cache_size = 128

table_open_cache = 2048

max_allowed_packet = 1G

binlog_cache_size = 8M

character_set_server = utf8

innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend

innodb_thread_concurrency = 0

innodb_read_io_threads = 10

innodb_write_io_threads = 10

innodb_flush_method=O_DIRECT

innodb_buffer_pool_size = 400M

innodb_log_file_size = 100M

innodb_log_buffer_size = 16M

innodb_log_files_in_group = 3

innodb_max_dirty_pages_pct = 60

innodb_lock_wait_timeout = 60

log_bin_trust_function_creators = 1

innodb_flush_log_at_trx_commit = 2

innodb_locks_unsafe_for_binlog = 1

#innodb_log_group_home_dir =

 

[galera]

# Mandatory settings

wsrep_on=ON

#wsrep_provider=

wsrep_provider = /usr/lib64/galera/libgalera_smm.so

wsrep_cluster_address= 'gcomm://192.168.0.241:4567,192.168.0.243:4567'

binlog_format=row

default_storage_engine=InnoDB

innodb_autoinc_lock_mode=2

wsrep_retry_autocommit = 0

wsrep_provider_options="gcache.size=200M; base_port=4567; gcache.page_size=100M"

wsrep_slave_threads=4

wsrep_cluster_name='mysql_db_cluster'

wsrep_node_address='192.168.0.242'

wsrep_provider_options="base_port=4567;"

wsrep_node_name='test2'

wsrep_sst_method=rsync

wsrep_sst_auth="sst:86rt6y1qaz@WSX"

# Allow server to accept connections on all interfaces.

bind-address=0.0.0.0

启动第一个数据库:192.168.0.241

/etc/init.d/mysql start --wsrep-new-cluster

注:在集群中启动第一台数据库时,必须加上参数--wsrep-new-cluster

 

依次启动多台数据库:192.168.0.242 192.168.0.243

/etc/init.d/mysql start--wsrep_cluster_address=gcomm://192.168.0.241

注:依次启动多台数据库时,需要加上参数--wsrep_cluster_address并指定IP地址,以加入集群

 

当集群中的所有数据库全部关闭后第一台启动的数据库:

需要添加 --wsrep-new-cluster选择

 

当集群中只要有一台数据库未关闭,其它集群节点启动不需要添加任何额外的参数

 

注:关闭数据库一定要正常关闭,否则数据库可能会无法启动

 

 

查看集群状态:

mysql>show status like‘wsrep%’;

 

初次启动碰到的故障:

 

 [ERROR] InnoDB: auto-extending data file ./ibdata1 is of a different size 640 pages (rounded down to MB) than specified in the .cnf file: initial 768pages, max 0 (relevant if non-zero) pages!

问题原因:

在初始化数据库时系统自动建立了ibdata1,ib_logfile0,ib_logfile1几个文件

在配置文件中由于配置了:innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend,跟初始化时的ibdata1的大小不一致导致的

默认的ibdata1大小为8M,而我在此配置的为10M,是导致问题的原因

解决办法:

在mysql的data目录下,删除ibdata1,ib_logfile0,ib_logfile1;

在重新启动mysql,系统会根据配置再次生成ibdata文件


文章名称:MariaDB-10.1yum安装方法
当前路径:http://dzwzjz.com/article/gpcdji.html
在线咨询
服务热线
服务热线:028-86922220
TOP