集群生态工具的安装卸载 #
安装 SphereEx-Boot #
- 新建操作系统用户:
# groupadd spex
# useradd -g spex spex
# passwd spex
创建推荐的安装目录: /home/spex/boot
依赖:
sshpass 1.0.0+
Python 2.7 或者 Python 3.5+
pip 20.0.0+
- 安装 SphereEx-Boot
- 执行如下命令,安装 SphereEx-Boot。
# pip install sphereex‑boot‑1.1.0.tar.gz
Processing ./sphereex‑boot‑1.1.0.tar.gz
Requirement already satisfied: ansible<=2.10.7,>=2.8.0 in /usr/lib/python2.7/site-packages (from sphereex-boot==1.1.0) (2.10.7)
······
Building wheel for sphereex-boot (setup.py) ... done
Created wheel for spex: filename=sphereex_boot-1.1.0-py2-none-any.whl size=212249 sha256=5de4a3b4f347da57697ad942f74284be38ecf12e5e0d1fefda06e5e4282c22eb
Stored in directory: /root/.cache/pip/wheels/e5/c4/d7/64a96c1f48ffabc68df6aa164beb7a93a1ad4d81aba4b751d7
Successfully built sphereex-boot
Installing collected packages: sphereex-boot
Successfully installed sphereex‑boot‑1.1.0
- 查看 SphereEx-Boot 安装结果
执行命令查看 SphereEx-Boot 版本,如果输出的版本为当前安装的版本,说明安装成功。
# spex --version
Version 1.1.0
卸载 SphereEx-Boot #
执行卸载命令
# pip uninstall sphereex‑boot
安装 SphereEx-Console #
部署说明 #
- 最小化部署
最小化部署 Console ,复用用户环境中已有的 5.7 版本及以上的 MySQL 数据库。
主机 | 生态工具 |
---|---|
主机1 | Console |
- 推荐部署
推荐部署 Console,使用独立主机和 Console 中内置的 MySQL 软件安装 Console 后台 MySQL 数据库。
主机 | 生态工具 | 组件 |
---|---|---|
主机1 | Console | Console 后台 MySQL 数据库(主) |
主机2 | Console 后台 MySQL 数据库(从) |
安装准备 #
- 新建操作系统用户
安装 Boot 时已创建此步可省略
# groupadd spex
# useradd -g spex spex
# passwd spex
- 创建推荐的安装目录:
/home/spex/console
- 依赖:
- JDK 1.8
- 开启 ssh 服务
- SphereEx-Boot
- 环境检查(校验依赖)
- 查看 JDK 版本
# java -version
- 检查是否开启 ssh 服务
# ps -aux | grep sshd
- 检查是否安装 SphereEx-Boot
# spex --version
获取软件: 请联系我们。
使用 SphereEx-Boot 的 spex 命令导出配置文件 console_install.yaml
# spex console export
最小化安装 SphereEx-Console 初始化配置文件 #
最小化安装前提:
已有 MySQL 5.7 及以上数据库。
且已经创建 spex 数据库用户,并允许 console 所在主机访问。
- 创建 spex 用户:
create database console
create user 'spex'@'[SpherexEx-Console IP]' identified by 'XXXXXX';
grant all on console.* to spex@'[SpherexEx-Console IP]';
- 数据库初始化脚本
SphereEx-Console 解压后的目录中的 db 目录下的:
schema.sql
schema-data.sql
- 按实际情况,参考如下方式修改配置文件,未提及参数保持默认即可。
vi console_install.yaml
###################### SphereEx-Console Deploy Configuration Example #########################
# This file is an example configuration file.
# Here you can configure for the SphereEx-Console deploy.
# Deploy to remote must use ssh
#===================== Mysql Deploy Configuration ========================
# Required, Whether to install a new Mysql server
# If true Mysql master-slave will be installed
install_mysql: false
#==================== Console Deploy Configuration =======================
console:
# install on local or remote
ssh_user: spex
ssh_password: spex
ssh_port: 22
host: xxx.xxx.xxx.xxx
# Required, SphereEx-Console file. for example:/root/console/SphereEx-Console.tar.gz
file: /home/spex/boot/console.tar.gz
# Required, deployment directory, remote or local
install_dir: /home/spex/console
# Required, deployment directory, remote or local
console_config:
server:
port: 8088
# software home path
software:
home: /home/spex/console
spring:
# If install_mysql is true, the param will be overwritten
# If you use your own Mysql, edit the configuration below
datasource:
url: jdbc:mysql://[IP]:[PORT]/console?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true # console mysql url
username: spex # console mysql user
password: sphereEx@2021 # console mysql password
driverClassName: com.mysql.jdbc.Driver # console mysql driver
推荐安装 SphereEx-Console 初始化配置文件 #
参考推荐部署来规划主机,按实际情况,将 SphereEx-Console 和 MySQL 主从分别部署在两台主机上
参考如下方式修改配置文件,未提及参数保持默认即可。
vi console_install.yaml
###################### SphereEx-Console Deploy Configuration Example #########################
# This file is an example configuration file.
# Here you can configure for the SphereEx-Console deploy.
# Deploy to remote must use ssh
#===================== Mysql Deploy Configuration ========================
# Required, Whether to install a new Mysql server
# If true Mysql master-slave will be installed
install_mysql: true
# If install Mysql is true the param is required
mysql:
master:
# install on local or remote
file: /home/spex/console/mysql.tar.xz
host: xxx.xxx.xxx.xxx
listen_port: 3306
ssh_user: spex
ssh_password: spex
ssh_port: 22
install_dir: /home/spex/console
slave:
# install on local or remote
host: xxx.xxx.xxx.xxx
file: /home/spex/boot/mysql.tar.xz
# If two Mysql servers are on the same machine, listen port must be different
listen_port: 3307
ssh_user: root
ssh_password: root
ssh_port: 22
install_dir: /home/spex/console
#==================== Console Deploy Configuration =======================
console:
# install on local or remote
ssh_user: spex
ssh_password: spex
ssh_port: 22
host: xxx.xxx.xxx.xxx
# Required, SphereEx-Console file. for example:/root/console/SphereEx-Console.tar.gz
file: /home/spex/boot/console.tar.gz
# Required, deployment directory, remote or local
install_dir: /home/spex/console
# Required, deployment directory, remote or local
console_config:
server:
port: 8088
# software home path
software:
home: /home/spex/console
执行安装 SphereEx-Console #
- 执行命令安装 SphereEx-Console
# spex console install -n {console_name} -c console_install.yaml
- 查看 SphereEx-Console 列表
# spex console list
手动安装 SphereEx-Console #
安装准备
安装 SphereEx-Console 前,确保操作系统已经安装了如下软件:
- 已安装 JDK 1.8
- 已安装 spexc
- 已有 MySQL 5.7 及以上数据库。
- 且已经创建 spex 数据库用户,并允许 SphereEx-Console 所在主机访问。
- 创建 spex 用户:
create database console
create user 'spex'@'[SpherexEx-Console IP]' identified by 'XXXXXX';
grant all on console.* to spex@'[SpherexEx-Console IP]';
- 数据库初始化脚本
SphereEx-Console 解压后的目录中的 db 目录下的:
schema.sql schema-data.sql
- 修改配置文件
SphereEx-Console 解压后的目录中的 conf 目录下,修改加星部分,注意去掉星号。
vi application-prod.yml
server:
*port: 8080
spring:
datasource:
*url: jdbc:mysql://127.0.0.1:3306/console?serverTimezone=UTC&useSSL=false&allowPublicKeyRetrieval=true
*username: spex
*password: spex
driverClassName: com.mysql.jdbc.Driver
jwt:
header: token
secret: your_secret
expiration: 30000000000
sphereex:
proxy:
datasource:
hikari:
maximum-pool-size: 4
connection-timeout: 3000
minimum-idle: 2
idle-timeout: 500000
max-lifetime: 540000
- 启动 SphereEx-Console SphereEx-Console 解压后的目录中的 bin 目录下
./start.sh
- 登录 SphereEx-Console
使用服务器的 IP 地址加端口通过浏览器访问 SphereEx-Console 平台,使用配置文件中账号和密码登录。
例如:192.168.10.18:8080
内置超级管理员的用户名/密码: admin/admin
卸载 SphereEx-Console #
# spex console uninstall -n {console_name}
SphereEx-Boot 的使用 #
- SphereEx-Boot 的启动与停止
无需启动和停止,安装完成直接使用 spex 命令即可。
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
- SphereEx-Console 的备份
登录 SphereEx-Boot 所在主机,指定 SphereEx-Console 的名称进行卸载。
# spex console backup -n {name}