MatrixOne Linux 编译文档

MatrixOne Linux 编译文档

编译环境

硬件环境 操作系统 内存 CPU 磁盘
Windows环境下的Linux虚拟机 Linux version 3.10.0-1160.el7.x86_64 4G 4C 25G

环境准备

安装GO环境

下载

# 下载地址
https://studygolang.com/dl
# 这里将go安装至 /home/go目录下,可以在上面网址选择对应版本的安装包之后,上传至安装目录

选择对应版本下载,如我这里下载的是 go1.19.linux-amd64.tar.gz

安装GO环境

  • 创建安装目录

    mkdir -p /home/go && cd /home/go
    
  • 解压

    tar -C /home/go -zxvf go1.19.linux-amd64.tar.gz
    
  • 配置环境变量

    vi /etc/profile
    # 增加以下内容
    # 在/etc/profile最后一行添加
    export GOROOT=/usr/local/go
    export PATH=$PATH:$GOROOT/bin
    
    # 保存退出后,source一下
    source /etc/profile
    
  • 检查GO环境

    # 执行 go命令
    go version
    # 能出现如下的go的版本即可
    go version go1.19 linux/amd64
    

获取源码

  • 创建源码编译目录

    mkdir -p /home/matrixone && cd /home/matrixone
    
  • 获取源码

    # git clone 
    git clone https://github.com/matrixorigin/matrixone.git
    # 切换分支
    git checkout 0.5.1 (可选)
    # 进入源码目录
    cd ./matrixone
    

编译源码并启动

编译源码(在线编译)

# 需要网络环境支持
# 配置go的依赖下载加速
go env -w GOPROXY=https://mirrors.aliyun.com/goproxy/,direct
#编译
make config 
make build
  • 可能会遇到的问题

    • 在执行make build时 :gcc编译标准问题(PR : 4868))

      ‘for’ loop initial declarations are only allowed in C99 mode
      
      • 解决方案

        在cho的Makefile中加入编译标准

        # vi ./cgo/Makefile
        # 将原本的 
        CFLAGS=-I./external/decNumber -g ${OPT_LV} -Wall -Werror
        # 修改为
        CFLAGS=-std=c99 -I./external/decNumber -g ${OPT_LV} -Wall -Werror
        

编译源码(离线编译)

  • 找一个有网络环境的机器,执行上述步骤,可以不执行make build,依赖下载完成后,将 $GOPATH/pkg/mod 中的依赖项,复制到没有网络环境机器的 $GOPATH/pkg/mod下,然后执行:

    go env -w GO111MODULE=off 关闭
    

    参数解释:

    GO111MODULE=off 无模块支持,go 会从 GOPATH 和 vendor 文件夹寻找包。
    GO111MODULE=on 模块支持,go 会忽略 GOPATH 和 vendor 文件夹,只根据 go.mod 下载依赖。
    GO111MODULE=auto 在 $GOPATH/src 外面且根目录有 go.mod 文件时,开启模块支持
    

启动服务

编译完成后,会在matrixone目录下生成二进制文件:mo-service,此时启动服务即可

./mo-service -cfg ./etc/cn-standalone-test.toml

连接MO服务

安装mysql client

  • 卸载mariadb

    # 查询有无相关依赖
    rpm -qa |grep mariadb
    # 卸载相关依赖
    rpm -e xxx
    
  • 安装mysql-client

    # 下载以下rpm包
    https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-common-5.7.35-1.el7.x86_64.rpm
    
    https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-libs-5.7.35-1.el7.x86_64.rpm
    
    https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-community-client-5.7.35-1.el7.x86_64.rpm
    # 安装rpm
    rpm -ivh mysql-community-common-5.7.35-1.el7.x86_64.rpm
    
    rpm -ivh mysql-community-libs-5.7.35-1.el7.x86_64.rpm
    
    rpm -ivh mysql-community-client-5.7.35-1.el7.x86_64.rpm
    

使用mysql-client连接

 mysql -h 192.168.110.170 -P6001 -uroot -p
  • 连接成功后

    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 1001
    Server version: 0.5.0 MatrixOne
    
    Copyright (c) 2000, 2019, 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 '\h' for help. Type '\c' to clear the current input statement.
    
    mysql> 
    
    
posted @ 2022-09-06 08:54  自由如风fly  阅读(28)  评论(0编辑  收藏  举报