当前位置: 首页 > news >正文

网站建设服务网站新闻头条最新消息今天

网站建设服务网站,新闻头条最新消息今天,域名网址,to b网站推广怎么做📢📢📢📣📣📣 哈喽!大家好,我是【IT邦德】,江湖人称jeames007,10余年DBA及大数据工作经验 一位上进心十足的【大数据领域博主】!😜&am…

📢📢📢📣📣📣
哈喽!大家好,我是【IT邦德】,江湖人称jeames007,10余年DBA及大数据工作经验
一位上进心十足的【大数据领域博主】!😜😜😜
中国DBA联盟(ACDU)成员,目前服务于工业互联网
擅长主流Oracle、MySQL、PG、高斯及Greenplum运维开发,备份恢复,安装迁移,性能优化、故障应急处理等。
✨ 如果有对【数据库】感兴趣的【小可爱】,欢迎关注【IT邦德】💞💞💞
❤️❤️❤️感谢各位大可爱小可爱!❤️❤️❤️

文章目录

  • 前言
    • 📣 1.架构设计
    • 📣 2.OGG for MySQL部署
      • ✨ 2.1 安装客户端
      • ✨ 2.2 安装目录
      • ✨ 2.3.解压缩安装
      • ✨ 2.4.环境变量设置
      • ✨ 2.5.初始化
    • 📣 3.MySQL配置
      • ✨ 3.1 源端配置
      • ✨ 3.2 目标端配置
      • ✨ 3.3 用户及库创建
    • 📣 4.MySQL OGG配置
      • ✨ 4.1 配置mgr进程
      • ✨ 4.2 配置EXTRACT进程
      • ✨ 4.3 配置REPLICAT进程
      • ✨ 4.4 启动所有进程
    • 📣 5.数据验证

前言

本文详细阐述了基于OGG实现MySQL实时同步全过程

📣 1.架构设计

📣 2.OGG for MySQL部署

✨ 2.1 安装客户端

yum install https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm
yum install mysql-community-server --nogpgcheck

✨ 2.2 安装目录

groupadd -g 1005 ogg
useradd -g ogg -u 1005 -m oggm
mkdir -p /oggmysql
cp /opt/213000_ggs_Linux_x64_MySQL_64bit.zip /oggmysql
chown -R oggm:ogg /oggmysql
chmod -R 775 /oggmysql

✨ 2.3.解压缩安装

su - oggm
cd /oggmysql/
unzip 213000_ggs_Linux_x64_MySQL_64bit.zip
tar -xf ggs_Linux_x64_MySQL_64bit.tar

✨ 2.4.环境变量设置

vi .bash_profileexport GG_HOME=/oggmysql
export PATH=$PATH:$HOME/bin:$GG_HOME
alias ggsci='cd $GG_HOME;ggsci'source .bash_profile[oggm@oggmysql ~]$ ggsci -V
Oracle GoldenGate Command Interpreter for MySQL
Version 21.3.0.0.0 OGGCORE_21.3.0.0.0_PLATFORMS_210728.1047
Oracle Linux 7, x64, 64bit (optimized), MySQL  on Jul 28 2021 18:17:46Copyright (C) 1995, 2021, Oracle and/or its affiliates. All rights reserved.

✨ 2.5.初始化

[oggm@oggmysql ~]$ ggsci
Oracle GoldenGate Command Interpreter for MySQL
Version 21.3.0.0.0 OGGCORE_21.3.0.0.0_PLATFORMS_210728.1047
Oracle Linux 7, x64, 64bit (optimized), MySQL on Jul 28 2021 18:17:46
Operating system character set identified as US-ASCII.
Copyright © 1995, 2021, Oracle and/or its affiliates. All rights reserved.
GGSCI (oggmysql) 1> create subdirs

📣 3.MySQL配置

✨ 3.1 源端配置

# vi /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8mb4
symbolic-links=0server_id         = 80350
log_bin           = mysql-bin
expire_logs_days  = 1
binlog_format     = row
binlog_row_metadata=full[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid参数说明:
symbolic-links=0为是否支持符号链接,即数据库或表可以存储在my.cnf中指定datadir之外的分区或目录,为0不开启。
禁用symbolic-links选项  、服务配置,禁用符号链接以防止各种安全风险--重启mysql
systemctl restart mysqld[root@mysql8p /]# systemctl restart mysqld
[root@mysql8p /]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sun 2023-11-26 19:20:59 CST; 14s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 267 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 288 (mysqld)Status: "Server is operational"CGroup: /docker/5e0b5d157afd83dfc5d78352343bf241bafcd7e02685033ee314bf8fbbb7f836/system.slice/mysqld.service└─288 /usr/sbin/mysqld‣ 288 /usr/sbin/mysqldNov 26 19:20:58 mysql8p systemd[1]: Stopped MySQL Server.
Nov 26 19:20:58 mysql8p systemd[1]: Starting MySQL Server...
Nov 26 19:20:59 mysql8p systemd[1]: Started MySQL Server.--登录Mysql
mysql -uroot -proot -h172.18.12.66

✨ 3.2 目标端配置

# vi /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
basedir=/usr/local/mysql
socket=/tmp/mysql.sock
user=mysql
port=3306
character-set-server=utf8mb4
symbolic-links=0server_id         = 80351
log_bin           = mysql-bin
expire_logs_days  = 1
binlog_format     = row
binlog_row_metadata=full[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid参数说明:
symbolic-links=0为是否支持符号链接,即数据库或表可以存储在my.cnf中指定datadir之外的分区或目录,为0不开启。
禁用symbolic-links选项  、服务配置,禁用符号链接以防止各种安全风险--重启mysql
[root@mysql8s /]# systemctl restart mysqld
[root@mysql8s /]# systemctl status mysqld
● mysqld.service - MySQL ServerLoaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)Active: active (running) since Sun 2023-11-26 19:25:46 CST; 10s agoDocs: man:mysqld(8)http://dev.mysql.com/doc/refman/en/using-systemd.htmlProcess: 217 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)Main PID: 238 (mysqld)Status: "Server is operational"CGroup: /docker/65c131b1ebf8f0ae267e48b986a9cffe9b44b232461e479e47d641222f32677e/system.slice/mysqld.service└─238 /usr/sbin/mysqld‣ 238 /usr/sbin/mysqldNov 26 19:25:45 mysql8s systemd[1]: Stopped MySQL Server.
Nov 26 19:25:45 mysql8s systemd[1]: Starting MySQL Server...
Nov 26 19:25:46 mysql8s systemd[1]: Started MySQL Server.--登录Mysql
mysql -uroot -proot -h172.18.12.67

✨ 3.3 用户及库创建

1.主备数据库创建同步用户并附权
mysql -uroot -proot -h172.18.12.66 -P3306
mysql -uroot -proot -h172.18.12.67 -P3306
CREATE USER ‘ogg’@‘%’ IDENTIFIED BY ‘Jeames@123’;
GRANT ALL PRIVILEGES ON . TO ‘ogg’@‘%’ WITH GRANT OPTION;
FLUSH PRIVILEGES;

2.创建数据库
create database rptdb charset utf8mb4;

📣 4.MySQL OGG配置

✨ 4.1 配置mgr进程

[oggm@oggmysql ~]$ ggsci
Oracle GoldenGate Command Interpreter for MySQL
Version 21.3.0.0.0 OGGCORE_21.3.0.0.0_PLATFORMS_210728.1047
Oracle Linux 7, x64, 64bit (optimized), MySQL on Jul 28 2021 18:17:46
Operating system character set identified as US-ASCII.
Copyright © 1995, 2021, Oracle and/or its affiliates. All rights reserved.
GGSCI (oggmysql) 1> edit param mgr

PORT 7809
DYNAMICPORTLIST 7810-7909
AUTORESTART EXTRACT ,RETRIES 5,WAITMINUTES 3
PURGEOLDEXTRACTS ./dirdat/
,usecheckpoints, minkeepdays 3

GGSCI (oggmysql) 2> info all
Program Status Group Lag at Chkpt Time Since Chkpt
MANAGER STOPPED

✨ 4.2 配置EXTRACT进程

GGSCI (oggmysql) 1> edit param exta
extract exta
sourcedb rptdb@172.18.12.66:3306, userid ogg, password Jeames@123
tranLogOptions altlogDest REMOTE
ddl include mapped
exttrail ./dirdat/ma
table rptdb.*;

GGSCI (oggmysql) 2> add ext exta, tranlog, begin now
GGSCI (oggmysql) 3> add exttrail ./dirdat/ma, ext exta

✨ 4.3 配置REPLICAT进程

GGSCI (oggmysql) 1> edit param repa
replicat repa
targetdb rptdb@172.18.12.67:3306, userid ogg, password Jeames@123
DDLERROR DEFAULT IGNORE RETRYOP
map rptdb., target rptdb.;

GGSCI (oggmysql) 2> add replicat repa, exttrail ./dirdat/ma , nodbcheckpoint
GGSCI (oggmysql) 11> info all

Program     Status      Group       Lag at Chkpt  Time Since ChkptMANAGER     STOPPED                                           
EXTRACT     STOPPED     EXTA        00:00:00      00:01:30    
REPLICAT    STOPPED     REPA        00:00:00      00:00:05

注意:配置REPLICAT进程,在21C的版本中已经不用配置pump进程

✨ 4.4 启动所有进程

[oggm@oggmysql ~]$ ggsci
Oracle GoldenGate Command Interpreter for MySQL
Version 21.3.0.0.0 OGGCORE_21.3.0.0.0_PLATFORMS_210728.1047
Oracle Linux 7, x64, 64bit (optimized), MySQL on Jul 28 2021 18:17:46
Operating system character set identified as US-ASCII.

Copyright (C) 1995, 2021, Oracle and/or its affiliates. All rights reserved.
GGSCI (oggmysql) 1> info allProgram     Status      Group       Lag at Chkpt  Time Since ChkptMANAGER     STOPPED                                           
EXTRACT     STOPPED     EXTA        00:00:00      00:02:36    
REPLICAT    STOPPED     REPA        00:00:00      00:01:10 

GGSCI (oggmysql) 2> start mgr
Manager started.

GGSCI (oggmysql) 3> start exta
Sending START request to Manager …
Extract group EXTA starting.

GGSCI (oggmysql) 4> start repa
Sending START request to Manager …
Replicat group REPA starting.

GGSCI (oggmysql) 5> info allProgram     Status      Group       Lag at Chkpt  Time Since ChkptMANAGER     RUNNING                                           
EXTRACT     RUNNING     EXTA        00:02:58      00:00:10    
REPLICAT    RUNNING     REPA        00:00:00      00:00:02    GGSCI (oggmysql) 6> info *  Extract    EXTA      Last Started 2023-11-26 20:11   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:02 ago)
Process ID           188
VAM Read Checkpoint  2023-11-26 20:08:38.528816Replicat   REPA      Last Started 2023-11-26 20:11   Status RUNNING
Checkpoint Lag       00:00:00 (updated 00:00:05 ago)
Process ID           196
Log Read Checkpoint  File ./dirdat/ma000000000First Record  RBA 1326

📣 5.数据验证

--源端创建数据
[root@mysql8p /]# mysql -uroot -proot -h172.18.12.66
mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| rptdb              |
| sys                |
+--------------------+
5 rows in set (0.01 sec)mysql> use rptdb
mysql> show tables;1.新建表插入数据,验证数据
DROP TABLE IF EXISTS `Customers`;
CREATE TABLE IF NOT EXISTS `Customers`(cust_id VARCHAR(255) DEFAULT NULL
);
INSERT `Customers` VALUES ('A'),('B'),('C');##目标端数据同步
mysql> show tables;
+-----------------+
| Tables_in_rptdb |
+-----------------+
| Customers       |
+-----------------+
1 row in set (0.00 sec)mysql> select * from Customers;
+---------+
| cust_id |
+---------+
| A       |
| B       |
| C       |
+---------+
3 rows in set (0.00 sec)2.源端建表,验证数据
drop table if exists product_tb;
CREATE TABLE product_tb(
item_id char(10) NOT NULL,
style_id char(10) NOT NULL,
tag_price int(10) NOT NULL,
inventory int(10) NOT NULL
);##目标端数据同步
mysql> show tables;
+-----------------+
| Tables_in_rptdb |
+-----------------+
| Customers       |
| product_tb      |
+-----------------+
2 rows in set (0.00 sec)3.源端新建一列,验证数据
ALTER TABLE product_tb ADD COLUMN address VARCHAR(50);
mysql> show create table product_tb\G
*************************** 1. row ***************************Table: product_tb
Create Table: CREATE TABLE `product_tb` (`item_id` char(10) NOT NULL,`style_id` char(10) NOT NULL,`tag_price` int NOT NULL,`inventory` int NOT NULL,`address` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)##目标端数据同步
mysql> show create table product_tb\G
*************************** 1. row ***************************Table: product_tb
Create Table: CREATE TABLE `product_tb` (`item_id` char(10) NOT NULL,`style_id` char(10) NOT NULL,`tag_price` int NOT NULL,`inventory` int NOT NULL,`address` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_0900_ai_ci
1 row in set (0.00 sec)以上验证可以看到,DDL和DML都可以同步。

文章转载自:
http://bipack.fcxt.cn
http://semimillenary.fcxt.cn
http://feudalization.fcxt.cn
http://galilee.fcxt.cn
http://prussiate.fcxt.cn
http://lubricious.fcxt.cn
http://thunderation.fcxt.cn
http://wampus.fcxt.cn
http://left.fcxt.cn
http://muttnik.fcxt.cn
http://tungstite.fcxt.cn
http://busk.fcxt.cn
http://amplectant.fcxt.cn
http://introrse.fcxt.cn
http://fritting.fcxt.cn
http://throughway.fcxt.cn
http://dipterous.fcxt.cn
http://nonhero.fcxt.cn
http://person.fcxt.cn
http://effusion.fcxt.cn
http://mammey.fcxt.cn
http://godmother.fcxt.cn
http://preprofessional.fcxt.cn
http://flopover.fcxt.cn
http://gimp.fcxt.cn
http://cramped.fcxt.cn
http://mousseline.fcxt.cn
http://demander.fcxt.cn
http://pichiciago.fcxt.cn
http://linearise.fcxt.cn
http://cyberneticist.fcxt.cn
http://scrambling.fcxt.cn
http://vitellophag.fcxt.cn
http://isocracy.fcxt.cn
http://shock.fcxt.cn
http://expiable.fcxt.cn
http://skyrocket.fcxt.cn
http://espressivo.fcxt.cn
http://feaze.fcxt.cn
http://den.fcxt.cn
http://prophecy.fcxt.cn
http://oligarch.fcxt.cn
http://newt.fcxt.cn
http://unhurried.fcxt.cn
http://tientsin.fcxt.cn
http://apophthegm.fcxt.cn
http://salicet.fcxt.cn
http://funicular.fcxt.cn
http://factitious.fcxt.cn
http://officialdom.fcxt.cn
http://pockmark.fcxt.cn
http://nautili.fcxt.cn
http://autocrat.fcxt.cn
http://albigensian.fcxt.cn
http://rose.fcxt.cn
http://bds.fcxt.cn
http://paleogenesis.fcxt.cn
http://naprapathy.fcxt.cn
http://riftless.fcxt.cn
http://facile.fcxt.cn
http://bacteroid.fcxt.cn
http://tao.fcxt.cn
http://cubbyhouse.fcxt.cn
http://ingenuously.fcxt.cn
http://phytopathogen.fcxt.cn
http://legalist.fcxt.cn
http://unadmitted.fcxt.cn
http://cubitus.fcxt.cn
http://kenaf.fcxt.cn
http://toxicologically.fcxt.cn
http://amphimacer.fcxt.cn
http://hyperirritable.fcxt.cn
http://brood.fcxt.cn
http://chiricahua.fcxt.cn
http://herbartianism.fcxt.cn
http://highjacker.fcxt.cn
http://charleston.fcxt.cn
http://nutshell.fcxt.cn
http://precalcic.fcxt.cn
http://toril.fcxt.cn
http://mailbox.fcxt.cn
http://thoroughfare.fcxt.cn
http://tracheal.fcxt.cn
http://cqd.fcxt.cn
http://housefront.fcxt.cn
http://phenylene.fcxt.cn
http://tricarboxylic.fcxt.cn
http://taxonomist.fcxt.cn
http://succour.fcxt.cn
http://koweit.fcxt.cn
http://gigameter.fcxt.cn
http://hydroxyketone.fcxt.cn
http://rearwards.fcxt.cn
http://pulmonate.fcxt.cn
http://unitable.fcxt.cn
http://indus.fcxt.cn
http://nosogenesis.fcxt.cn
http://bawd.fcxt.cn
http://kinkily.fcxt.cn
http://mylonite.fcxt.cn
http://www.hrbkazy.com/news/60391.html

相关文章:

  • 做菠菜网站好赚吗广告软文营销平台
  • 域名反查网站百度电脑版官网
  • 百度推广网站吸引力seo排名推广
  • 中山建设爱站seo工具包
  • 湖南衡阳市建设工程造价网站外贸网站
  • 滨海县建设局网站东莞做网站公司电话
  • 台州椒江网站建设网络推广营销策划方案
  • 织梦 网站版权信息百度app免费下载
  • 网站建设方案 预算新品牌进入市场的推广方案
  • 产品展示网站开发苏州排名搜索优化
  • 网站做美工百度竞价关键词查询
  • 银川百度做网站多少钱杭州专业seo公司
  • 东莞气缸东莞网站建设广州排前三的seo公司
  • 做logo网站的公司百度推广外推联系方式
  • 网页模板网站cms产品营销推广方案
  • 中国万网怎么自己做网站南宁市优化网站公司
  • 人工智能ai写作网站免费互联网营销师课程
  • 网站首页怎么做ps长沙seo优化推广公司
  • 前端网页模板宁波seo软件免费课程
  • 动态的网站怎么做电子商务主要学什么
  • 怎样做 网站做seo2022年今天新闻联播
  • wordpress通用页面模板下载地址厦门seo代理商
  • 做视频网站代码网站制作方案
  • 便宜的做网站公司市场推广计划方案模板
  • 网站建设存在的问题及对策上海百度竞价托管
  • 网站定位案例seo网站关键词排名优化公司
  • 免费做网站怎么做网站619如何做网站搜索引擎优化
  • 做网站建设还有钱赚吗南昌seo搜索优化
  • 如何学做网站外包bt搜索引擎下载
  • seo推广的特点灯塔网站seo