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 -r requirements.txt     
sudo pip install -r requirements.txt会报错缺少依赖包,去http://mirrors.aliyun.com/pypi/simple/镜像去下载python依赖包:
Jinja2-2.9.6.tar.gz;jmespath-0.9.1.tar.gz;MarkupSafe-0.23.tar.gz ,注意版本依赖;

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]
10.40.20.66
10.40.20.67
10.40.20.92

[all:vars]
username = tidb
ntp_server = pool.ntp.org

  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  1 17:08 alertmanager-0.14.0.tar.gz
-rw-r--r-- 1 tidb tidb   4950085 Nov  1 17:08 blackbox_exporter-0.12.0.tar.gz
-rw-r--r-- 1 tidb tidb   2125503 Nov  1 17:08 fio-3.8.tar.gz
-rw-r--r-- 1 tidb tidb  47187988 Nov  1 17:08 grafana-4.6.3.tar.gz
-rw-r--r-- 1 tidb tidb   3124144 Nov  1 17:08 grafana_collector-latest.tar.gz
-rw-r--r-- 1 tidb tidb   3940228 Nov  1 17:08 kafka_exporter-1.1.0.tar.gz
-rw-r--r-- 1 tidb tidb   5278094 Nov  1 17:08 node_exporter-0.15.2.tar.gz
-rw-r--r-- 1 tidb tidb  26438285 Nov  1 17:08 prometheus-2.2.1.tar.gz
-rw-r--r-- 1 tidb tidb   3723718 Nov  1 17:08 pushgateway-0.4.0.tar.gz
-rw-r--r-- 1 tidb tidb 201142612 Nov  1 17:08 spark-2.1.1-bin-hadoop2.7.tgz
-rw-r--r-- 1 tidb tidb  45854140 Nov  1 17:08 tidb-binlog-latest.tar.gz
-rw-r--r-- 1 tidb tidb   3551289 Nov  1 17:08 tidb-insight.tar.gz
-rw-r--r-- 1 tidb tidb  43271878 Nov  1 17:08 tidb-tools-latest.tar.gz
-rw-r--r-- 1 tidb tidb 156970586 Nov  1 17:08 tidb-v2.0.7.tar.gz
-rw-r--r-- 1 tidb tidb  18878689 Nov  1 17:08 tispark-latest.tar.gz
-rw-r--r-- 1 tidb tidb   2937369 Nov  1 17:08 tispark-sample-data.tar.gz

8.编辑bootstrap.yml文件,不符合的可以暂时注释掉,测试环境机器配置不高;

9.ansible-playbook bootstrap.yml;

10.ansible-playbook deploy.yml;

11.ansible-playbook start.yml;

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.通过浏览器访问监控平台:

地址: http://10.40.20.66:3000 默认帐号密码是: admin / admin 

     

猜你喜欢

转载自www.cnblogs.com/gxc2015/p/9890958.html