集群生态工具的安装卸载 #
安装 SphereEx-Console #
部署说明 #
- 最小化部署
最小化部署 Console ,复用用户环境中已有的 5.7 版本及以上的 MySQL 数据库。
| 主机 | 生态工具 |
|---|---|
| 主机1 | Console |
- 推荐部署
推荐部署 Console,使用独立主机和 1 套主从架构的 MySQL 数据库作为Console的元数据库。
| 主机 | 生态工具 | 组件 |
|---|---|---|
| 主机1 | Console | Console 后台 MySQL 数据库(主) |
| 主机2 | Console 后台 MySQL 数据库(从) |

环境要求: #
- JDK 8 及以上版本,推荐使用 JDK 17
- 若环境为虚拟机或容器,至少分配 2 核 CPU 和 4 GB 内存
- 一个可操作的 MySQL 数据库(推荐 5.7 及以上版本),作为 Console 的元数据库
- 防火墙策略放通 8088 端口(访问Console Web页面默认使用 8088 端口)
- 开启 ssh 服务
安装准备 #
- 新建操作系统用户
# groupadd spex
# useradd -g spex spex
# passwd spex
- 创建推荐的安装目录:
mkdir -p /home/spex/console
- 环境检查
- 查看 JDK 版本
# java -version
- 检查是否安装并启动 MySQL
# ps -ef | grep mysqld
- 检查防火墙策略是否放通 8088 端口
- 检查是否开启 ssh 服务
# ps -aux | grep sshd
- 获取软件: 请联系我们。
手动安装 SphereEx-Console #
- 解压制品包
解压 Console 制品包至安装目录
tar -xzvf sphereex-console-xxx.tar.gz -C /home/spex/console
- 初始化元数据库
- 连接 MySQL 数据库,创建 console 库
create database console
- 创建 spex 数据库用户并授权
create user 'spex'@'[SpherexEx-Console IP]' identified by 'XXXXXX';
grant all on console.* to spex@'[SpherexEx-Console IP]';
flush privileges;
- 执行初始化脚本(脚本存储于解压目录中的 db 目录中)
use console;
source /xx/sphereex-console-xxx/db/schema.sql
source /xx/sphereex-console-xxx/db/schema-data.sql
- 数据源配置
编辑 conf/application-local 文件,配置 mysql 连接信息。参考如下方式修改配置文件,未提及参数保持默认即可。
]vi application-prod.yml
server:
port: 8088
spring:
datasource:
url: jdbc:mysql://[SpherexEx-Console IP]:[port]]/console?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true&useUnicode=true&characterEncoding=UTF-8
username: spex
password: [password]
driverClassName: com.mysql.cj.jdbc.Driver
jwt:
header: token
secret: your_secret
expiration: 30000000000
sphereex:
distributed:
work-id: 1
proxy:
datasource:
hikari:
maximum-pool-size: 4
connection-timeout-milliseconds: 3000
minimum-idle: 2
idle-timeout-milliseconds: 500000
max-lifetime-milliseconds: 540000
- 导入 License
将 sphere-ex.license 文件放置在 console 的 conf 目录下
- 启动 SphereEx-Console SphereEx-Console 解压后的目录中的 bin 目录下
./start.sh
- 访问 Console
若未修改配置文件中的 server port,通过浏览器访问 ip:8088 即可进入Console登录页面

- 修改初始密码
初始用户为 admin:admin,初次登录时系统会提示修改密码,请记住修改后的密码。
SphereEx-Console 使用 #
- SphereEx-Console 的启动
登录 console 所在主机,进入 Console 的安装目录,执行启动命令。
bin/start.sh
使用服务器的 IP 地址加端口通过浏览器访问 SphereEx-Console 平台。
例如:192.168.10.18:8080
初始用户为 admin:admin,初次登录时系统会提示修改密码,请记住修改后的密码。


- SphereEx-Console 的停止
登录 SphereEx-Console 所在主机,进入 SphereEx-Console 的安装目录,执行停止命令。
bin/stop.sh
Ghost 配置使用说明 #
Ghost 作为集群的生态工具,配合 SphereEx-Console 实现 DDL 在线执行。
Ghost 下载地址:https://github.com/github/gh-ost/releases
安装 Ghost #
以 gh-ost-binary-linux-amd64-20231207144046.tar.gz 压缩包为例
- 解压 gh-ost-binary-linux-amd64-20231207144046.tar.gz
tar -zxvf gh-ost-binary-linux-amd64-20231207144046.tar.gz
- 在 console 的 conf 目录下创建 ghost 目录
cd ./conf
mkdir ghost
- 把解压后得到的 gh-ost 文件复制到 console 下的 conf/ghost 目录下
- 添加可执行权限
chmod +x gh-ost
配置Ghost #
- 在 SphereEx-Console 后台数据库中查看 Ghost 的相关配置
mysql> use console;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from `dictionary` where `category`='ghost' and `type`='ghost';
+----+----------+-------+----------+-------------------------------+---------------+---------------------+---------------------+
| id | category | type | property | value | description | create_time | update_time |
+----+----------+-------+----------+-------------------------------+---------------+---------------------+---------------------+
| 91 | ghost | ghost | enabled | true | true or false | 2024-05-17 21:22:36 | 2024-05-17 21:22:36 |
| 92 | ghost | ghost | workDir | /Users/root/temp/ghost | ghost path | 2024-05-17 21:22:36 | 2024-05-17 21:22:36 |
+----+----------+-------+----------+-------------------------------+---------------+---------------------+---------------------+
2 rows in set (0.06 sec)
- 修改配置
-- 开启 ghost, 默认是 true (可选值 true 或者 false)
update `dictionary` set `value`='true' where `category`='ghost' and `type`='ghost' and `property`='enabled';
-- 设置 ghost 的路径, 默认 classpath:ghost
-- 配置方式一,classpath:ghost 表示 console 下的 conf/ghost 目录,
-- 配置方式二,设置 gh-ost 可执行程序的绝对目录路径 如 /xx/xx/ghost
update `dictionary` set `value`='classpath:ghost' where `category`='ghost' and `type`='ghost' and `property`='workDir';
SphereEx-Console 调用 Ghost 的策略 #
开启 ghost 后执行如下 DDL 语句的策略如下
- add column 时大于等于 5.7 版本,小于 8.0.12 版本时会使用 ghost
- drop column 时大于等于 5.7 版本,小于 8.0.29 版本时会使用 ghost