记录分享工作的点点滴滴

0%

常用操作命令

./mysqlsh –mysql –uri dba@localhost:3008 –password=5d63f33c10b8f430

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
 MySQL  localhost:3008 ssl  JS > dba.getCluster()
Dba.getCluster: This function is not available through a session to an instance belonging to an unmanaged replication group (RuntimeError)
MySQL localhost:3008 ssl JS > dba.createCluster('test2020')
A new InnoDB cluster will be created on instance 'localhost:3008'.

You are connected to an instance that belongs to an unmanaged replication group.
Do you want to setup an InnoDB cluster based on this replication group? [Y/n]: Y
Creating InnoDB cluster 'test2020' on '10.162.16.15:3008'...

Adding Seed Instance...
NOTE: Metadata schema found in target instance
Adding Instance '10.162.16.17:3010'...
Adding Instance '10.162.16.16:3009'...
Adding Instance '10.162.16.15:3008'...
Resetting distributed recovery credentials across the cluster...
WARNING: User 'mysql_innodb_cluster_3'@'%' already existed at instance '10.162.16.15:3008'. It will be deleted and created again with a new password.
WARNING: User 'mysql_innodb_cluster_2'@'%' already existed at instance '10.162.16.15:3008'. It will be deleted and created again with a new password.
WARNING: User 'mysql_innodb_cluster_1'@'%' already existed at instance '10.162.16.15:3008'. It will be deleted and created again with a new password.
Cluster successfully created based on existing replication group.

元数据表

cluster

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
mysql> select * from clusters;
+--------------------------------------+--------------+-----------------+---------+-----------------------------------------------------------------------------------------------------------------------------------------+--------------+--------------+----------------+
| cluster_id | cluster_name | description | options | attributes | cluster_type | primary_mode | router_options |
+--------------------------------------+--------------+-----------------+---------+-----------------------------------------------------------------------------------------------------------------------------------------+--------------+--------------+----------------+
| 010041bc-9b41-11ea-88ad-08688d61c0e5 | test2020 | Default Cluster | NULL | {"adopted": 1, "default": true, "opt_gtidSetIsComplete": false, "group_replication_group_name": "291e41a2-6f40-11ea-a9da-74867aea62bc"} | gr | pm | NULL |
+--------------------------------------+--------------+-----------------+---------+-----------------------------------------------------------------------------------------------------------------------------------------+--------------+--------------+----------------+
1 row in set (0.00 sec)

mysql> select * from v2_gr_clusters;
+--------------+--------------+--------------------------------------+--------------+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+---------+----------------+-----------------+-----------------------+
| cluster_type | primary_mode | cluster_id | cluster_name | group_name | attributes | options | router_options | description | replicated_cluster_id |
+--------------+--------------+--------------------------------------+--------------+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+---------+----------------+-----------------+-----------------------+
| gr | pm | 010041bc-9b41-11ea-88ad-08688d61c0e5 | test2020 | 291e41a2-6f40-11ea-a9da-74867aea62bc | {"adopted": 1, "default": true, "opt_gtidSetIsComplete": false, "group_replication_group_name": "291e41a2-6f40-11ea-a9da-74867aea62bc"} | NULL | NULL | Default Cluster | NULL |
+--------------+--------------+--------------------------------------+--------------+--------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------+---------+----------------+-----------------+-----------------------+
1 row in set (0.00 sec)

instance

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
mysql> select * from instances;
+-------------+--------------------------------------+-------------------+--------------------------------------+-------------------+--------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------+
| instance_id | cluster_id | address | mysql_server_uuid | instance_name | addresses | attributes | description |
+-------------+--------------------------------------+-------------------+--------------------------------------+-------------------+--------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------+
| 1 | 010041bc-9b41-11ea-88ad-08688d61c0e5 | 10.162.16.17:3010 | 7704c3a4-8927-11ea-b68b-08688d61c0df | 10.162.16.17:3010 | {"mysqlX": "10.162.16.17:33060", "grLocal": "10.162.16.17:33061", "mysqlClassic": "10.162.16.17:3010"} | {"recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_3"} | NULL |
| 2 | 010041bc-9b41-11ea-88ad-08688d61c0e5 | 10.162.16.16:3009 | acf9368d-8923-11ea-825b-08688d61c1b7 | 10.162.16.16:3009 | {"mysqlX": "10.162.16.16:33060", "grLocal": "10.162.16.16:33061", "mysqlClassic": "10.162.16.16:3009"} | {"recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_2"} | NULL |
| 3 | 010041bc-9b41-11ea-88ad-08688d61c0e5 | 10.162.16.15:3008 | bc0d147b-891f-11ea-ae49-08688d61c0e5 | 10.162.16.15:3008 | {"mysqlX": "10.162.16.15:33060", "grLocal": "10.162.16.15:33061", "mysqlClassic": "10.162.16.15:3008"} | {"recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_1"} | NULL |
+-------------+--------------------------------------+-------------------+--------------------------------------+-------------------+--------------------------------------------------------------------------------------------------------+-------------------------------------------------------------------------------+-------------+
3 rows in set (0.00 sec)

mysql> select * from v2_instances;
+-------------+--------------------------------------+-------------------+--------------------------------------+-------------------+-------------------+--------------------+-------------------------------------------------------------------------------+
| instance_id | cluster_id | label | mysql_server_uuid | address | endpoint | xendpoint | attributes |
+-------------+--------------------------------------+-------------------+--------------------------------------+-------------------+-------------------+--------------------+-------------------------------------------------------------------------------+
| 1 | 010041bc-9b41-11ea-88ad-08688d61c0e5 | 10.162.16.17:3010 | 7704c3a4-8927-11ea-b68b-08688d61c0df | 10.162.16.17:3010 | 10.162.16.17:3010 | 10.162.16.17:33060 | {"recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_3"} |
| 2 | 010041bc-9b41-11ea-88ad-08688d61c0e5 | 10.162.16.16:3009 | acf9368d-8923-11ea-825b-08688d61c1b7 | 10.162.16.16:3009 | 10.162.16.16:3009 | 10.162.16.16:33060 | {"recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_2"} |
| 3 | 010041bc-9b41-11ea-88ad-08688d61c0e5 | 10.162.16.15:3008 | bc0d147b-891f-11ea-ae49-08688d61c0e5 | 10.162.16.15:3008 | 10.162.16.15:3008 | 10.162.16.15:33060 | {"recoveryAccountHost": "%", "recoveryAccountUser": "mysql_innodb_cluster_1"} |
+-------------+--------------------------------------+-------------------+--------------------------------------+-------------------+-------------------+--------------------+-------------------------------------------------------------------------------+
3 rows in set (0.00 sec)
1
2
3
4
5
6
7
mysql> select * from v2_this_instance;
+--------------------------------------+-------------+--------------+--------------+
| cluster_id | instance_id | cluster_name | cluster_type |
+--------------------------------------+-------------+--------------+--------------+
| 010041bc-9b41-11ea-88ad-08688d61c0e5 | 3 | test2020 | gr |
+--------------------------------------+-------------+--------------+--------------+
1 row in set (0.01 sec)

api

在组复制中,有一张表用来监视组中各成员的不同实例的状态。表信息会随着视图的更改而变更,当组中成员动态变化时,实例之间会交互一些元数据信息并继续合作。该表信息在所有实例之间共享的。

阅读全文 »

MySQL Router是轻量级的中间件,可在您的应用程序与任何后端MySQL Server之间提供透明的路由。它可以用于多种使用案例,例如通过有效地将数据库流量路由到适当的后端MySQL服务器来提供高可用性和可伸缩性

阅读全文 »

InnoDB Cluster 介绍

MySQL InnoDB 集群为 MySQL 提供了完整的高可用性解决方案。 MySQL Shell包含AdminAPI,能轻松配置和管理MySQL实例组,组内的每个MySQL实例都运行MGR,MGR提供了InnoDB集群内部数据复制和内置的故障转移功能。 MySQL Router 能够根据部署的集群进行自我配置,将连接客户端的应用转移到后端服务器实例上。

阅读全文 »

单主模式下部署MGR集群

我们通过在3台服务器上部署3个MySQL Server 实例来创建组复制,组复制提供了内部数据复制和内部故障转移的机制。在单主模式下,primary节点故障,会有一个secondary节点自动晋升我primary。

阅读全文 »

克隆插件简介

从MySQL 8.0.17开始,MySQL提供了一个克隆插件,允许在本地或从远程MySQL服务器实例克隆InnoDB其中的数据的物理快照。

  • 支持两种克隆方式:本地克隆和远程克隆
  • 支持克隆加密数据
  • 支持克隆压缩数据
  • 支持克隆复制
阅读全文 »

引言

Python中有个非常重要的第三方库 Numpy, 它不仅是Python中使用最多的第三方库,还是 SciPy、Pandas 等数据科学的基础。Numpy 提供的数据结构比Python 自身更高级更高效,是Python 数据分析的基础。

阅读全文 »

1. 今天是周末

吃饭|睡觉|学习

1
一天三顿饭、睡够八小时、学习到深夜

2. 猥琐发育 别出去浪

1
特殊时期宅在家里

3. 在自己网站上发布了第一篇文章

1
$ hello  world !

More info: Deployment