您的位置 首页 数据库

TiDB Cluster模拟生产部署实 战

TiDB Cluster模拟生产部署实战

TiUP工具的下载安装

wget https://tiupmirrors.pingcap.com/install.sh
sh install.sh
source .bash_profile
tiup cluster
tiup update --self && tiup update cluster

2.3 TiUP 配置文件修改

# # Global variables are applied to all
deployments and used as the default value
of
# # the deployments if a specific
deployment value is missing.
global:
user: "tidb"
ssh_port: 22
deploy_dir: "/data/tidb-deploy"
data_dir: "/data/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"]
tiflash:
logger.level: "info"
pd_servers:
- host: 10.0.0.20
tidb_servers:
- host: 10.0.0.20
tikv_servers:
- host: 10.0.0.20
port: 20160
status_port: 20180
config:
server.labels: { host: "logic-host-1"
}
- host: 10.0.0.20
port: 20161
status_port: 20181
config:
2.4 部署TiDB Cluster
server.labels: { host: "logic-host-2"
}
- host: 10.0.0.20
port: 20162
status_port: 20182
config:
server.labels: { host: "logic-host-3"
}
tiflash_servers:
- host: 10.0.0.20
monitoring_servers:
- host: 10.0.0.20
grafana_servers:
- host: 10.0.0.20

 

2.4 部署TiDB Cluster

# 1. 由于模拟多机部署,需要通过 root 用户调大
sshd 服务的连接数限制
修改 /etc/ssh/sshd_config 将 MaxSessions 调至
20。
重启 sshd 服务
# 2. 创建并启动集群
按下面的配置模板,编辑配置文件,命名为 topo.yaml,
其中:
user: "tidb":表示通过 tidb 系统用户(部署会自动
创建)来做集群的内部管理,默认使用 22 端口通过 ssh
登录目标机器
replication.enable-placement-rules:设置这个
PD 参数来确保 TiFlash 正常运行
host:设置为本部署主机的 IP
# 3. 执行集群部署命令
tiup cluster deploy oldguo-cluster v5.2.1
./topo.yaml --user root -p
# 4. 启动集群
tiup cluster start oldguo-cluster
# 5. 访问 TiDB 数据库,密码为空
mysql -h 10.0.0.20 -P 4000 -u root
# 6. 访问 TiDB 的 Grafana 监控
通过 http://{grafana-ip}:3000 访问集群
Grafana 监控页面,默认用户名和密码均为 admin。
# 7.访问 TiDB 的 Dashboard
通过 http://{pd-ip}:2379/dashboard 访问集群
TiDB Dashboard 监控页面,默认用户名为 root,密码
为空。
# 8. 执行以下命令确认当前已经部署的集群列表
tiup cluster list
主机 IP 角色 配置
master 10.0.0.11 控制节点 2c4G
node1 10.0.0.12 计算节点 2c4G

 

欢迎来撩 : 汇总all

白眉大叔

关于白眉大叔linux云计算: 白眉大叔

热门文章