Configuring the MariaDb cluster on Fedora Server

Source: Internet
Author: User

Download and install MariaDB Galera Cluster

Install before 10.1, enter the following command to install:

sudo DNF install Mariadb-galera-server

If the mariadb Server is not already installed on the computer, it will be installed, and if it is installed, the relevant package will be updated.

After 10.1, MARIADB server packs the cluster functionality together, so you install the database directly without installing it separately:

sudo DNF install Mariadb-server
Configuration

Basic steps, use--wsrep-new-cluster to create a cluster (used only on the first node) and join the node with--wsrep_cluster_address=gcomm://192.168.0.1.

Since the text is using Fedora, service management is SYSTEMD, so you need to modify the Mariadb.service and add the parameters.

Modified Startup file:

[Unit] DESCRIPTION=MARIADB 10.1 Database Serverafter=network.target[service]type=notifyuser=mysqlgroup=mysqlexecstartpre =/usr/libexec/mysql-check-socket# '%n ' expands to ' full unit name '; Man Systemd.unitexecstartpre=/usr/libexec/mysql-prepare-db-dir%n# mysqld_opts Here's for users to set in/etc/systemd/s Ystem/[email protected]/my_special.conf# Note:we set--basedir to prevent probes that might trigger SELinux alarms,# per Bug #547485execstart=/usr/libexec/mysqld--basedir=/usr $MYSQLD _opts $_wsrep_new_cluster $_wsrep_cluster_addressexecstartpost=/usr/libexec/mysql-check-upgradeexecstoppost=/usr/libexec/mysql-wait-stop# Setting this to True can Break replication and the type=notify settings# See also bind-address mysqld option. privatenetwork=falsekillmode=processkillsignal=sigterm# Don ' t want to see a automated SIGKILL eversendsigkill=no# Restart crashed server only, On-failure would also Restart, for example, when# my.cnf contains unknown optionrestart=on-ab  ortrestartsec=5sumask=007# Give A reasonable amount of time for the server to start Up/shut downtimeoutsec=300# Place Temp Files in a secure directory, Not/tmpprivatetmp=true[install]wantedby=multi-user.target

  

Environment settings for the first node:

Systemctl Show-environmentlang=en_us. Utf-8path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin_wsrep_cluster_address=--wsrep_cluster_ Address=gcomm://192.168.30.184_wsrep_new_cluster=--wsrep-new-cluster

Environment configuration for a second node

Systemctl Show-environmentlang=en_us. Utf-8path=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin_wsrep_cluster_address=--wsrep_cluster_ address=gcomm://192.168.30.184
Test

For testing convenience, first shut down the firewall and SELinux. Start the first node first, and then start the second node. Create a database on one of the nodes and switch to the other node to see the database.

You can view the status of a cluster by using the data command:

SHOW STATUS like ' wsrep_% '; +------------------------------+-----------------------------------------+| variable_name | Value |+------------------------------+-----------------------------------------+| Wsrep_apply_oooe | 0.000000 | | Wsrep_apply_oool | 0.000000 | | Wsrep_apply_window | 1.000000 | | Wsrep_causal_reads | 0 | | Wsrep_cert_deps_distance | 1.000000 | | Wsrep_cert_index_size | 2 | | Wsrep_cert_interval | 0.000000 | | wsrep_cluster_conf_id | 189 | | Wsrep_cluster_size | 2 | | Wsrep_cluster_state_uuid | e5b100e2-7f7e-11e7-9266-de309a905227 | | Wsrep_cluSter_status | Primary | | Wsrep_commit_oooe | 0.000000 | | Wsrep_commit_oool | 0.000000 | | Wsrep_commit_window | 1.000000 | | wsrep_connected | On | | Wsrep_desync_count | 0 | |                                         wsrep_evs_delayed | ||                                         Wsrep_evs_evict_list | || wsrep_evs_repl_latency | 0/0/0/0/0 | | Wsrep_evs_state | Operational | | wsrep_flow_control_paused | 0.000000 | | Wsrep_flow_control_paused_ns | 0 | | Wsrep_flow_control_recv | 0 | | wsrep_flow_control_sent |               0                        || Wsrep_gcomm_uuid | f023c418-7f81-11e7-bfbb-86741b99a879 | | wsrep_incoming_addresses | 192.168.30.184:3306,192.168.30.186:3306 | | wsrep_last_committed | 3 | | Wsrep_local_bf_aborts | 0 | | Wsrep_local_cached_downto | 1 | | Wsrep_local_cert_failures | 0 | | Wsrep_local_commits | 0 | | Wsrep_local_index | 1 | | Wsrep_local_recv_queue | 0 | | Wsrep_local_recv_queue_avg | 0.125000 | | Wsrep_local_recv_queue_max | 2 | | Wsrep_local_recv_queue_min | 0 | | Wsrep_local_replays | 0 | | Wsrep_local_send_queue | 0 | | Wsrep_local_send_queue_avg | 0.000000 | | Wsrep_local_send_queue_max | 1 | | Wsrep_local_send_queue_min | 0 | | Wsrep_local_state | 4 | | wsrep_local_state_comment | synced | | Wsrep_local_state_uuid | e5b100e2-7f7e-11e7-9266-de309a905227 | | wsrep_protocol_version | 7 | | Wsrep_provider_name | Galera | | Wsrep_provider_vendor | Codership Oy <[email protected]> | | wsrep_provider_version | 3.16 (R5C765EB) | | Wsrep_ready | On | | wsrep_received | 8 | | Wsrep_received_bytes |    2148                                || Wsrep_repl_data_bytes | 0 | | Wsrep_repl_keys | 0 | | Wsrep_repl_keys_bytes | 0 | | Wsrep_repl_other_bytes | 0 | | wsrep_replicated | 0 | | Wsrep_replicated_bytes | 0 | | Wsrep_thread_count | 2 |+------------------------------+-----------------------------------------+

  

Configuring the MariaDb cluster on Fedora Server

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.