溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

MariaDB-10.1yum安裝方法

發(fā)布時間:2020-06-24 18:09:57 來源:網(wǎng)絡 閱讀:1449 作者:weilovepan520 欄目:數(shù)據(jù)庫

MariaDB-yum倉庫搭建方法:

相關參考網(wǎng)站:

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

 

初始化數(shù)據(jù)庫:

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

 

配置參數(shù):

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

啟動第一個數(shù)據(jù)庫:192.168.0.241

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

注:在集群中啟動第一臺數(shù)據(jù)庫時,必須加上參數(shù)--wsrep-new-cluster

 

依次啟動多臺數(shù)據(jù)庫:192.168.0.242 192.168.0.243

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

注:依次啟動多臺數(shù)據(jù)庫時,需要加上參數(shù)--wsrep_cluster_address并指定IP地址,以加入集群

 

當集群中的所有數(shù)據(jù)庫全部關閉后第一臺啟動的數(shù)據(jù)庫:

需要添加 --wsrep-new-cluster選擇

 

當集群中只要有一臺數(shù)據(jù)庫未關閉,其它集群節(jié)點啟動不需要添加任何額外的參數(shù)

 

注:關閉數(shù)據(jù)庫一定要正常關閉,否則數(shù)據(jù)庫可能會無法啟動

 

 

查看集群狀態(tài):

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 768 pages, max 0 (relevant if non-zero) pages!

問題原因:

在初始化數(shù)據(jù)庫時系統(tǒng)自動建立了ibdata1,ib_logfile0,ib_logfile1幾個文件

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

默認的ibdata1大小為8M,而我在此配置的為10M,是導致問題的原因

解決辦法:

mysqldata目錄下,刪除ibdata1,ib_logfile0,ib_logfile1

在重新啟動mysql,系統(tǒng)會根據(jù)配置再次生成ibdata文件

向AI問一下細節(jié)

免責聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權請聯(lián)系站長郵箱:is@yisu.com進行舉報,并提供相關證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權內(nèi)容。

AI