Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

MariaDB-10.1yum installation method

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

How to build a MariaDB-yum warehouse:

Related reference websites:

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

Install MariaDB 10.1

Yum install MariaDB-server MariaDB-client-y

Initialize the database:

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

Configuration parameters:

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:4567192.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

Start the first database: 192.168.0.241

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

Note: when starting the first database in the cluster, the parameter-wsrep-new-cluster must be added.

Start multiple databases in turn: 192.168.0.242 192.168.0.243

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

Note: when starting multiple databases in turn, you need to add the parameter-- wsrep_cluster_address and specify the IP address to join the cluster.

The first database that starts when all the databases in the cluster are shut down:

Need to add-- wsrep-new-cluster selection

As long as one database in the cluster is not closed, no additional parameters need to be added to the startup of other cluster nodes.

Note: the database must be closed normally, otherwise the database may not be able to start

View the cluster status:

Mysql > show status like 'wsrep%'

Failure encountered in initial startup:

[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!

The cause of the problem:

The system automatically establishes several ibdata1,ib_logfile0,ib_logfile1 files when initializing the database.

Caused by the configuration of: innodb_data_file_path = ibdata1:10M;ibdata2:10M:autoextend in the configuration file, which is inconsistent with the size of the initialization ibdata1

The default ibdata1 size is 8m, while the one I configure here is 10m, which is the cause of the problem

Solution:

Under the data directory of mysql, delete ibdata1,ib_logfile0,ib_logfile1

After restarting mysql, the system will generate the ibdata file again according to the configuration

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report