sharding-ui的安裝與使用


一、安裝

1.下載

https://shardingsphere.apache.org/document/current/cn/downloads/
image-20201113135031825

2.安裝和配置

(1)解壓:

[root@database ~]# wget https://mirrors.tuna.tsinghua.edu.cn/apache/shardingsphere/shardingsphere-ui-4.1.1/apache-shardingsphere-4.1.1-shardingsphere-ui-bin.tar.gz
--2020-11-13 13:32:01--  https://mirrors.tuna.tsinghua.edu.cn/apache/shardingsphere/shardingsphere-ui-4.1.1/apache-shardingsphere-4.1.1-shardingsphere-ui-bin.tar.gz
正在解析主機 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.8.193, 2402:f000:1:408:8100::1
正在連接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.8.193|:443... 已連接。
已發出 HTTP 請求,正在等待回應... 200 OK
長度:26093395 (25M) [application/x-gzip]
正在保存至: “apache-shardingsphere-4.1.1-shardingsphere-ui-bin.tar.gz”

100%[===============================================================================================================>] 26,093,395  4.07MB/s 用時 7.5s

2020-11-13 13:32:10 (3.31 MB/s) - 已保存 “apache-shardingsphere-4.1.1-shardingsphere-ui-bin.tar.gz” [26093395/26093395])

[root@database ~]# ll
總用量 25488
-rw-------. 1 root root     1242 10月  1 19:39 anaconda-ks.cfg
-rw-r--r--. 1 root root 26093395 7月   3 12:15 apache-shardingsphere-4.1.1-shardingsphere-ui-bin.tar.gz
[root@database ~]# tar -zxvf apache-shardingsphere-4.1.1-shardingsphere-ui-bin.tar.gz

(2)進入程序目錄並運行

[root@database logs]# cd ..
[root@database apache-shardingsphere-4.1.1-shardingsphere-ui-bin]# ll
總用量 32
drwxr-xr-x. 2 root root    54 6月   3 03:50 bin
drwxr-xr-x. 2 root root    55 11月 13 13:33 conf
drwxr-xr-x. 2 root root  4096 11月 13 13:32 lib
-rw-r--r--. 1 root root 15993 6月   4 15:25 LICENSE
drwxr-xr-x. 2 root root  4096 11月 13 13:32 licenses
drwxr-xr-x. 2 root root    24 11月 13 13:33 logs
-rw-r--r--. 1 root root  7167 6月   3 03:50 NOTICE
[root@database apache-shardingsphere-4.1.1-shardingsphere-ui-bin]# bin/start.sh
Starting the ShardingSphere-UI ...
Please check the STDOUT file: /root/apache-shardingsphere-4.1.1-shardingsphere-ui-bin/logs/stdout.log
[root@database apache-shardingsphere-4.1.1-shardingsphere-ui-bin]# netstat -nltp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1223/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1457/master
tcp6       0      0 :::27017                :::*                    LISTEN      2119/docker-proxy
tcp6       0      0 :::3306                 :::*                    LISTEN      2105/docker-proxy
tcp6       0      0 :::6379                 :::*                    LISTEN      2153/docker-proxy
tcp6       0      0 :::22                   :::*                    LISTEN      1223/sshd
tcp6       0      0 :::8088                 :::*                    LISTEN      15970/java
tcp6       0      0 ::1:25                  :::*                    LISTEN      1457/master

sharding-ui是一個標准的springboot程序,可以通過conf/application.properties配置相關信息:

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

server.port=8088

user.admin.username=admin
user.admin.password=admin
123456789101112131415161718192021

這里是下面要用到的連接配置信息,端口、用戶名和密碼可在此修改。

二、配置與使用

輸入你部署的服務器的ip地址:8088進入管理界面。
例如我的地址是: http://192.168.1.104:8088
image-20201113135224484
默認用戶名和密碼是: admin/adminj

設置開機自啟:

cat > /lib/systemd/system/sharding-ui.service <<-EOF
[Unit]
Description=shardingsphere-ui
After=network.target
[Service]
Type=forking
Environment=RUN_AS_USER=root
Environment=PATH=/home/oracle/app/oracle/product/11.2.0/dbhome_2/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin
ExecStart=/root/apache-shardingsphere-4.1.1-shardingsphere-ui-bin/bin/start.sh
ExecStop=/root/apache-shardingsphere-4.1.1-shardingsphere-ui-bin/bin/stop.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target
EOF

[root@database bin]# systemctl start sharding-ui
[root@database bin]# systemctl status sharding-ui
● sharding-ui.service - shardingsphere-ui
   Loaded: loaded (/usr/lib/systemd/system/sharding-ui.service; disabled; vendor preset: disabled)
   Active: active (running) since 五 2020-11-13 14:00:23 CST; 9s ago
  Process: 23764 ExecStart=/root/apache-shardingsphere-4.1.1-shardingsphere-ui-bin/bin/start.sh (code=exited, status=0/SUCCESS)
 Main PID: 23773 (java)
    Tasks: 43
   Memory: 538.5M
   CGroup: /system.slice/sharding-ui.service
           └─23773 java -server -Xmx1g -Xms1g -Xmn512m -Xss256k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:Large...

11月 13 14:00:21 database systemd[1]: Starting shardingsphere-ui...
11月 13 14:00:21 database start.sh[23764]: Starting the ShardingSphere-UI ...
11月 13 14:00:23 database start.sh[23764]: Please check the STDOUT file: /root/apache-shardingsphere-4.1.1-shardingsphere-ui-bin/logs/stdout.log
11月 13 14:00:23 database systemd[1]: Started shardingsphere-ui.
[root@database bin]# systemctl enable sharding-ui
Created symlink from /etc/systemd/system/multi-user.target.wants/sharding-ui.service to /usr/lib/systemd/system/sharding-ui.service.
[root@database bin]# netstat -nlpt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1223/sshd
tcp        0      0 127.0.0.1:25            0.0.0.0:*               LISTEN      1457/master
tcp6       0      0 :::27017                :::*                    LISTEN      2119/docker-proxy
tcp6       0      0 :::3306                 :::*                    LISTEN      2105/docker-proxy
tcp6       0      0 :::6379                 :::*                    LISTEN      2153/docker-proxy
tcp6       0      0 :::22                   :::*                    LISTEN      1223/sshd
tcp6       0      0 :::8088                 :::*                    LISTEN      23773/java
tcp6       0      0 ::1:25                  :::*                    LISTEN      1457/master
[root@database bin]#

之前的環境都沒有了,等后面都配置好,再把圖貼上,下面的圖來自於:https://blog.csdn.net/a112626290/article/details/104558424

1.添加注冊中心

在這里插入圖片描述
這里對應server.yaml中的配置,不多贅述,如圖:
在這里插入圖片描述
在這里插入圖片描述

2.配置管理

在這里插入圖片描述
這里可以進行公共信息認證信息分表分庫的配置,可實時生效。

3.運行狀態

在這里插入圖片描述
這里可以看到連接的sharding-proxy節點信息,並且可實時禁用。

從庫信息界面主要是讀寫分離的信息:
在這里插入圖片描述


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM