In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-31 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
#
# TiDB: A Distributed SQL Database
# github: https://github.com/pingcap/tidb
# doc: https://github.com/pingcap/docs-cn
#
# Architecture
Name
Host IPServices
Node1192.168.174.134
PD, TiDBnode2192.168.174.136TiKV1node3192.168.174.137TiKV2node4192.168.174.138TiKV3
# Software download (each one needs to be operated)
[root@node1 ~] # wget http://download.pingcap.org/tidb-latest-linux-amd64.tar.gz[root@node1 ~] # tar-xf tidb-latest-linux-amd64.tar.gz-C / usr/local/ [root@node1 ~] # mkdir / data/tidb/ {data,log}-p
# start the service (Note: the start-up order of the cluster cannot be wrong)
# enable PD in node1
[root@node1] # / usr/local/tidb-latest-linux-amd64/bin/pd-server-- name=pd1\-- data-dir=/data/tidb/data-- client-urls= "http://192.168.174.134:2379"\-peer-urls=" http://192.168.174.134:2380"-- initial-cluster= "pd1= http://192.168.174.134:2380"\-- log-file=/data/tidb/log/pd.log &
Parameter interpretation: https://github.com/pingcap/docs-cn/blob/master/op-guide/configuration.md#tidb
# enable TiKV on node2 node3 node4
[root@node2] # / usr/local/tidb-latest-linux-amd64/bin/tikv-server-- pd= "192.168.174.134Vl2379"-- addr= "192.168.174.136 addr="-- data-dir=/data/tidb/data-- log-file=/data/tidb/log/tikv.log & [root@node3] # / usr/local/tidb-latest-linux-amd64/bin/tikv-server-- pd= "192.168.174. 134log-file=/data/tidb/log/tikv.log 2379 "--addr=" 192.168.174.137root@node4 20160 "--data-dir=/data/tidb/data-- log-file=/data/tidb/log/tikv.log & [root@node4 ~] # / usr/local/tidb-latest-linux-amd64/bin/tikv-server-- pd=" 192.168.174.134VR 2379 "--addr=" 192.168.174.13820160 "- data-dir=/data/tidb/data-- log-file=/data/tidb/log/tikv.log &
Parameter interpretation: https://github.com/pingcap/docs-cn/blob/master/op-guide/configuration.md#tidb
# enable TiDB on node1
[root@node1] # / usr/local/tidb-latest-linux-amd64/bin/tidb-server-- store=tikv-- path= "192.168.174.134 store=tikv 2379"-- log-file=/data/tidb/log/tidb.log &
# log in to the database
[root@node1] # yum install-y mariadb # install mariadb database client [root@node1] # mysql-uroot-h 192.168.174.134-P 4000Welcome to the MariaDB monitor. Commands end with; or\ g.Your MySQL connection id is 2Server version: 5.7.1-TiDB-1.0 MySQL Community Server (GPL) Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.MySQL [(none)] > show databases +-+ | Database | +-+ | INFORMATION_SCHEMA | | PERFORMANCE_SCHEMA | | mysql | | test | +-+ 4 rows in set (0.00 sec) MySQL [(none)] > select host,user from mysql.user +-+-+ | host | user | +-+-+ |% | root | +-+-+ 1 row in set (0.00 sec) MySQL [(none)] > exitBye
# Cluster status
The HTTP interface exposed by TiDB is http://host:port/status, and the default port number is 10080 (can be set through the-- status parameter)
You can access this interface to get the status of the current TiDB Server and determine whether it is alive or not. The returned result is in Json format:
[root@node1 ~] # curl 192.168.174.134:10080/status {"connections": 0, "version": "5.7.1-TiDB-1.0", "git_hash": "d6ec37bb4219e95babce41bd0400d04d84b1fb88"}
PD Server
PD API address: http://${host}:${port}/pd/api/v1/${api_name}
Port defaults to 2379. For more information about all kinds of api_name, see
Https://cdn.rawgit.com/pingcap/docs/master/op-guide/pd-api-v1.html
[root@node1 ~] # curl 192.168.174.134:2379/pd/api/v1/stores {"count": 3, "stores": [{"store": {"id": 1, "address": "192.168.174.138 stores 20160", "state": 0, "state_name": "Up"} "status": {"store_id": 1, "capacity": "19 GB", "available": "17 GB", "leader_count": 1, "region_count": 1, "sending_snap_count": 0, "receiving_snap_count": 0, "applying_snap_count": 0, "is_busy": false "start_ts": "2017-05-13T03:16:51+08:00", "last_heartbeat_ts": "2017-05-13T03:23:58.709890548+08:00", "uptime": "7m7.709890548s"}}, {"store": {"id": 4, "address": "192.168.174.137 13T03:23:58.709890548+08:00 20160", "state": 0 "state_name": "Up"}, "status": {"store_id": 4, "capacity": "19 GB", "available": "16 GB", "leader_count": 0, "region_count": 1, "sending_snap_count": 0, "receiving_snap_count": 0 "applying_snap_count": 0, "is_busy": false, "start_ts": "2017-05-12T18:17:02+08:00", "last_heartbeat_ts": "2017-05-13T03:24:00.555315502+08:00", "uptime": "9h7m58.555315502s"}, {"store": {"id": 5 "address": "192.168.174.136 Up 20160", "state": 0, "state_name": "Up"}, "status": {"store_id": 5, "capacity": "16 GB", "available": "13 GB", "leader_count": 0, "region_count": 1 "sending_snap_count": 0, "receiving_snap_count": 0, "applying_snap_count": 0, "is_busy": false, "start_ts": "2017-05-12T18:17:02+08:00", "last_heartbeat_ts": "2017-05-13T03:23:56.955220422+08:00" "uptime": "9h7m54.955220422s"} [root@node1 ~] #
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.