Bytebase试用与对比

简介

官网介绍:Bytebase 是为 DBA 和开发人员进行数据库表结构 (schema) 变更而设计的团队协作工具。用户可以通过一个工作流 (pipeline),来推进 schema 在多个环境中的变化。同时用户也可以把 schema 保存在 VCS 中 ,再由新的 schema 文件提交来触发工作流。
由前Google和前蚂蚁员工创立的,刚刚首轮融资300万美元,此类软件之前使用过navicat,treesoft,Yearning,阿里内部的idb,阿里云的DMS,还有我在公司云原生数据库平台上自研的数据管理,所以特来试用下。

  • Navicat:当个客户端使用,没有相关保护,不适合开发线上使用,可以直接修改数据和结构

  • treesoft:比较好的是网页版,基于java开发的,可以在这里试用,开发的挺不错的,功能也非常丰富,整个界面不用看文档几乎谁都会使用,白屏化编辑表结构,SQL语句可以通过工单申请,还有些额外的小工具。支持多款数据库。

  • Yearning:go写的,工单思维更明显,在审核上做的更好,官网介绍侧重点就是Mysql SQL语句审核平台,可以定制审核规则,挺不错的。安装真的是超级简单。

  • idb: 目前为止最顺畅的,功能最强大,也在跟DAS做智能审核,而且多环境直接联动,但是与阿里很多工单等系统绑定着,团队做了对外版本就是阿里云的DMS,但是DMS实在太复杂,体验不好,商业产品,为了收费搞了好多模式。

  • DMS:如果花钱用最高端的功能,功能上是最强大的,但是太复杂了,各种功能用不了,毕竟是公有云上的产品,支持多种数据库。

  • bytebase:go开发的,定位就是国际化的,所以界面和功能老外风格很严重,不摸索一下还不大会用,而且弹出的中文提醒看了也看不明白,功能上有多环境的概念,并未真正打通,需要自行选择各个数据库组成一个pipeline,还有git的版本控制,这个挺好的,但是没试用。支持数据库种类也挺多的了。不支持白屏化修改表结构,SQL语法检测,不能配置规则,功能还有待提升。实在没搞懂为什么所有变更都叫迁移。大家可以拉起来玩一下。

  • github:https://github.com/bytebase/bytebase

  • 官网:https://bytebase.com/ doc中有手册

windows拉起

  • 下载并打开docker Destop
    • 可能没有权限,右击我的电脑-管理-本地用户和组-docker-user-添加-高级-名称中填上域账号立即查找,选中自己的账号,重启电脑
  • docker直接拉起 可参考官网手册
    • docker run --init --name bytebase --restart always --add-host host.docker.internal:host-gateway --publish 5678:5678 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase:1.0.3 --data /var/opt/bytebase --host http://localhost --port 5678
Unable to find image 'bytebase/bytebase:1.0.3' locally
1.0.3: Pulling from bytebase/bytebase
97518928ae5f: Pull complete
23cf97cfd555: Pull complete
e77dfc9bed75: Pull complete
679776bdbbf5: Pull complete
d7aef56a141c: Pull complete
Digest: sha256:860f243302721b0329e270db75f1f2887edfd3548e6bdf57f8f02b3928f062b2
Status: Downloaded newer image for bytebase/bytebase:1.0.3
2022-04-21 07:08:52.138453 I | Installing Postgres OS "linux" Arch "amd64" txz "postgres-linux-x86_64-alpine_linux.txz"
-----Config BEGIN-----
mode=prod
server=http://localhost:5678
datastore=http://localhost:5679
frontend=http://localhost:5678
resourceDir=/var/opt/bytebase/resources
pgdataDir=/var/opt/bytebase/pgdata
demoDataDir=
readonly=false
demo=false
debug=false
-----Config END-------
2022-04-21T07:08:52.138Z        INFO    Preparing embedded PostgreSQL instance...
The files belonging to this database system will be owned by user "bytebase".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/opt/bytebase/pgdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2022-04-21 07:08:54.257 UTC [23] WARNING:  no usable system locales were found
ok
syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
ok


Success. You can now start the database server using:

    /var/opt/bytebase/resources/postgres-linux-x86_64-alpine_linu/bin/pg_ctl -D /var/opt/bytebase/pgdata -l logfile start

waiting for server to start....2022-04-21 07:08:54.683 UTC [27] LOG:  starting PostgreSQL 14.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 6.3.0) 6.3.0, 64-bit
2022-04-21 07:08:54.689 UTC [27] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5679"
2022-04-21 07:08:54.690 UTC [28] LOG:  database system was shut down at 2022-04-21 07:08:54 UTC
2022-04-21 07:08:54.691 UTC [27] LOG:  database system is ready to accept connections
 done
server started
2022-04-21 07:08:54.775 UTC [35] FATAL:  database "bb" does not exist
2022-04-21 07:08:54.776 UTC [36] FATAL:  database "bytebase" does not exist
2022-04-21T07:08:54.789Z        INFO    Bytebase migration schema not found, creating schema... {"environment": "", "database": ""}
2022-04-21T07:08:54.818Z        INFO    Successfully created migration schema.  {"environment": "", "database": ""}
2022-04-21T07:08:54.829Z        INFO    Apply database migration if needed...
2022-04-21T07:08:54.829Z        INFO    The database schema has not been setup.
2022-04-21T07:08:54.829Z        INFO    The prod cutoff schema version: 1.0.1
2022-04-21T07:08:55.409Z        INFO    Completed database initial migration with version 1.0.1.
2022-04-21T07:08:55.414Z        INFO    Current schema version after migration: 1.0.1
2022-04-21T07:08:55.422Z        INFO    get project env {"env": "prod"}
2022-04-21T07:08:55.422Z        INFO    load public pem {"file": "keys/prod.pub.pem"}

██████╗ ██╗   ██╗████████╗███████╗██████╗  █████╗ ███████╗███████╗
██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝
██████╔╝ ╚████╔╝    ██║   █████╗  ██████╔╝███████║███████╗█████╗
██╔══██╗  ╚██╔╝     ██║   ██╔══╝  ██╔══██╗██╔══██║╚════██║██╔══╝
██████╔╝   ██║      ██║   ███████╗██████╔╝██║  ██║███████║███████╗
╚═════╝    ╚═╝      ╚═╝   ╚══════╝╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝

Version 1.0.3 has started at http://localhost:5678
___________________________________________________________________________________________


linux拉起

  • 内网及其没外网权限可以在本地拉起后把镜像烤上去
    • docker save -o bytebase.tar bytebase/bytebase:1.0.3
  • linux中load镜像
    • docker load -i bytebase.tar
  • 拉起,docker版本低可能会有报错,对应的改改
[root@recsys-svsched-svc zjk]# docker run --init --name bytebase --restart always --add-host host.docker.internal:host-gateway --publish 5678:5678 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase:1.0.3 --data /var/opt/bytebase --host http://localhost --port 5678
unknown flag: --init
See 'docker run --help'.
[root@recsys-svsched-svc zjk]# docker run  --name bytebase --restart always --add-host host.docker.internal:host-gateway --publish 5678:5678 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase:1.0.3 --data /var/opt/bytebase --host http://localhost --port 5678
invalid argument "host.docker.internal:host-gateway" for --add-host: invalid IP address in add-host: "host-gateway"
See 'docker run --help'.
[root@recsys-svsched-svc zjk]# docker run  --name bytebase --restart always  --publish 5678:5678 --volume ~/.bytebase/data:/var/opt/bytebase bytebase/bytebase:1.0.3 --data /var/opt/bytebase --host http://localhost --port 5678
-----Config BEGIN-----
mode=prod
server=http://localhost:5678
datastore=http://localhost:5679
frontend=http://localhost:5678
resourceDir=/var/opt/bytebase/resources
pgdataDir=/var/opt/bytebase/pgdata
demoDataDir=
readonly=false
demo=false
debug=false
-----Config END-------
2022-04-22T00:33:56.552Z        INFO    Preparing embedded PostgreSQL instance...
2022-04-22 00:33:56.552818 I | Installing Postgres OS "linux" Arch "amd64" txz "postgres-linux-x86_64-alpine_linux.txz"
The files belonging to this database system will be owned by user "bytebase".
This user must also own the server process.

The database cluster will be initialized with locale "en_US.UTF-8".
The default database encoding has accordingly been set to "UTF8".
The default text search configuration will be set to "english".

Data page checksums are disabled.

fixing permissions on existing directory /var/opt/bytebase/pgdata ... ok
creating subdirectories ... ok
selecting dynamic shared memory implementation ... posix
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting default time zone ... UTC
creating configuration files ... ok
running bootstrap script ... ok
performing post-bootstrap initialization ... sh: locale: not found
2022-04-22 00:34:02.448 UTC [23] WARNING:  no usable system locales were found
ok
syncing data to disk ... initdb: warning: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.
ok


Success. You can now start the database server using:

    /var/opt/bytebase/resources/postgres-linux-x86_64-alpine_linu/bin/pg_ctl -D /var/opt/bytebase/pgdata -l logfile start

waiting for server to start....2022-04-22 00:34:05.232 UTC [27] LOG:  starting PostgreSQL 14.2 on x86_64-pc-linux-musl, compiled by gcc (Alpine 6.3.0) 6.3.0, 64-bit
2022-04-22 00:34:05.311 UTC [27] LOG:  listening on Unix socket "/tmp/.s.PGSQL.5679"
2022-04-22 00:34:05.401 UTC [28] LOG:  database system was shut down at 2022-04-22 00:34:03 UTC
2022-04-22 00:34:05.435 UTC [27] LOG:  database system is ready to accept connections
 done
server started
2022-04-22 00:34:05.493 UTC [35] FATAL:  database "bb" does not exist
2022-04-22 00:34:05.496 UTC [36] FATAL:  database "bytebase" does not exist
2022-04-22T00:34:05.527Z        INFO    Bytebase migration schema not found, creating schema... {"environment": "", "database": ""}
2022-04-22T00:34:06.328Z        INFO    Successfully created migration schema.  {"environment": "", "database": ""}
2022-04-22T00:34:06.356Z        INFO    Apply database migration if needed...
2022-04-22T00:34:06.356Z        INFO    The database schema has not been setup.
2022-04-22T00:34:06.356Z        INFO    The prod cutoff schema version: 1.0.1
2022-04-22T00:34:11.766Z        INFO    Completed database initial migration with version 1.0.1.
2022-04-22T00:34:11.779Z        INFO    Current schema version after migration: 1.0.1
2022-04-22T00:34:11.854Z        INFO    get project env {"env": "prod"}
2022-04-22T00:34:11.854Z        INFO    load public pem {"file": "keys/prod.pub.pem"}

██████╗ ██╗   ██╗████████╗███████╗██████╗  █████╗ ███████╗███████╗
██╔══██╗╚██╗ ██╔╝╚══██╔══╝██╔════╝██╔══██╗██╔══██╗██╔════╝██╔════╝
██████╔╝ ╚████╔╝    ██║   █████╗  ██████╔╝███████║███████╗█████╗
██╔══██╗  ╚██╔╝     ██║   ██╔══╝  ██╔══██╗██╔══██║╚════██║██╔══╝
██████╔╝   ██║      ██║   ███████╗██████╔╝██║  ██║███████║███████╗
╚═════╝    ╚═╝      ╚═╝   ╚══════╝╚═════╝ ╚═╝  ╚═╝╚══════╝╚══════╝

Version 1.0.3 has started at http://localhost:5678
___________________________________________________________________________________________


首页

SQL编辑

在这里插入图片描述

工单

在这里插入图片描述
在这里插入图片描述

项目

在这里插入图片描述
如果不指定执行时间,审批既执行,还是很危险的

在这里插入图片描述
迁移历史,搞不到明白表结构变更和数据变更怎么都叫迁移了

数据库

在这里插入图片描述
可以创建数据库,但是一个数据库只能在一个项目中,这个可能会有多个项目使用同一个数据库的场景

实例

在这里插入图片描述
分多个环境,但是每个环境中的实例并未联动起来

在这里插入图片描述
创建实例,支持多款引擎

环境

在这里插入图片描述
这个排序挺好的

变更Schema

在这里插入图片描述
选择多个的话就会组成一个pipeline,并不是自动自动把不同环境中的实例联动起来,靠人工选择,如下
在这里插入图片描述
每一个环境都有审批执行

<think>好的,我需要帮助用户在Bytebase社区版中集成GitLab。首先,我应该回顾一下用户提供的引用内容,看看是否有相关的信息。引用[1]、[3]、[4]提到Bytebase旨在填补类似GitLab管理数据库模式的空白,并且它是一个开源项目,代码托管在GitHub上,使用GitHub Action进行部署。引用[2]是关于GitLab的文档,可能对配置有帮助,但用户的问题是关于如何集成到Bytebase中。 根据这些信息,我需要推断可能的集成步骤。通常,集成GitLab这类工具需要API访问、Webhook配置或OAuth认证。虽然引用中没有具体说明步骤,但可以参考类似GitHub的集成方式,因为Bytebase的架构可能类似。例如,用户可能需要在Bytebase中配置GitLab仓库的URL、访问令牌,以及设置Webhook来自动触发更新。 接下来,我需要确保回答符合用户的要求:结构清晰,分步说明,使用中文,正确引用标记。还需要生成相关问题,可能涉及集成后的验证、权限管理或常见问题处理。 需要验证步骤是否合理,比如检查API权限,确保令牌有足够权限访问仓库。可能还需要指导用户如何测试集成是否成功,例如提交变更并查看Bytebase是否同步。 最后,生成的相关问题应该围绕集成的扩展,比如优化方法、权限设置或故障排除。确保引用正确,例如引用[3]提到Bytebase的目标是提供类似GitLab的体验,所以集成GitLab是合理的方向。</think>### 如何在 Bytebase 社区版中集成 GitLab #### 步骤说明 1. **环境准备** - 确保已安装最新版 Bytebase 社区版,并拥有管理员权限[^3]。 - 在 GitLab 中创建一个用于集成的新项目(或选择现有项目),并生成一个具有仓库读写权限的 `Access Token`[^2]。 2. **配置 GitLab 访问信息** - 在 Bytebase 的 Web 控制台中,导航至 `设置` > `版本控制集成`。 - 选择 GitLab 作为版本控制系统,填写以下信息: - **GitLab 实例 URL**:例如 `https://gitlab.com`(自托管实例需填写对应地址)。 - **Access Token**:填入上一步生成的 GitLab Access Token。 - **仓库路径**:指定 GitLab 项目的路径(如 `your-group/your-project`)。 3. **关联数据库变更脚本** - 在 Bytebase 中创建或选择目标数据库,进入 `变更历史` 标签页。 - 点击 `关联版本控制仓库`,选择已配置的 GitLab 项目,并指定存储 SQL 脚本的目录(如 `migrations/`)。 4. **设置 Webhook 自动同步(可选)** - 在 GitLab 项目的 `Settings` > `Webhooks` 中,添加 Bytebase 提供的 Webhook URL。 - 触发事件选择 `Push events`,确保代码提交后自动触发 Bytebase 的数据库变更流程[^4]。 #### 验证集成 - 提交一个 SQL 文件到 GitLab 关联目录,观察 Bytebase 是否自动检测并生成变更记录。 - 在 Bytebase 的 `活动日志` 中确认同步状态,失败时可查看错误日志调整配置。 #### 代码示例(GitLab CI/CD 集成) ```yaml # .gitlab-ci.yml 示例:提交 SQL 变更后触发 Bytebase 任务 deploy_db: stage: deploy script: - curl -X POST "https://bytebase.example.com/api/v1/project/{project-id}/sync" -H "Authorization: Bearer {bytebase-token}" ```
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值