tidb docker setup

os: centos 7.4
db: tidb

ip 规划

192.168.56.99	xxoo

参考 <<centos 7 安装 Docker,Docker Compose,Git>>预先安装工具。

os 设置


tidb安装

# cd /opt;
git clone https://github.com/pingcap/tidb-docker-compose.git;

# cd tidb-docker-compose && docker-compose pull;
# docker-compose up -d;

# ps -ef|grep -i docker |grep -v grep

root      4632     1  3 16:16 ?        00:01:26 /usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock
root      7251  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/b3b23f5ab59b117cac1f0ef5577872be0e0c2d4b944671e166c4b2bfdb7343f0 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7265  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/44dde4f512167be7a1657aefc6be8246010dc71c3e3e8dee15828b27e8a7ee62 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7307  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/01b3a05859c3aedf050c776a71c2800d39eb384f909409b6ab9fcb5af978fe86 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7350  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/e9714b127b7c3f0b6f512f5d49e0a360ec3f038f20ea219dc3bdff8e65e98153 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7383  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/85385b74c298e4de0c6f718b61d316cf77ed7293a51c64cec58b8d1b11766a6c -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7534  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/b6b805ab60ba2f3808e657af6ed8ff9896ff16f7d2f4c7b8910f9a6ac75bcdb1 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7591  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/f4b31f21729131a8acc62ef30a9eecbda4ec9a89373a1e38905afd106a7f43cb -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7958  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/bf32f4b8eaaa6692e19907e27c71d0682abe9fa9f22ed6afcce9d03828387f9f -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7994  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/d4195e9feeabf1b7ecae007a5927e128467b7507af29323794edfc8c85161e2a -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      7999  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/21d5370ef9ded06d64688662436b99a88198941cb0239913ac3d3d2bbeab91aa -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      8291  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/3e92b2fe52baa5e1ff3d2c1ef391318e141c84f4c01382534f97b51f295f03b3 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      8305  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/541522a03791eb313ff8bad395d25c8cdbac6b6ed92be613cc4b98ddd96b7ae0 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc
root      8493  4631  0 16:51 ?        00:00:00 containerd-shim -namespace moby -workdir /var/lib/containerd/io.containerd.runtime.v1.linux/moby/ab652ce555afb5f5e2e0750472fcd1d76c9e0d8870eb777d53eb5e547de52193 -address /run/containerd/containerd.sock -containerd-binary /usr/bin/containerd -runtime-root /var/run/docker/runtime-runc

root      7218  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 3000 -container-ip 172.18.0.2 -container-port 3000
root      7241  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 32768 -container-ip 172.18.0.3 -container-port 2379
root      7281  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 32769 -container-ip 172.18.0.4 -container-port 2379
root      7333  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 32770 -container-ip 172.18.0.5 -container-port 2379
root      7407  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 9090 -container-ip 172.18.0.6 -container-port 9090
root      7469  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8010 -container-ip 172.18.0.8 -container-port 8010
root      8240  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 10080 -container-ip 172.18.0.12 -container-port 10080
root      8254  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 4000 -container-ip 172.18.0.12 -container-port 4000
root      8268  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 8080 -container-ip 172.18.0.13 -container-port 8080
root      8282  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 7077 -container-ip 172.18.0.13 -container-port 7077
root      8482  4632  0 16:51 ?        00:00:00 /usr/bin/docker-proxy -proto tcp -host-ip 0.0.0.0 -host-port 38081 -container-ip 172.18.0.14 -container-port 38081

root      7299  7251  0 16:51 ?        00:00:04 grafana-server --homepath=/usr/share/grafana --config=/etc/grafana/grafana.ini --packaging=docker cfg:default.log.mode=console cfg:default.paths.data=/var/lib/grafana cfg:default.paths.logs=/var/log/grafana cfg:default.paths.plugins=/var/lib/grafana/plugins cfg:default.paths.provisioning=/etc/grafana/provisioning

访问集群

# cd /tmp;
wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm;
yum -y install ./mysql80-community-release-el7-3.noarch.rpm;
yum -y install mysql-community-client;

# which mysql

# mysql -h 127.0.0.1 -P 4000 -u root
mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select * from tidb;
+--------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+
| VARIABLE_NAME            | VARIABLE_VALUE                                                                             | COMMENT                                                                                     |
+--------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+
| bootstrapped             | True                                                                                       | Bootstrap flag. Do not delete.                                                              |
| tidb_server_version      | 35                                                                                         | Bootstrap version. Do not delete.                                                           |
| system_tz                | UTC                                                                                        | TiDB Global System Timezone.                                                                |
| tikv_gc_leader_uuid      | 5b506e58e440002                                                                            | Current GC worker leader UUID. (DO NOT EDIT)                                                |
| tikv_gc_leader_desc      | host:3e92b2fe52ba, pid:1, start at 2019-09-18 00:15:31.753129705 +0000 UTC m=+38.827375653 | Host name and pid of current GC leader. (DO NOT EDIT)                                       |
| tikv_gc_leader_lease     | 20190918-00:36:32 +0000                                                                    | Current GC worker leader lease. (DO NOT EDIT)                                               |
| tikv_gc_enable           | true                                                                                       | Current GC enable status                                                                    |
| tikv_gc_run_interval     | 10m0s                                                                                      | GC run interval, at least 10m, in Go format.                                                |
| tikv_gc_life_time        | 10m0s                                                                                      | All versions within life time will not be collected by GC, at least 10m, in Go format.      |
| tikv_gc_last_run_time    | 20190918-00:25:32 +0000                                                                    | The time when last GC starts. (DO NOT EDIT)                                                 |
| tikv_gc_safe_point       | 20190918-00:15:32 +0000                                                                    | All versions after safe point can be accessed. (DO NOT EDIT)                                |
| tikv_gc_auto_concurrency | true                                                                                       | Let TiDB pick the concurrency automatically. If set false, tikv_gc_concurrency will be used |
| tikv_gc_mode             | distributed                                                                                | Mode of GC, "central" or "distributed"                                                      |
+--------------------------+--------------------------------------------------------------------------------------------+---------------------------------------------------------------------------------------------+
13 rows in set (0.01 sec)

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

在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
集群数据可视化:http://192.168.56.99:8010

在这里插入图片描述

参考:
https://pingcap.com/docs-cn/dev/how-to/get-started/deploy-tidb-from-docker-compose/

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

数据库人生

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值