mariadb master and salve configure
mariadb master and salve configure 主从复制配置: master:192。168.8.200
salve:192.168.8.201 主服务器配置: 主服务器需要启动二进制日志,主服务器每次数据的改变,都会记录到二进制日志;
配置主服务my.cnf文件;
[root@localhost data]# egrep -v "^$|^#" /etc/my.cnf
datadir = /mydata/data
skip_name_resolve = ON //跳过域名解析
innodb_file_per_table = ON //innodb使用独立表空间;
log-bin=mysql-bin //启动二进制日志
binlog_format=mixed //日志滚动方式;
server-id = 1 //唯一id
创建可复制权限账号:
MariaDB [(none)]> grant replication slave,replication client on *.* to 'glq'@'192.168.%.%' identified by '123123';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec) MariaDB [(none)]> show master status; //查看二进制日志文件file和postion,需要在slave制定复制日志信息;
+------------------+----------+--------------+------------------+
| File | Position | Binlog_Do_DB | Binlog_Ignore_DB |
+------------------+----------+--------------+------------------+
| mysql-bin.000005 | 245 | | |
+------------------+----------+--------------+------------------+
1 row in set (0.01 sec) 从服务器配置:
[root@localhost ~]# egrep -v "^$|^#" /etc/my.cnf
skip_name_resolve = ON
innodb_file_per_table = ON
datadir = /mydata/data
relay-log = relay-log //开启中继日志;
relay-log = relay-log.index
log-bin=mysql-bin
binlog_format=mixed
server-id = 2
[root@localhost ~]# service mysqld restart
MariaDB [(none)]> change master to master_host='192.168.8.200',master_user='glq',master_password='123123',master_log_file='mysql-bin.000005',master_log_pos='245'; //设置复制线程,指定master password,user,二进制日志信息; MariaDB [(none)]> start slave; 启动从server
MariaDB [(none)]> show slave status\G
*************************** 1. row ***************************
Slave_IO_State: Waiting for master to send event
Master_Host: 192.168.8.200
Master_User: glq
Master_Port: 3306
Connect_Retry: 60
Master_Log_File: mysql-bin.000005
Read_Master_Log_Pos: 765
Relay_Log_File: relay-log.000002
Relay_Log_Pos: 1049
Relay_Master_Log_File: mysql-bin.000005
Slave_IO_Running: Yes
Slave_SQL_Running: Yes
Replicate_Do_DB:
Replicate_Ignore_DB:
Replicate_Do_Table:
Replicate_Ignore_Table:
Replicate_Wild_Do_Table:
Replicate_Wild_Ignore_Table:
Last_Errno: 0
Last_Error:
Skip_Counter: 0
Exec_Master_Log_Pos: 765
Relay_Log_Space: 1337
Until_Condition: None
Until_Log_File:
Until_Log_Pos: 0
Master_SSL_Allowed: No
Master_SSL_CA_File:
Master_SSL_CA_Path:
Master_SSL_Cert:
Master_SSL_Cipher:
Master_SSL_Key:
Seconds_Behind_Master: 0
Master_SSL_Verify_Server_Cert: No
Last_IO_Errno: 0
Last_IO_Error:
Last_SQL_Errno: 0
Last_SQL_Error:
Replicate_Ignore_Server_Ids:
Master_Server_Id: 1
1 row in set (0.00 sec)
至此从服务器配置完成。 在主服务器创建数据库,插入数据
MariaDB [(none)]> create database testdb;
Query OK, 1 row affected (0.00 sec) MariaDB [(none)]> use testdb;
Database changed
MariaDB [testdb]> create table GEELY(id int unsigned not null auto_increment primary key,name char(20) not null,cardID varchar(10));
Query OK, 0 rows affected (0.01 sec) MariaDB [testdb]> desc GEELY
-> ;
+--------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+--------+------------------+------+-----+---------+----------------+
| id | int(10) unsigned | NO | PRI | NULL | auto_increment |
| name | char(20) | NO | | NULL | |
| cardID | varchar(10) | YES | | NULL | |
+--------+------------------+------+-----+---------+----------------+
3 rows in set (0.00 sec) MariaDB [testdb]> insert into GEELY(name,cardID)values('glq',123123),('zyn',123321);
Query OK, 2 rows affected (0.01 sec)
Records: 2 Duplicates: 0 Warnings: 0 MariaDB [testdb]> select * from GEELY;
+----+------+--------+
| id | name | cardID |
+----+------+--------+
| 1 | glq | 123123 |
| 2 | zyn | 123321 |
+----+------+--------+
2 rows in set (0.00 sec) 在从服务器查看是否同步
MariaDB [(none)]> use testdb;
Database changed
MariaDB [testdb]> select * from GEELY;
+----+------+--------+
| id | name | cardID |
+----+------+--------+
| 1 | glq | 123123 |
| 2 | zyn | 123321 |
+----+------+--------+
2 rows in set (0.00 sec)
至此主从服务配置完成;
mariadb master and salve configure的更多相关文章
- RocketMQ多master多salve集群搭建
一.RocketMQ集群模式简介 单Master方式 风险比较大, 一旦Broker重启或者宕机, 将导致整个环境不可用, 不建议线上使用. 多Master模式 一个集群中没有slave, 全是mas ...
- redis如何查看主从状态信息master和salve
首先你需要连接上redis [root@localhost src]# ./redis-cli -p 6384 --第一步从客户端命令工具连接redis 127.0.0.1:6384> auth ...
- MariaDB——(三) MariaDB 10.0.15 standard replication主从复制搭建
最近看了一下MariaDB的常规复制章节,就按部就班的搭建了一下最简单的主从复制.需要的硬件环境很简单(在虚拟机VMware中搭建): 1:两台server:Master: 192.168.6.133 ...
- Redis的复制(Master/Slave)
是什么 : 也就是我们所说的主从复制,主机数据更新后根据配置和策略,自动同步到备机的master/slaver机制,Master以写为主,Slave以读为主 能干嘛: 读写分离,容灾恢复 怎么玩: 1 ...
- MariaDB MaxScale
1. down https://mariadb.com/downloads/#mariadb_platform-mariadb_maxscale (1) install sudo yum locali ...
- kubernetes 测试 Mariadb gtid 主从复制.
k8s 为 1个master 3个node 下载镜像 : mariadb 镜像版本是10.2.13 (此时10.3还没发布正式版) docker pull mariadb push到私有仓库 dock ...
- mariadb主从备份
mariadb主从备份 master主库配置 停止mariadb systemctl stop mariadb 修改配置文件my.conf vim /etc/my.cnf [mysqld] serve ...
- mariadb+centos7+主从复制
MYSQL(mariadb) MariaDB数据库管理系统是MySQL的一个分支,主要由开源社区在维护,采用GPL授权许可.开发这个分支的原因之一是:甲骨文公司收购了MySQL后,有将MySQL闭源的 ...
- jenkins集群(二)(master --> slave) -- allure自动化测试报告部署
一.前提 1.环境 1)已经部署好了jenkins环境,包括jenkins的“全局工具配置”也配好了. 2.master与slave的简单的概念 1)master:jenkins部署所在的机器 2)s ...
随机推荐
- ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory 【学习笔记】【原创】
作者:庄泽彬(欢迎转载,请注明作者) 说明:千辛万苦终于在ubuntu18.04上安装好cuda9.1与cudnn7.0.5,但是导入import tensorflow as tf却报了这个错误. 上 ...
- Django怎么获取get请求里面的参数
获取get请求里面参数的两种方法之三种写法一,当get网址是127.0.0.1:8000/info/?id=20&s_id=30这种类型的网址时 我们在urls的路由的urlpatterns里 ...
- 用 Rprof 进行性能分析
R 提供了内置函数 Rprof( ) 对代码的性能进行分析.在分析过程中,会有一个抽样程序,并且是和后续代码一起运行的,直到分析结束.默认情况下,抽样程序基本上每隔20 毫秒就会记录一下当前 R 在运 ...
- XML_CPP_资料_libXml2_01
ZC: 看了一些 C/C++的XML文章,也看了一些 Qt的 QXmlQuery/QXmlSimpleReader/QXmlStreamReader/QXmlStreamWriter 的文章.总体感觉 ...
- Python在七牛云平台的应用(一)
七牛云:(引用百度的介绍)七牛云是国内领先的企业级公有云服务商,致力于打造以数据为核心的场景化PaaS服务.围绕富媒体场景,七牛先后推出了对象存储,融合CDN加速,数据通用处理,内容反垃圾服务,以及直 ...
- Oracle 9i & 10g编程艺术-深入数据库体系结构-学习笔记(持续更新中)
--20170322 --1.0 --更新表的统计信息begin dbms_stats.set_table_stats(user,'EMP',numrows => 10000);end; beg ...
- 本地Jdev Run PG报严重: Socket accept failed错误
严重: Socket accept failed java.net.SocketException: select failed at java.net.PlainSocketImpl.socketA ...
- Spring 调度任务@scheduled学习总结
官网Api:http://docs.spring.io/spring/docs/current/spring-framework-reference/html/scheduling.html#sche ...
- hdu 3264 09 宁波 现场 E - Open-air shopping malls 计算几何 二分 圆相交面积 难度:1
Description The city of M is a famous shopping city and its open-air shopping malls are extremely at ...
- Use appropriate component from RM component palette
--------------------------- 错误 --------------------------- Opened report contains the following non- ...