简介

官网介绍: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,并不是自动自动把不同环境中的实例联动起来,靠人工选择,如下
在这里插入图片描述
每一个环境都有审批执行

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐