os: centos 7.4
db: tidb
ip 规划
192.168.56.99 xxoo
参考 <
# 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/