(二)TIDB搭建正式集群
需要在linux系统各种搭建集群或者单结点。一准备环境linux环境关闭防火墙。安装盘大于30G否则会失败。二、下载包官网https://pingkai.cn/download#tidb-community部署手册https://pingkai.cn/docs/pingkaidb/stable/production-deployment-using-tiup/三、在线安装TIUPtiup默认的安装路径~/.tiup即/root/.tiup 所有的组件都在这个下面如果我们安装到指定的目录下1、指定目录export TIUP_HOME/data/tidb/tiup2、下载TIUPcurl --proto https --tlsv1.2 -sSf https://tiup-mirrors.pingcap.com/install.sh | sh3、声明全局环境变量source /root/.bash_profile4、查看环境变量[rootlocalhost ~]# cat .bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH$PATH:$HOME/bin export PATH export PATH/data/tidb/tiup/bin:$PATH如果第一次默认安装第二次在修改了路径此时.bash_profile文件中的路径没有删除请手动修改否则 which tiup 的时候无法查看。5、验证tiupwhich tiup tiup --version此时我们的tiup就安装好了下面就可以使用 tiup cluster 命令安装各个组件了。四、使用tiup cluster 搭建正式集群1、创建拓扑文件tiup cluster template /data/tidb/topology.yaml2、topology.yaml文件中文件路径和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: # # The user who runs the tidb cluster. user: tidb # # group is used to specify the group name the user belong to if its not the same as user. # group: tidb # # SSH port of servers in the managed cluster. ssh_port: 22 # # Storage directory for cluster deployment files, startup scripts, and configuration files. deploy_dir: /data/tidb/tidb-deploy # # TiDB Cluster data storage directory data_dir: /data/tidb/tidb-data # # default listen_host for all components listen_host: 192.168.50.20 # # Supported values: amd64, arm64 (default: amd64) arch: amd64 # # Monitored variables are applied to all the machines. monitored: # # The communication port for reporting system information of each node in the TiDB cluster. node_exporter_port: 9100 # # Blackbox_exporter communication port, used for TiDB cluster port monitoring. blackbox_exporter_port: 9115 # # Server configs are used to specify the configuration of PD Servers. pd_servers: # # The ip address of the PD Server. - host: 192.168.50.20 # # Server configs are used to specify the configuration of TiDB Servers. tidb_servers: # # The ip address of the TiDB Server. - host: 192.168.50.20 # # Server configs are used to specify the configuration of TiKV Servers. tikv_servers: # # The ip address of the TiKV Server. - host: 192.168.50.20 # # Server configs are used to specify the configuration of TiFlash Servers. tiflash_servers: # # The ip address of the TiFlash Server. - host: 192.168.50.20 # # Server configs are used to specify the configuration of Prometheus Server. monitoring_servers: # # The ip address of the Monitoring Server. - host: 192.168.50.20 # # Server configs are used to specify the configuration of Grafana Servers. grafana_servers: # # The ip address of the Grafana Server. - host: 192.168.50.20 # # Server configs are used to specify the configuration of Alertmanager Servers. alertmanager_servers: # # The ip address of the Alertmanager Server. - host: 192.168.50.203、从拓扑文件中部署一个名字为demo_tidb 版本为v8.5.5的集群tiup cluster deploy demo_tidb v8.5.5 /data/tidb/topology.yaml --user root -p比较慢静静地等待就可以了。4、成功标志5、启动集群--初始化启动初始化了密码优先使用 tiup cluster start ontology_tidb --init --普通启动tidb密码为空 tiup cluster start ontology_tidb 成功了提示started cluster demo_tidb successfully6、集群的其他操作1、停止集群 tiup cluster stop demo_tidb 2、查看集群状态 tiup cluster display demo_tidb 3、销毁集群 tiup cluster destroy demo_tidb 4.卸载tiup --卸载 tiup 组件 tiup uninstall --all --卸载自己 tiup uninstall --self 5、最后删除掉创建的目录文件7、访问控制台http://192.168.50.20:2379/8、使用客户端连接mysql 8.0以上驱动均可。
上一篇/下一篇内容由系统自动关联
返回资讯列表 →