码农知识堂 - 1000bd
  •   Python
  •   PHP
  •   JS/TS
  •   JAVA
  •   C/C++
  •   C#
  •   GO
  •   Kotlin
  •   Swift
  • [如何编译openGauss对应版本的wal2json.so]


    wal2json是逻辑解码插件,使用该插件可以访问由INSERT和UPDATE生成的元组,解析WAL中的内容。
    本篇文章介绍了如何手动编译openGauss对应版本的wal2json.so。

    首先,需要一套对应版本数据库的软件和openGauss-server的源码,以及wal2json代码进行编译安装。本篇文章以openGauss 3.0.0为例

    对应的网址如下:
    1.openGauss-server源码路径:openGauss-server: openGauss kernel ~ openGauss is an open source relational database management system.
    2.openGauss软件下载路径:软件包 | openGauss
    3.wal2json代码路径:wal2json: This project is a fork from wal2json, a compatibility version for openGuass.

    我编译好的openGauss 3.0的 wal2json.so(x86)放到了gitee上,需要的朋友可以自取:wal2json-openGauss3.0-x86: wal2json-openGauss3.0-x86

    一、下载openGauss-server源码

    1. [mog@localhost ~]$ pwd
    2. /home/mog
    3. [mog@localhost ~]$ mkdir opengauss-server-package
    4. [mog@localhost ~]$ cd opengauss-server-package/
    5. [mog@localhost opengauss-server-package]$ git clone https://gitee.com/opengauss/openGauss-server.git
    6. Cloning into 'openGauss-server'...
    7. remote: Enumerating objects: 59079, done.
    8. remote: Counting objects: 100% (13276/13276), done.
    9. remote: Compressing objects: 100% (4659/4659), done.

    二、复制openGauss部分源码到软件目录下,并替换pg_config_os.h

    复制opengauss源码src/include/*的内容到数据库安装目录的include/postgresql/server 下,cd到这个目录下,执行 rm -f pg_config_os.h; cp port/linux.h pg_config_os.h

    因此我本地源码对应的要拷贝的目录为:

    /home/mog/opengauss-server-package/openGauss-server/src/include/*
    

    这里 /mogdb/software是我本地数据库的软件目录。

    因此我软件的对应目录为

    /mogdb/software/include/postgresql/server
    

    进行拷贝

    cp -r /home/mog/opengauss-server-package/openGauss-server/src/include/* /mogdb/software/include/postgresql/server
    

    替换pg_config_os.h

    1. cd /mogdb/software/include/postgresql/server
    2. rm -f pg_config_os.h
    3. cp port/linux.h pg_config_os.h

    三、源码安装g++

    #编译前需要确保g+ +安装,g+ +需要c+ +14版本
    本地发现g++版本不够,重新编译安装较高版本,这里gcc要至少6.1版本,否则会有相关报错

    yum -y install gcc+ gcc-c++

    当前版本较低

    1.下载源码包

    wget http://ftp.gnu.org/gnu/gcc/gcc-6.2.0/gcc-6.2.0.tar.bz2
    

    2.解压

    tar jxf gcc-6.2.0.tar.bz2
    

    3.下载编译依赖

    1. cd gcc-6.2.0
    2. ./contrib/download_prerequisites

    4.生成makefile文件

    1. mkdir gcc-build-6.2.0
    2. cd gcc-build-6.2.0/
    3. ../configure -enable-checking=release -enable-languages=c,c++ -disable-multilib

    5.编译

    make
    

    漫长的等待

    6.安装

    make install
    

    四、下载wal2json代码并编译

    git clone https://gitee.com/enmotech/wal2json
    

    1. export PATH=/mogdb/software/bin:$PATH
    2. make
    3. make install

    发现编译过程存在报错,我们把对应的几个.h里进行修改,去掉std::

    最后编译成功

    wal2json放到对应路径下

    已经可以正常使用了

    1. postgres=# select * from pg_create_logical_replication_slot('mdb_20220823025242_slot','wal2json');
    2. slotname | xlog_position
    3. -------------------------+---------------
    4. mdb_20220823025242_slot | D70/EE73A0A8
    5. (1 row)
  • 相关阅读:
    ubuntu 22.04 安装ros2 iron
    阿里蚂蚁淘宝等多次一面面试面经
    学习Python中pywifi模块的基本用法
    Google SGE 正在添加人工智能图像生成器,现已推出:从搜索中的生成式 AI 中获取灵感的新方法
    C语言暑假学习刷题——Day8
    借助MLOps平台简化联邦学习工作流程
    JDK新特性——Stream代码简洁之道的详细用法
    百度交易中台之内容分润结算系统架构浅析
    AI时代你一定要知道的Agent概念
    安装pnpm踩的坑
  • 原文地址:https://blog.csdn.net/weixin_47308871/article/details/126651895
  • 最新文章
  • 攻防演习之三天拿下官网站群
    数据安全治理学习——前期安全规划和安全管理体系建设
    企业安全 | 企业内一次钓鱼演练准备过程
    内网渗透测试 | Kerberos协议及其部分攻击手法
    0day的产生 | 不懂代码的"代码审计"
    安装scrcpy-client模块av模块异常,环境问题解决方案
    leetcode hot100【LeetCode 279. 完全平方数】java实现
    OpenWrt下安装Mosquitto
    AnatoMask论文汇总
    【AI日记】24.11.01 LangChain、openai api和github copilot
  • 热门文章
  • 十款代码表白小特效 一个比一个浪漫 赶紧收藏起来吧!!!
    奉劝各位学弟学妹们,该打造你的技术影响力了!
    五年了,我在 CSDN 的两个一百万。
    Java俄罗斯方块,老程序员花了一个周末,连接中学年代!
    面试官都震惊,你这网络基础可以啊!
    你真的会用百度吗?我不信 — 那些不为人知的搜索引擎语法
    心情不好的时候,用 Python 画棵樱花树送给自己吧
    通宵一晚做出来的一款类似CS的第一人称射击游戏Demo!原来做游戏也不是很难,连憨憨学妹都学会了!
    13 万字 C 语言从入门到精通保姆级教程2021 年版
    10行代码集2000张美女图,Python爬虫120例,再上征途
Copyright © 2022 侵权请联系2656653265@qq.com    京ICP备2022015340号-1
正则表达式工具 cron表达式工具 密码生成工具

京公网安备 11010502049817号