ShardingSphere源码分析(三) ShardingSphere-UI使用


环境准备

准备 ShardingSphere-Proxy 与 ShardingSphere-UI , 这次使用 5.0.0-alpha 版本.

ShardingSphere-Proxy 下载地址: https://archive.apache.org/dist/shardingsphere/5.0.0-alpha/

ShardingSphere-UI 下载地址:https://archive.apache.org/dist/shardingsphere/shardingsphere-ui-5.0.0-alpha/


ShardingSphere-Proxy 配置

将 ShardingSphere-Proxy 5.0.0-alpha 下载并解压后, 针对 conf 目录下的 server.yaml、config-xxx.yaml 文件做修改.

另外还需将 mysql 的驱动包放在 ext-lib 目录下 (没有就新建一个)


server.yaml 服务配置

server.yaml 中需要放开 Zookeeper 的链接配置、权限配置、以及属性配置

governance:
 name: governance_ds
 registryCenter:
   type: ZooKeeper
   serverLists: localhost:2181
   props:
     retryIntervalMilliseconds: 500
     timeToLiveSeconds: 60
     maxRetries: 3
     operationTimeoutMilliseconds: 500
 overwrite: false

authentication:
 users:
   root:
     password: root
   sharding:
     password: sharding 
     authorizedSchemas: sharding_db

props:
 max-connections-size-per-query: 1
 acceptor-size: 16  # The default value is available processors count * 2.
 executor-size: 16  # Infinite by default.
 proxy-frontend-flush-threshold: 128  # The defa
ShardingSphere 是一个开源的分布式数据库解决方案,提供了分库分表、读写分离、弹性伸缩等功能。ShardingSphere 包含了多个组件,其中 ShardingSphere-Proxy 是为数据库访问提供了标准的 SQL 接口,而 ShardingSphere-UI 提供了可视化的界面来管理和操作 ShardingSphere 配置。 要通过 Docker 安装 ShardingSphere-Proxy 和 ShardingSphere-UI,你需要按照以下步骤操作: 1. 首先,确保你的系统中已经安装了 Docker。 2. 创建一个 Docker 网络,以确保容器之间可以互相通信。可以在终端中执行以下命令: ``` docker network create --driver bridge shardingSphereNet ``` 3. 从 Docker Hub 拉取 ShardingSphere-Proxy 和 ShardingSphere-UI 的官方镜像。可以通过以下命令完成: ``` docker pull shardingsphere/sharding-proxy docker pull shardingsphere/sharding-ui ``` 4. 运行 ShardingSphere-Proxy 容器。你需要提供数据库的配置文件(如 `server.yaml` 和 `config-xxx.yaml`),并且将其映射到容器内部的相应路径。以下是一个示例命令: ``` docker run -d --name sharding-proxy \ --network shardingSphereNet \ -v /path/to/your/proxy/configs:/opt/shardingsphere-proxy/conf \ -p 3307:3307 \ shardingsphere/sharding-proxy ``` 注意:`/path/to/your/proxy/configs` 是宿主机上存放配置文件的目录,`3307` 是容器暴露的端口,`/opt/shardingsphere-proxy/conf` 是容器中配置文件的路径。 5. 运行 ShardingSphere-UI 容器,并将其映射到宿主机的端口以便可以访问 UI。命令如下: ``` docker run -d --name sharding-ui \ --network shardingSphereNet \ -p 5000:8080 \ shardingsphere/sharding-ui ``` 这里 `5000` 是宿主机上用于访问 ShardingSphere-UI 的端口,而 `8080` 是容器内部 ShardingSphere-UI 服务的端口。 6. 配置完成后,你可以在浏览器中访问 `http://localhost:5000` 来打开 ShardingSphere-UI 的 Web 界面。 7. 使用 ShardingSphere-UI 连接到 ShardingSphere-Proxy,进行配置和管理。 请注意,具体的配置文件和启动参数可能需要根据你的实际需求和环境进行相应的调整。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值