tidb测试环境安装,离线部署
1.环境以及规划
机器:centos7.5 ; ⽂件系统为ext4;内存16g;cpu8核,共三个节点;
ip hostname roles
10.40.20.66 vm-10-40-20-66 tidb tipd tikv
10.40.20.67 vm-10-40-20-67 tidb tipd tikv
10.40.20.92 vm-10-40-20-92 tipd tikv
2 .本地下载tidb-ansible-master.zip,上传到中控机,然后重命名为tidb-ansible;
3.安装ansible:
sudo yum -y install python-pip curl
sudo yum -y install sshpass
cd tidb-ansible
sudo pip install -
[tidb@vm-10-40-20-66:/opt/Jinja2-2.9.6]$ cat /home/tidb/
ansible>=2.4.2
jinja2>=2.9.6
jmespath>=0.9.0
sudo pip install -会报错缺少依赖包,由于集没外⽹,去mirrors.aliyun/pypi/simple/镜像去下载python依赖包到本地,再上传到中控机:Jinja2-2.9.;jmespath-0.9.;MarkupSafe-0. ,注意版本匹配;
各个python包解压后⾥⾯都有⼀个setup.py脚本,使⽤如下命令安装:
python setup.py install
4.创建tidb⽤户,设置免密码登录,配ntp同步;
ansible -i hosts.ini all -m shell -a "ntpstat" -b
ansible -i hosts.ini all -m shell -a "ntpq -p" -b
5.编辑host.ini:
[tidb@vm-10-40-20-66:~/tidb-ansible]$ cat hosts.ini
[servers]
kafka命令10.40.20.66
10.40.20.67
10.40.20.92
[all:vars]
username = tidb
ntp_server =
6.编辑invertory.ini:
## TiDB Cluster Part
[tidb_servers]
10.40.20.66
10.40.20.67
[tikv_servers]
10.40.20.66
10.40.20.67
10.40.20.92
[pd_servers]
10.40.20.66
10.40.20.67
10.40.20.92
[spark_master]
[spark_slaves]
## Monitoring Part
# prometheus and pushgateway servers
[monitoring_servers]
10.40.20.66
[grafana_servers]
10.40.20.66
# node_exporter and blackbox_exporter servers
[monitored_servers]
10.40.20.66
10.40.20.67
10.40.20.92
[alertmanager_servers]
10.40.20.66
[kafka_exporter_servers]
## Binlog Part
[pump_servers:children]
tidb_servers
[drainer_servers]
## Group variables
[pd_servers:vars]
# location_labels = ["zone","rack","host"]
## Global variables
[all:vars]
deploy_dir = /data/tidb/deploy
## Connection
# ssh via normal user
ansible_user = tidb
cluster_name = leochen-cluster
tidb_version = v2.0.7
# process supervision, [systemd, supervise]
process_supervision = systemd
timezone = Asia/Shanghai
enable_firewalld = False
# check NTP service
enable_ntpd = True
set_hostname = False
## binlog trigger
enable_binlog = False
# zookeeper address of kafka cluster for binlog, example:
# zookeeper_addrs = "192.168.0.11:2181,192.168.0.12:2181,192.168.0.13:2181"
zookeeper_addrs = ""
# kafka cluster address for monitoring, example:
# kafka_addrs = "192.168.0.11:9092,192.168.0.12:9092,192.168.0.13:9092"
kafka_addrs = ""
# store slow query log into seperate file
enable_slow_query_log = False
# enable TLS authentication in the TiDB cluster
enable_tls = False
# KV mode
deploy_without_tidb = False
# Optional: Set if you already have a alertmanager server.
# Format: alertmanager_host:alertmanager_port
alertmanager_target = ""
grafana_admin_user = "admin"
grafana_admin_password = "admin"
### Collect diagnosis
collect_log_recent_hours = 2
enable_bandwidth_limit = True
# default: 10Mb/s, unit: Kbit/s
collect_bandwidth_limit = 10000
7.安装tidb集:
安装前检验
执⾏以下命令如果所有 server 返回 tidb 表⽰ ssh 互信配置成功。
ansible -i inventory.ini all -m shell -a 'whoami'
执⾏以下命令如果所有 server 返回 root 表⽰ tidb ⽤户 sudo 免密码配置成功。
ansible -i inventory.ini all -m shell -a 'whoami' -b
下载安装包,上传到downloads⽬录:
[tidb@vm-10-40-20-66:~/tidb-ansible/downloads]$ ll
total 565468
-rw-r--r-- 1 tidb tidb 9631079 Nov 117:08 alertmanager-0.14.
-rw-r--r-- 1 tidb tidb 4950085 Nov 117:08 blackbox_exporter-0.12.
-rw-r--r-- 1 tidb tidb 2125503 Nov 117:08 fio-3.
-rw-r--r-- 1 tidb tidb 47187988 Nov 117:08 grafana-4.6.
-
rw-r--r-- 1 tidb tidb 3124144 Nov 117:08 grafana_
-rw-r--r-- 1 tidb tidb 3940228 Nov 117:08 kafka_exporter-1.1.
-rw-r--r-- 1 tidb tidb 5278094 Nov 117:08 node_exporter-0.15.
-rw-r--r-- 1 tidb tidb 26438285 Nov 117:08 prometheus-2.2.
-rw-r--r-- 1 tidb tidb 3723718 Nov 117:08 pushgateway-0.4.
-rw-r--r-- 1 tidb tidb 201142612 Nov 117:08 spark-2.1.
-rw-r--r-- 1 tidb tidb 45854140 Nov 117:08
-rw-r--r-- 1 tidb tidb 3551289 Nov 117:08
-rw-r--r-- 1 tidb tidb 43271878 Nov 117:08
-rw-r--r-- 1 tidb tidb 156970586 Nov 117:08 tidb-v2.0.
-rw-r--r-- 1 tidb tidb 18878689 Nov 117:08
-
rw-r--r-- 1 tidb tidb 2937369 Nov 117:08
8.编辑l⽂件,不符合的可以暂时注释掉,测试环境机器配置不⾼;
9.l;
10.l;
11.l;
12 . 使⽤ MySQL 客户端连接测试,TCP 4000 端⼝是 TiDB 服务默认端⼝。
[tidb@vm-10-40-20-66:~/tidb-ansible/downloads]$ mysql -u root -h 10.40.20.66 -P 4000 Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 107
Server version: 5.7.10-TiDB-v2.0.7 MySQL Community Server (Apache License 2.0) Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| INFORMATION_SCHEMA |
| PERFORMANCE_SCHEMA |
| mysql |
| test |
+--------------------+
4 rows in set (0.00 sec)
13.通过浏览器访问监控平台:
地址:10.40.20.66:3000 默认帐号密码是:admin / admin
14.集销毁:
ansible-playbook l
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论