centos7开放端口访问不了_基于TiUP cluster 在centos7系统上模拟生产环境部署TiDB数据库...
概述
今天主要来体验下TiDB 最小的完整拓扑的集群,参照 TiUP 最小拓扑的一个 YAML 文件来部署 TiDB 集群,下面一起来看看吧~
一、环境要求
最小规模的 TiDB 集群拓扑:
部署主机软件和环境要求:
- 部署需要使用部署主机的 root 用户及密码
- 部署主机关闭防火墙或者开放 TiDB 集群的节点间所需端口
- 目前 TiUP 仅支持在 x86_64 (AMD64) 架构上部署 TiDB 集群(TiUP 将在 4.0 GA 时支持在 ARM 架构上部署)
- 在 AMD64 架构下,建议使用 CentOS 7.3 及以上版本 Linux 操作系统
- 在 ARM 架构下,建议使用 CentOS 7.6 1810 版本 Linux 操作系统
二、安装部署TiDB集群
1、下载并安装 TiUP
TiDB 4.0 做了一个全新的组件管理工具—— TiUP,装完之后,控制台会提示使用 tiup playground 来在单机启动一个 TiDB 集群,然后我们就可以使用 MySQL 客户端连接 TiDB 集群,并且开始测试了。
curl --proto '=https' --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | shsource ~/.bash_profile2、安装 TiUP 的 cluster 组件
tiup cluster--如果机器已经安装 TiUP cluster,需要更新软件版本tiup update --self && tiup update cluster3、调大 sshd 服务的连接数限制
由于模拟多机部署,需要通过 root 用户调大 sshd 服务的连接数限制,这里修改 /etc/ssh/sshd_config 将 MaxSessions 调至 20后重启sshd服务
4、创建配置模板
4.1、创建路径
mkdir -p /tidb-deploymkdir -p /tidb-data4.2、创建模板topo.yaml
按下面的配置模板,编辑配置文件,命名为 topo.yaml,其中:
user: "tidb":表示通过 tidb 系统用户(部署会自动创建)来做集群的内部管理,默认使用 22 端口通过 ssh 登录目标机器
replication.enable-placement-rules:设置这个 PD 参数来确保 TiFlash 正常运行
host:设置为本部署主机的 IP
# # 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: "/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 tiflash: logger.level: "info" pd_servers: - host: 192.168.189.35 tidb_servers: - host: 192.168.189.35 tikv_servers: - host: 192.168.189.35 port: 20160 status_port: 20180 - host: 192.168.189.35 port: 20161 status_port: 20181 - host: 192.168.189.35 port: 20162 status_port: 20182 tiflash_servers: - host: 192.168.189.35 monitoring_servers: - host: 192.168.189.35 grafana_servers: - host: 192.168.189.355、集群部署
格式:tiup cluster deploy ./topo.yaml --user root -p
说明:
1)参数 表示设置集群名称
2)参数 表示设置集群版本,可以通过 tiup list tidb 命令来查看当前支持部署的 TiDB 版本
tiup cluster deploy tiup_hwb v4.0.0 ./topo.yaml --user root -p这个部署方式看起来就挺顺眼,正常就得这样搞..
ps:如果报超时的话重新执行上面的命令就行..
6、启动集群
--启动集群tiup cluster start tiup_hwb--停止集群tiup cluster stop tiup_hwb7、访问集群
1)访问 TiDB 数据库,密码为空:
mysql -h 192.168.189.35 -P 4000 -u root2)访问 TiDB 的 Grafana 监控
这里用prometheus+grafana来做监控,监控模板都直接弄好了..
通过 http://{grafana-ip}:3000 访问集群 Grafana 监控页面,默认用户名和密码均为 admin。这里我密码修改为hwb74894
3)访问 TiDB 的 Dashboard:
通过 http://{pd-ip}:2379/dashboard 访问集群 TiDB Dashboard 监控页面,默认用户名为 root,密码为空。
4)确认当前已经部署的集群列表:
tiup cluster list
5)查看集群的拓扑结构和状态:
格式:tiup cluster display
tiup cluster display tiup_hwb总结:
TiDB是很人性化的一个数据库,很酷,值得深入研究~
觉得有用的朋友多帮忙转发哦!后面会分享更多devops和DBA方面的内容,感兴趣的朋友可以关注下~
总结
以上是生活随笔为你收集整理的centos7开放端口访问不了_基于TiUP cluster 在centos7系统上模拟生产环境部署TiDB数据库...的全部内容,希望文章能够帮你解决所遇到的问题。
- 上一篇: python shelve模块_pyth
- 下一篇: java分布式 mq_分布式系统消息中间