ShardingSphere5.0.0-beta的UI初体验
拉取代码
git clone https://github.com/apache/shardingsphere-ui.git
启动前后端服务
-
在shardingsphere-ui-frontend目录下了执行:
npm install
-
出现报错:
Error: Can't find Python executable "python", you can set the PYTHON env var
执行:
npm install --global --production windows-build-tools
-
可能出现报错:
Error: Node Sass version 6.0.1 is incompatible with ^4.0.0.
执行如下:
npm uninstall node-sass
npm install node-sass@4.14.1
npm run dev
-
执行:
npm run dev
-
后端启动类:
org.apache.shardingsphere.ui.Bootstrap
-
访问服务:
http://localhost:8080
安装zookeeper
确保linux中2181端口没有被占用,如果占用了
执行:netstat -tanlp
找到相应经常id,然后:kill -9 212205
mkdir -p /data/zookeeper/data
#下载Zookeeper镜像
docker pull zookeeper
docker run -d -p 2181:2181 -v /data/zookeeper/data:/data --name=zookeeper --privileged zookeeper
shardingsphere-proxy服务注册到zookeeper
前提是部署过ShardingSphere5.0.0-beta-proxy,点击了解部署proxy
修改conf/server.yaml
文件尾部添加如下配置
governance:
name: governance_ds
registryCenter:
type: ZooKeeper
serverLists: localhost:2181
props:
retryIntervalMilliseconds: 500
timeToLiveSeconds: 60
maxRetries: 3
operationTimeoutMilliseconds: 500
overwrite: false
然后重启proxy服务,这是proxy信息就会注册到zookeeper上,如下图:
shardingsphere-ui添加zookeeper
添加zookeeper信息,治理实例名称必须和governance.name值一致
点击链接之后正常,会在配置管理中显示proxy的配置信息
总结
- 注册中心管理、动态配置管理、数据库编排等功能