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

Linux-Mycat- installation configuration

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

Share

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

MyCat introduction

The "large database cluster" for enterprise application development supports transaction, ACID, and enhanced database that can replace Mysql.

An enterprise-level database that can be regarded as a "Mysql" cluster to replace the expensive Oracle cluster

Integration of memory cache technology, Nosql technology, HDFS big data's new SQL Server

A New Generation of Enterprise Database products combining traditional Database and New distributed data Warehouse

The goals of MyCat are:

Low-cost smooth migration of existing stand-alone databases and applications to the "cloud" side to solve the data bottleneck problem in the case of rapid growth of data storage and business scale.

Key features of MyCat

Support for SQL 92 standard

Mysql clusters are supported and can be used as Proxy

Support JDBC to connect ORACLE, DB2, SQL Server to simulate the use of MySQL Server

Support galera for mysql cluster, percona-cluster or mariadb cluster, and provide high availability data sharding cluster

Automatic failover, high availability

Support read-write separation, support Mysql dual master multi-slave mode, and one master multi-slave mode

Supports global tables and automatically splits data to multiple nodes for efficient table association queries

The unique slicing strategy based on Emurr relationship is supported, and efficient table association query is realized.

Multi-platform support, simple deployment and implementation

MyCat architecture

Mycat highly available parameters

Instructions on the highly available schema.xml configuration parameters for Mycat:

Balance attribute

The following four types of load balancers are available.

* balance= "0": the read-write separation mechanism is not enabled, and all read operations are sent to the currently available writeHost.

* balance= "1": all readHost and stand by writeHost participate in the load balancing of select statements. In short, when it is a dual-master and double-slave mode (M1-> S1 < M2-> S2, and M1 and M2 are the master and standby of each other), under normal circumstances, M2, S1 and S2 all participate in the load balancing of select statements.

* balance= "2": all read operations are randomly distributed on writeHost and readHost.

* balance= "3": all read requests are randomly distributed to the corresponding readHost of writeHost for execution, and writeHost does not bear the read pressure.

WriteType attribute

Currently, there are two values for load balancer types.

* writeType= "0": all write operations are sent to the first writeHost of the configuration. If the writeHost is hung up, it will be cut to the writeHost2. After the writeHost1 node is restored, it will not be cut back again. The switch is recorded in the configuration file dnindex.properties, subject to writeHost2.

* writeType= "0": all write operations are randomly sent to the configured writeHost. This value is no longer recommended in the Mycat1.5 version.

SwitchType attribute

* switchType= "- 1": does not switch automatically.

* switchType= "1": default value (or 0), indicating automatic switching.

* switchType= "2": indicates whether to switch based on the status of MySQL master-slave synchronization. The heartbeat statement is as follows:

Show slave status

switchType= "3": indicates the handover mechanism based on MySQL Galary Cluster. The heartbeat statement is as follows:

Show status like 'wsrep%'

MySQL master-slave read-write separation environment

Project Mycat MySQL-master MySQL-slaveA MySQL-slaveB

IP 192.168.32.149 192.168.32.146 192.168.32.129 192.168.32.130

Port 8066/9066 3306 3306 3306

Java installation package:

Http://www.oracle.com/technetwork/java/javase/downloads/jdk10-downloads-4416644.html

Mycat installation package:

Http://www.mycat.io/

Extract to directory / usr/local/

# cd / usr/local/

# tar zxf jdk-10.0.1_linux-x64_bin.tar.gz

# tar zxf Mycat-server-1.6-RELEASE-20161028204710-linux.tar.gz

# / usr/local/mycat/bin/mycat start

# ss-lnt | grep mycat

# cd mycat/conf/

Configure server.xml first

× × is a logical library.

# vim server.xml

123456

TESTDB,aaa,bbb

Configure schema

# vim schema.xml

Select user ()

# / usr/local/mycat/bin/mycat restart

# mysql-u root-p123456-P 8066-h 127.0.0.1

Mysql > show databases

+-+

| | DATABASE |

+-+

| | TESTDB |

| | aaa |

| | bbb |

+-+

3 rows in set (0.00 sec)

Mysql > use aaa

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > show tables

+-+

| | Tables_in_db2 |

+-+

| | bbb |

+-+

1 row in set (0.00 sec)

Mysql > insert into bbb values (1)

Query OK, 1 row affected (0.04 sec)

MySQL-slaveB:

Mysql > show databases

+-+

| | Database |

+-+

| | information_schema |

| | db1 |

| | db2 |

| | db3 |

| | mysql |

| | performance_schema |

| | sys |

+-+

7 rows in set (0.10 sec)

Mysql > use db2

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with-A

Database changed

Mysql > show tables

+-+

| | Tables_in_db2 |

+-+

| | bbb |

+-+

1 row in set (0.01 sec)

Mysql > select * from bbb

+-+ +

| | id | name |

+-+ +

| | 1 | lijialiang |

+-+ +

1 rows in set (0.00 sec)

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