mysql innodb cluster服务器搭建
1、限于环境,只有2台服务器,一台安装mysql + mysqlrouter,另一台安装2个mysql实例;
2、添加2台服务器的/etc/hosts文件,如下:
192.168.1.223 dbserver01 192.168.1.224 dbserver02
3、准备安装包文件:
mysql-router-2.1.4-linux-glibc2.12-x86-64bit.tar.gz mysql-shell-1.0.10-linux-glibc2.12-x86-64bit.tar.gz mysql-5.7.20-linux-glibc2.12-x86_64.tar.gz
4、解压安装包到相应目录如:/test/mysql-3306,在/test/mysql-3306目录下创建data、log目录,创建my.cnf文件
my.cnf文件内容:
[mysqld] port = 3306 socket=/test/mysql-3306/mysql.sock basedir=/test/mysql-3306 datadir=/test/mysql-3306/data log-error=/test/mysql-3306/log/mysql.log pid-file=/test/mysql-3306/mysql.pid# Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0[mysqld_safe] port = 3306 socket=/test/mysql-3306/mysql.sock basedir=/test/mysql-3306 datadir=/test/mysql-3306/data log-error=/test/mysql-3306/log/mysql.log pid-file=/test/mysql-3306/mysql.pid[mysql] port = 3306 socket=/test/mysql-3306/mysql.sock[mysqladmin] port = 3306 socket=/test/mysql-3306/mysql.sock
5、拷贝init_3306.sh、login_3306.sh、start_3306.sh、stop_3306.sh到/test/mysql-3306目录,各文件内容如下:
init_3306.sh文件内容:
#!/bin/shbin/mysqld --defaults-file=/test/mysql-3306/my.cnf --initialize --user=root --console
login_3306.sh文件内容:
#!/bin/shbin/mysql --defaults-file=/test/mysql-3306/my.cnf -uroot -p
start_3306.sh文件内容:
#!/bin/shnohup bin/mysqld_safe --defaults-file=/test/mysql-3306/my.cnf --user=root >/dev/null 2>&1 &
stop_3306.sh文件内容:
#!/bin/shbin/mysqladmin --defaults-file=/test/mysql-3306/my.cnf shutdown -uroot -pxxxx@2017
6、执行init_3306.sh文件初始化数据库成功;
7、查看log/mysql.log文件中生成的密码;
8、执行start_3306.sh文件启动数据库成功;
9、执行login_3306.sh数据log文件中密码登录成功;
mysql> set sql_log_bin = 0; Query OK, 0 rows affected (0.00 sec)mysql> set password=password('xxxx@2017'); Query OK, 0 rows affected, 1 warning (0.00 sec)mysql> grant all privileges on *.* to 'root'@'%' identified by 'xxxx@2017' with grant option; Query OK, 0 rows affected, 1 warning (0.01 sec)mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)mysql> set sql_log_bin = 1; Query OK, 0 rows affected (0.00 sec)mysql> exit Bye
10、修改my.cnf文件,增加【mysqld】段内配置
server_id = 1 gtid_mode = ON enforce_gtid_consistency = ON master_info_repository = TABLE relay_log_info_repository = TABLE binlog_checksum = NONE log_slave_updates = ON log_bin = binlog binlog_format = ROWtransaction_write_set_extraction = XXHASH64
11、重启mysql,执行mysqlsh命令
[root@dbserver01 test]# mysqlsh MySQL Shell 1.0.10Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.Type '\help' or '\?' for help; '\quit' to exit.Currently in JavaScript mode. Use \sql to switch to SQL mode and execute queries. mysql-js> dba.configureLocalInstance('root@localhost:3306'); Please provide the password for 'root@localhost:3306': Detecting the configuration file... Default file not found at the standard locations. Please specify the path to the MySQL configuration file: /test/mysql-3306/my.cnf Validating instance...The instance 'localhost:3306' is valid for Cluster usage You can now use it in an InnoDB Cluster.{"status": "ok" } mysql-js>
12、创建集群实例
mysql-js> \c root@dbserver01:3306 Creating a Session to 'root@dbserver01:3306' Enter password: Your MySQL connection id is 8 Server version: 5.7.20-log MySQL Community Server (GPL) No default schema selected; type \use <schema> to set one. mysql-js> var cluster = dba.createCluster('szcluster'); A new InnoDB cluster will be created on instance 'root@dbserver01:3306'.Creating InnoDB cluster 'szcluster' on 'root@dbserver01:3306'... Adding Seed Instance...Cluster successfully created. Use Cluster.addInstance() to add MySQL instances. At least 3 instances are needed for the cluster to be able to withstand up to one server failure.mysql-js> cluster.status(); {"clusterName": "szcluster", "defaultReplicaSet": {"name": "default", "primary": "dbserver01:3306", "status": "OK_NO_TOLERANCE", "statusText": "Cluster is NOT tolerant to any failures.", "topology": {"dbserver01:3306": {"address": "dbserver01:3306", "mode": "R/W", "readReplicas": {}, "role": "HA", "status": "ONLINE"}}} } mysql-js>
13、完成另一台服务器两个实例的配置(执行到10、11步即可,无需执行12步)
14、mysqlrouter --bootstrap root@dbserver01:3306 --user=root
转载于:https://www.cnblogs.com/itpoorman/p/7754494.html
mysql innodb cluster服务器搭建相关推荐
- MySQL InnoDB Cluster
Mysql高可用环境的搭建比较麻烦,而且之前的那种mysql cluster使用的是内存式存储引擎,一旦断电就会灰飞烟灭,数据丢失. 自从mysql被oracle收购后,新版本发布频繁,推出了很多好用 ...
- mysql高可靠部署_可能是我见过最好的 MySQL 高可用解决方案 MySQL InnoDB Cluster 中文教程!...
公众号关注 「运维之美」设为「星标」,每天带你玩转 Linux ! 这篇文章将详细地介绍 MySQL 的高可用解决方案-- MySQL InnoDB Cluster. 说到高可用性,首先要了解一下什么 ...
- Mysql InnoDB Cluster部署装配
Mysql集群安装 参考官网:https://dev.mysql.com/doc/refman/5.7/en/mysql-innodb-cluster-userguide.html 环境简介: 四台虚 ...
- MySQL InnoDB Cluster部署
文章目录 安装 下载Yum存储库 安装发布包 导入密钥 安装MySQL 启动MySQL 查看临时口令 登录并修改口令 安装MySQL Shell InnoDB Cluster 账户配置 服务器配置账户 ...
- MySQL InnoDB Cluster安装
环境说明 centos 7.x 64位 mysql 5.7.20 编译源码安装 mysql shell linux generic版本 mysql router linux generic版本 路由节 ...
- 初探mysql innodb集群_MySQL InnoDB Cluster搭建
MySQL的高可用架构无论是社区还是官方,一直在技术上进行探索,这么多年提出了多种解决方案,比如MMM, MHA, NDB Cluster, Galera Cluster, InnoDB Cluste ...
- MySQL高可用之InnoDB Cluster
更多文章,欢迎关注作者公众号,欢迎一起交流. 本篇介绍一下MySQL的高可用解决方案--MySQL InnoDB Cluster,其实,该方案并不是全新的架构,它是基于MySQL Group Repl ...
- MySQL高可用架构InnoDB Cluster (和NDB Cluster是两码事)
MySQL的高可用架构无论是社区还是官方,一直在技术上进行探索,这么多年提出了多种解决方案,比如MMM, MHA, NDB Cluster, Galera Cluster, InnoDB Cluste ...
- InnoDB Cluster详解
目录 一.InnoDB Cluster简介 1. 整体架构 2. MySQL Shell 3. MySQL Router 4. MySQL服务器集群 二.创建InnoDB Cluster 1. 检查实 ...
- Mysql8 InnoDB Cluster Shell Router HA配置图解
Mysql8 InnoDB集群配置图解 声明与简介 本文的数据来自网络,部分代码也有所参照,这里做了注释和延伸,旨在技术交流,如有冒犯之处请联系博主及时处理.本文主要介绍mysql InnoDB Cl ...
最新文章
- YOLOV5 的小目标检测网络结构优化方法汇总(附代码)
- mysql语言的简介_谁能帮我介绍一下 MY SQL ?
- SAP PR 转 PO
- android ble从设备,从Android设备发送命令到蓝牙
- Django-model进阶
- spark应用程序_Sparklens:Spark应用程序优化工具
- 串口通信的基本原理----STM32
- php+mysql记事本_一个简单记事本php操作mysql辅助类创建
- java实体类中有枚举类型_当实体类中entity/DTO/VO等类中,有枚举值,应该怎么输出?...
- html菜单不动属性,html5规定元素的上下文菜单属性contextmenu
- 谈SQL SERVER数据库中的索引
- 统考英语和计算机什么时候出成绩单,网络教育统考成绩啥时候出来
- 计算机硬盘怎么优化,硬盘怎么优化_机械硬盘优化
- java中使用阻塞队列实现生产这与消费这之间的关系
- 我自定义安装office 但在ATA计算机考试系统考试时出现“没有正确的安装office” 怎么解决 求解
- 微带滤波器摘要_微带线带通滤波器设计
- background 组合写法_css中background复合属性详解
- 2009 Q.E.D
- 你是部门经理,老板对你说公司要裁员,你该怎么办?
- 场效应管和三极管的区别
热门文章
- 2021-09-23图嵌入方法
- MIMO-OTFS in High-Doppler Fading Channels:Signal Detection and Channel Estimation(3)
- 【 2019中国大学生程序设计竞赛(CCPC) - 网络选拔赛】1002.array【主席树】
- LINUX中文件的移动,Linux中文件移动文件的操作命令为 ()
- 微型计算机用于梯群控制时 其优点是,下列根尖周病的治疗要求中,说法不对的是A.要求无菌操作技术B.根管内应为无菌环境C.炎症渗出物应...
- 简单的springBoot集成jedis
- Mac/Homebrew查找nginx安装目录和nginx.conf配置文件目录
- MySQL Password Expired
- 数据结构--(AVL)平衡二叉树
- 物联网时代的技术迷雾