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.3.12 stand-alone & Cluster deployment (including phpmyadmin) Learning Notes

2025-03-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

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

February 27, 2019

9:46

Catalogue

Environmental description:. two

First, stand-alone deployment. two

Query whether the system has its own mariadb, and if so, uninstall it. two

1.2. Configure offline yum source. three

1.3. upgrade the systemd-libs package. four

Install mariadb 4

1.5 launch mariadb 5

1.6. simple configuration of MariaDB. six

1.7.Log in MariaDB. seven

1.8. Open the error log. seven

Second, graphical management interface phpmyadmin deployment. ten

2.1. install httpd, php and php-mysql software. ten

2.2, decompress the software package. ten

2.3. Generate configuration files. ten

2.4. Turn on advanced functions. ten

2.4.1, edit the configuration file. ten

2.4.2. Execute the script according to the prompts on the page. eleven

2.4.3, update permissions. thirteen

2.4.4. Restart the httpd service. fifteen

Third, cluster installation. seventeen

3.1, variable parameters that must be configured. seventeen

3.2. Start the cluster command:. nineteen

3.3. Other nodes join the cluster. twenty

3.4. Check the cluster status. twenty

Fourth, points for attention. twenty-one

Environment description:

Official site:

Https://mariadb.com/kb/zh-cn/

Https://mariadb.org

Official website learning link:

Https://mariadb.com/kb/en/library/getting-started-with-mariadb-galera-cluster/#installing-mariadb-galera-cluster

Environment: VMware ®Workstation 15 Pro

Stand-alone deployment: CentOS7.1+Mariadb10.3.12+phpmyadmin4.0.10.20

Note: customers must use the CentOS7.1+Mariadb10.3.12 environment, and the dependent package version of mariadb10.3.12 on CentOS7.1 needs to be upgraded, so the latest package is extracted directly from CentOS7.6 and configured with offline yum source.

If you install it directly on CentOS7.6, you don't need to be an offline yum source, just mount the system image as an yum source. Mariadb and phpmyadmin can be downloaded for free from the official website.

Cluster deployment: three CentOS7.1 virtual machines + Mariadb10.3.12+phpmyadmin4.0.10.20

IP address:

111.111.111.20

111.111.111.201

111.111.111.202

Hostname:

Hostnamectl set-hostname mariadb01

Hostnamectl set-hostname mariadb02

Hostnamectl set-hostname mariadb03

Turn off the firewall & selinux

[root@localhost ~] # systemctl stop firewalld

[root@localhost ~] # systemctl disable firewalld

[root@localhost ~] # sed-I's Universe GG'/ etc/selinux/config

[root@localhost ~] # setenforce 0

1.1.1.Inquiry whether the system comes with mariadb, and if so, uninstall it.

Rpm-qa queries a package with version 5.5.41 and uninstalls it directly.

1.2.Configuring offline yum sources

Upload the prepared offline yum source package to the server and configure the yum source

Because the server has a minimal installation, you also need to install the createrepo command

[root@localhost mariadb-10.3.12_yum_centos_offline] # rpm- ivh deltarpm-3.6-3.el7.x86_64.rpm

[root@localhost mariadb-10.3.12_yum_centos_offline] # rpm- ivh python-deltarpm-3.6-3.el7.x86_64.rpm

[root@localhost mariadb-10.3.12_yum_centos_offline] # rpm-ivh libxml2-2.9.1-5.el7_0.1.x86_64.rpm

[root@localhost mariadb-10.3.12_yum_centos_offline] # rpm-ivh libxml2-python-2.9.1-5.el7_0.1.x86_64.rpm

[root@localhost mariadb-10.3.12_yum_centos_offline] # rpm-ivh createrepo-0.9.9-23.el7.noarch.rpm

Create a local yum source repository

After executing setup_repository, a mariadb.repo is generated in the / etc/yum.repos.d directory, but we still need to configure it ourselves, otherwise other repo files in this directory will interfere with yum offline sources.

1.3. upgrade the systemd-libs package

Since the systemd-libs-208-20.el7.x86_64 version of centos7.1 is too low to support the Mariadb10.3.12 version, we need to upgrade

[root@localhost ~] # yum install systemd-libs-y

1.4. install mariadb

The yum configuration has been completed before, so it is installed directly here.

[root@localhost yum.repos.d] # yum install mariadb-server-y

1.5 start mariadb

[root@localhost ~] # systemctl start mariadb

[root@localhost ~] # systemctl enable mariadb

[root@localhost ~] # systemctl status mariadb

1.6. simple configuration of MariaDB

[root@localhost ~] # mysql_secure_installation

After setting the password, you will be prompted to enter the password first.

Enter current password for root (enter for none): = 2.0.

Query_cache_size=0-- Only mandatory for MariaDB versions prior to MariaDB Galera Cluster 5.5.40, MariaDB Galera Cluster 10.0.14, and MariaDB 10.1.2. Only applicable to MariaDB versions prior to MariaDB Galera Cluster 5.5.40 and MariaDB Galera Cluster 10.0.14 and MariaDB 10.1.2.

Wsrep_on=ON-Enable wsrep replication (starting 10.1.1)

The following figure shows the default variable parameters for the mariadb10.3.12 version

If you want to start the cluster, you must modify these parameters and back up the configuration file before modifying it.

The following are the modified configuration parameters

[galera]

# Mandatory settings

Wsrep_on=ON

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

Wsrep_cluster_address= "gcomm://111.111.111.200111.111.111.201111.111.111.202"

Binlog_format=row

Default_storage_engine=InnoDB

Innodb_autoinc_lock_mode=2

#

# Allow server to accept connections on all interfaces.

#

# bind-address=0.0.0.0

#

# Optional setting

# wsrep_slave_threads=1

# innodb_flush_log_at_trx_commit=0

# this is only for embedded server

-- it is recommended to enable the database log_err log. This parameter is read-only. You can only modify the configuration file and restart the database to take effect, so specify it during installation to facilitate log troubleshooting. In the server.cnf file, add this parameter under [mysql].

Log_error=/var/lib/mysql/mariadb01.err

3.2. Start the cluster command:

Mysqld-defaults-file=/etc/my.cnf.d/server.cnf-user=mysql-wsrep-new-cluster-wsrep-cluster-address= "gcomm://"

Systemctl start mariadb-wsrep-new-cluster-wsrep-cluster-address= "gcomm//:111.111.111.200111.111.111.201111.111.111.202"

The Systemd and Bootstrapping-- official website commands:

On operating systems that use systemd, a node can be bootstrapped in the following way:

$galera_new_cluster

This test uses the cluster started by the galear_new_cluster command

3.3. Other nodes join the cluster

All are configured according to the server.cnf file of 1 node, and then systemctl restart mariadb will be fine.

3.4. View cluster status

Use the show status like 'wsrep_cluster_size' command to check the cluster status. A value of 3 proves that the cluster has 3 nodes.

IV. matters needing attention

1. Close selinux! Otherwise, you will not be able to connect to the cluster; if selinux is enabled, after you modify the database directory, the startup database will report that innodb cannot be initialized.

2. Turn off the firewall! Or open the relevant ports on their own.

3. Each node needs to use the same version of MariaDB, otherwise there will be all kinds of problems!

4. If it is an existing database that contains data outside the cluster, do not connect to the cluster as a successor node, otherwise the original data will be cleared by the cluster data!

5. The purpose of this test is to quickly deploy MariaDB. All the parameters are not tuned, and only meet the installation requirements. The actual production environment needs to explore and optimize the relevant parameters!

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