接着上一篇:https://www.cnblogs.com/wwjj4811/p/14601369.html
前提:搭建好ShardingSphere proxy環境。
簡介
ShardingSphere‐UI 是 ShardingSphere 的一個簡單而有用的 web 管理控制台。它用於幫助用戶更簡單的 使用 ShardingSphere 的相關功能,目前提供注冊中心管理、動態配置管理、數據庫編排等功能。 項目結構上采取了前后端分離的方式,前端使用 Vue 框架,后端采用 Spring Boot 框架。使用標准的 Maven 方式進行打包,部署,同時也可以采用前后端分離的方式本地運行,方便開發調試。
主要功能:
- 添加激活注冊中心后,可以查看當前注冊中心所有運行實例信息。
- 可以通過操作按鈕對運行實例進行熔斷與恢復操作。
- 可以查看所有從庫信息,並進行從庫禁用與恢復操作。
環境搭建
先下載安裝包:
wget https://archive.apache.org/dist/incubator/shardingsphere/4.0.1/apache-shardingsphere-incubating-4.0.1-sharding-ui-bin.tar.gz
mv apache-shardingsphere-incubating-4.0.1-sharding-ui-bin.tar.gz /opt
tar -zxvf /opt/apache-shardingsphere-incubating-4.0.1-sharding-ui-bin.tar.gz
安裝zookeeper
mkdir -p /mydata/zookeeper/data
docker run -d -p 2181:2181 -v /mydata/zookeeper/data:/data --name=zookeeper --privileged zookeeper
修改ShardingSphere Proxy配置文件server.yam,修改完成后重啟ShardingSphere Proxy
vi server.yaml
orchestration:
name: orchestration_ds
overwrite: true
registry:
type: zookeeper
serverLists: 192.168.1.36:2181
namespace: orchestration
authentication:
users:
root:
password: root
sharding:
password: sharding
authorizedSchemas: sharding_db
props:
executor.size: 16
sql.show: false
啟動sharding-ui
sh /opt/apache-shardingsphere-incubating-4.0.1-sharding-ui-bin/bin/start.sh
啟動完成后,進入http://192.168.1.36:8088/,賬號密碼:admin/admin
添加注冊中心:
這里的數據只里實例和命名空間是再ShardingProxy中配置的,與server.yaml保持一致即可
連接注冊中心:
數據源:
數據源連接信息:
修改配置后即時生效,而不需要重啟ShardingProxy
認證信息:ShardingProxy的連接信息
屬性配置:
Sharding Proxy節點信息:可實時禁用
從庫信息: