CentOS 7 は TiUP を使用して TiDB を展開します

この記事では主に TiUP を使用して、公式ドキュメントのガイダンスに基づいて、実際のホストの状況と組み合わせて TiDB を Cent OS7 上にオンラインでデプロイします。

環境宣言

タイプ オペレーティング システムのバージョン 構成
中央制御コンピュータ ディーピン 20.3 4コアCPU+6Gメモリ+40Gハードドライブ
TiDB 導入マシン セントOS 7.3 8コアCPU + 48Gメモリ+ 100ハードドライブ
ネットワーク状況 中央制御マシンは外部ネットワークに接続され、中央制御マシンと展開マシンは相互接続されます。

ステップ 1: TiUP コンポーネントを中央制御コンピューターにオンラインで展開する

# 安装TiUP工具
$ curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh
# 重新声明全局环境变量
$ source .bash_profile
# 确认Tiup 是否安装
$ which tiup
/root/.tiup/bin/tiup
# 安装TiUP cluster组件
$ tiup cluster
# 查看TiUP cluster版本
$ tiup --binary cluster
/root/.tiup/components/cluster/v1.11.3/tiup-cluster

ステップ 2: クラスター・トポロジー・ファイルを作成する

## 全局变量,ssh端口要填写部署机实际的ssh端口
global:
 user: "tidb"
 ssh_port: 2333
 deploy_dir: "/tidb-deploy"
 data_dir: "/tidb-data"
# # Monitored variables are applied to all the machines.
monitored:
 node_exporter_port: 9100
 blackbox_exporter_port: 9115

server_configs:
 tidb:
   log.slow-threshold: 300
 tikv:
   readpool.storage.use-unified-pool: false
   readpool.coprocessor.use-unified-pool: true
 pd:
   replication.enable-placement-rules: true
   replication.location-labels: ["host"]
pd_servers:
 - host: 192.168.58.10

tidb_servers:
 - host: 192.168.58.10

tikv_servers:
 - host: 192.168.58.10
   port: 20160
   status_port: 20180
   config:
     server.labels: {
    
     host: "logic-host-1" }

 - host: 192.168.58.10
   port: 20161
   status_port: 20181
   config:
     server.labels: {
    
     host: "logic-host-2" }

 - host: 192.168.58.10
   port: 20162
   status_port: 20182
   config:
     server.labels: {
    
     host: "logic-host-3" }
monitoring_servers:
 - host: 192.168.58.10
grafana_servers:
 - host: 192.168.58.10

付録: 公式オンライン ドキュメントでは、TiFlash も展開されていますが、実際の実行では常にエラーが報告されるため、TiFlash の展開はこの構成ファイルから削除されています。

ステップ 3: 導入手順を実行する

中央制御コンピュータで次の手順を実行します:
tidb-testクラスタ
v6.5.0に名前を付け、インストールする TiDB クラスタ コンポーネントのバージョンは、展開マシンの ssh アカウントです。
--user root実際の状況に応じて
./topo.yamlクラスタ トポロジ構成に置き換える必要があります
-p。インタラクションを実行するには、ssh アカウントのパスワードを入力します。

$ tiup cluster deploy tidb-test v6.5.0 ./topo.yaml --user root -p

ステップ 4: TiDB クラスターを開始する

$ tiup cluster start tidb-test

ステップ 5: TiDB クラスターのステータスを確認する

# 查看集群信息,包括集群名、版本、安装用户等
$ tiup cluster list
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.11.3/tiup-cluster list
Name       User     Version  Path                                         PrivateKey
----       ----     -------  ----                                            ----------
tidb-test  root v6.5.0   /root/.tiup/storage/cluster/clusters/tidb-test  /root/.tiup/storage/cluster/clusters/tidb-test/ssh/id_rsa
# 查看集群下节点状态等信息
$ tiup cluster display tidb-test
tiup is checking updates for component cluster ...
Starting component `cluster`: /root/.tiup/components/cluster/v1.11.3/tiup-cluster display tidb-test
Cluster type:       tidb
Cluster name:       tidb-test
Cluster version:    v6.5.0
Deploy user:        root
SSH type:           builtin
Dashboard URL:      http://192.168.58.10:2379/dashboard
Grafana URL:        http://192.168.58.10:3000
ID                 Role        Host         Ports        OS/Arch       Status   Data Dir                            Deploy Dir
--                 ----        ----         -----        -------       ------   --------                            ----------
192.168.58.10:3000   grafana     192.168.58.10  3000         linux/x86_64  Up       -                                   /tidb-deploy/grafana-3000
192.168.58.10:2379   pd          192.168.58.10  2379/2380    linux/x86_64  Up|L|UI  /tidb-data/pd-2379                  /tidb-deploy/pd-2379
192.168.58.10:9090   prometheus  192.168.58.10  9090/12020   linux/x86_64  Up       /tidb-data/prometheus-9090          /tidb-deploy/prometheus-9090
192.168.58.10:4000   tidb        192.168.58.10  4000/10080   linux/x86_64  Up       -                                   /tidb-deploy/tidb-4000
192.168.58.10:20160  tikv        192.168.58.10  20160/20180  linux/x86_64  Up       /tidb-data/tikv-20160               /tidb-deploy/tikv-20160
192.168.58.10:20161  tikv        192.168.58.10  20161/20181  linux/x86_64  Up       /tidb-data/tikv-20161               /tidb-deploy/tikv-20161
192.168.58.10:20162  tikv        192.168.58.10  20162/20182  linux/x86_64  Up       /tidb-data/tikv-20162               /tidb-deploy/tikv-20162
Total nodes: 8

ステップ 6: TiDB を使用する

方法 1: navicatmysql 接続方法 192.168.57.1​​0:4000 ポートを使用する
方法 2:http://192.168.58.10:2379/dashboard監視パネルにアクセスする

参考資料
PingCAP は TiUP を使用して展開されます

おすすめ

転載: blog.csdn.net/Loiterer_Y/article/details/129385464