系统版本 centos7

[root@localhost ~]# cat /etc/centos-release
CentOS Linux release 7.5.1804 (Core) 

关闭iptables,关闭selinux

[root@spark51 ~]# systemctl stop firewalld
[root@spark51 ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
   Active: inactive (dead)
     Docs: man:firewalld(1)
[root@spark51 ~]# systemctl disable firewalld

# 关闭selinux
[root@spark51 ~]# getenforce 
Disabled
[root@spark51 ~]# setenforce 0
setenforce: SELinux is disabled
[root@spark51 ~]# sed -i '/SELINUX/s/enforcing/disabled/g' /etc/selinux/config 

安装docker

yum install -y docker

docker的常用命令

# 搜索镜像,默认官网
docker search ubuntu

# 从docker镜像仓库拉取
docker pull ubuntu:latest

# 显示docker镜像
docker images

# 启动一个容器
docker run -i -t --name hello ubuntu /bin/bash

#  -i(interactive) -t(Pseudo-tty) 
#  --name 指定容器名称

exit  退出容器

# 显示docker所有容器
docker ps -a

# 只显示正在运行的docker容器
docker ps

# 使用start命令启动容器,hello是docker容器的名字
docker start|restart|stop|attach hello

# 在容器外,执行 容器内的命令
sudo docker exec hello cat /etc/passwd

# 进入容器
sudo docker exec -it 775c7c9ee1e1 /bin/bash

#####################################

# 使用rm 命令删除容器
docker rm hello

docker ps -a

# 使用rmi 命令删除 镜像
docker rmi ubuntu:latest

docker images

## 关闭所有容器
docker stop $(docker ps -a -q)

## 删除所有容器
docker rm $(docker ps -a -q)

docker-compose 方式安装TiDB

TiDB指导文档

安装docker docker-compose

yum install docker docker-compose -y && service docker start

下载 tidb-docker-compose

git clone https://github.com/pingcap/tidb-docker-compose.git

创建并启动集群

cd tidb-docker-compose && docker-compose pull # Get the latest Docker images
docker-compose up -d

访问集群

mysql -h 127.0.0.1 -P 4000 -u root

访问集群 Grafana 监控页面:http://localhost:3000 默认用户名和密码均为 admin。

集群数据可视化:http://localhost:8010