Howtoinstallmariadbw.acluster5.5ondebia

Source: Internet
Author: User
Why is MariaDB, why Galera, And why Debian? Let's get started with these things. Reference: AskMontyKB. 1. Install mariadbw.acluster on the two machines respectively. You can use two virtual machines and ping each other's IP addresses. Because apt-get is so easy to use, please ensure that your De

Why is MariaDB, why Galera, And why Debian? Let's get started with these things. Reference: AskMonty KB. 1. Install MariaDB Galera Cluster on the two machines respectively. You can use two virtual machines and ping each other's IP addresses. Because apt-get is so easy to use, please ensure that your De

Why is MariaDB, why Galera, And why Debian? Let's get started with these things.

Reference: AskMonty KB.

1. Install MariaDB Galera Cluster on the two machines respectively. You can use two virtual machines and ping each other's IP addresses.
Because apt-get is so easy to use, please ensure that your Debian can be connected to the Internet and then execute:

# Apt-key adv -- recv-keys -- keyserver keyserver.ubuntu.com 0xcb082a1bb943db # cd/etc/apt/sources. list. d/-- create MariaDB. list file # vi MariaDB. list -- Add the following content # MariaDB 5.5 repository list-created UTC # http://mariadb.org/mariadb/repositories/deb  http://mirrors.fe.up.pt/pub/mariadb/repo/5.5/debian Squeeze maindeb-src http://mirrors.fe.up.pt/pub/mariadb/repo/5.5/debian Squeeze main -- update apt resources # apt-get update # apt-cache search mariadblibmariadbclient-dev-MariaDB database development ready-MariaDB database client librarylibmariadbd-dev-MariaDB embedded database development ready-Virtual package to satisfy external dependsmariadb-client-MariaDB database client (metapackage depending on the latest version) mariadb-client-5.5- MariaDB database client binariesmariadb-client-core-5.5-MariaDB database core client binariesmariadb-common-MariaDB database common files (e.g. /etc/mysql/conf. d/mariadb. cnf) mariadb-galera-server-MariaDB database server with Galera clustermariadb-galera-server-5.5-MariaDB database server with Galera cluster binariesmariadb-server-MariaDB database server (metapackage depending on the lat Est version) mariadb-server-5.5-MariaDB database server binariesmariadb-server-core-5.5-MariaDB database core server filesmariadb-test-MariaDB database regression test suite (metapackage depending on the latest version) mariadb-test-5.5-MariaDB database regression test suitemysql-common-MariaDB database common files (e.g. /etc/mysql/my. cnf) -- you only need to install mariadb-galera-server. Note that the pre-installed M In Debian will be automatically uninstalled. YSQL 5.1 # apt-get install mariadb-galera-serverReading package lists... doneBuilding dependency treeReading state information... doneThe following extra packages will be installed: galera libaio1 libmariadbclient18 libmysqlclient18 mariadb-client-5.5 mariadb-client-core-5.5 mariadb-common mariadb-galera-server-5.5Suggested packages: tinyca mariadb-testThe following packages will be REMOVED: mysql- Client-5.1 mysql-server mysql-server-5.1 mysql-server-core-5.1The following NEW packages will be installed: galera libaio1 libmariadbclient18 libmysqlclient18 mariadb-client-5.5 mariadb-client-core-5.5 mariadb-galera-server-5.50 mariadb-common mariadb-galera-server upgraded, 9 newly installed, 4 to remove and 46 not upgraded. need to get 32.3 MB of archives. after this operation, 55.2 MB of addition Al disk space will be used. Do you want to continue [Y/n]?

2. Modify the my. cnf file, or add the following lines to both nodes.

# Vi/etc/mysql/my. cnfwsrep_cluster_name = region = debianwsrep_provider =/usr/lib/galera/region = mysqldumpbinlog_format = ROWdefault_storage_engine = region = 1 -- note that by default, MariiaDB only listens to localhost, therefore, you need to modify the bind-address parameter's first node: bind-address = 192.168.1.108 second node: bind-address = 192.168.1.109

3. Start the first node

-- If the database has been started, close it first #/etc/init. d/mysql stop -- start MariaDB Galera Cluster #/usr/bin/mysqld_safe -- wsrep_cluster_address = gcomm: //>/dev/null 2> & 1 &

4. Start the second node

-- 192.168.1.108 is the listening IP address of MariaDB on the first node #/usr/bin/mysqld_safe -- wsrep_cluster_address = gcomm: // 192.168.1.108>/dev/null 2> & 1 &

5. Check the status of the entire Cluster.

-- Log on to MariaDB # mysql MariaDB [(none)]> show status like 'wsrep % 'on any machine '; + partition + | Variable_name | Value | + partition + | wsrep_local_state_uuid | partition | wsrep_protocol_version | 4 | wsrep_last_committed | 9 | wsrep_replicated | 0 | bytes | 0 | | wsrep_received | 2 | wsrep_received_bytes | 198 | wsrep_local_commits | 0 | disabled | 0 | disabled | 0 | wsrep_local_replays | 0 | disabled | 0 | disabled | 0.000000 | | metrics | 0 | metrics | 0.000000 | metrics | 0.000000 | wsrep_flow_control_sent | 0 | wsrep_flow_control_recv | 0 | metrics | 0.000000 | wsrep_apply_oooe | 0.000000 | wsrep_apply_oool | 0.000000 | wsrep_apply_window | 0.000000 | temperature | 0.000000 | temperature | 0.000000 | wsrep_commit_window | 0.000000 | wsrep_local_state | 4 | temperature | Synced | wsrep_cert_index_size | 0 | temperature | 0 | | wsrep_incoming_addresses | 192.168.1.108: 3306,192.168 .1.109: 3306 | metrics | 6 | wsrep_cluster_size | 2 | metrics | wsrep_cluster_status | Primary | wsrep_connected | ON | wsrep_local_index | 0 | wsrep_provider_name | Galera | metrics | codership Oy | wsrep_provider_version | 23.2.4 (r147) | wsrep_ready | ON | + ---------------------------- + ----------------------------------------- + 40 rows in set (0.00 sec)

6. Test dual-active read/write

-- Select any node to CREATE a DATABASE, CREATE a table, and insert data MariaDB [(none)]> create database if not exists my_db default charset utf8 COLLATE utf8_general_ci; Query OK, 1 row affected( 0.01 sec )? MariaDB [(none)]> connect my_dbConnection id: 8 Current database: my_db? MariaDB [my_db]> create table my_table (name varchar (20) not null default '') default charset utf8; Query OK, 0 rows affected (0.00 sec )? MariaDB [my_db]> insert into my_table values ('enmotech '); Query OK, 1 row affected (0.00 sec )? -- Query and update MariaDB [my_db]> select * from my_table on another node; + ---------- + | name | + ---------- + | enmotech | + ---------- + 1 row in set (0.00 sec )? MariaDB [my_db]> update my_table set name = 'enmotech _ my' where name = 'enmotech '; Query OK, 1 row affected (0.00 sec) Rows matched: 1 Changed: 1 Warnings: 0? -- Query MariaDB [my_db]> select * from my_table; + ---------------- + | name | + ------------------ + | enmotech_mysql | + ---------------- + 1 row in set (0.00 sec) on the previous Node)

This article is just the simplest installation and functional testing. No matter the robustness, efficiency, and fault tolerance, at least the configuration of this active-active database is simpler than any solution of Oracle.

Share/Save

Related posts:

  1. How to change VIP interface in 10g cluster
  2. How to install strongread on Ubuntu 810
  3. How to change private interface in 10g cluster

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.