Docker方式部署TiDB(CentOS 7.5)
安裝Docker
[root@localhost /]# cat /etc/redhat-release CentOS Linux release 7.5.1804 (Core) [root@localhost /]# yum install docker-ce -y [root@localhost tidb]# service docker start Redirecting to /bin/systemctl start docker.service
拉取 TiDB 的 Docker 映象
[root@localhost /]# docker pull pingcap/tidb:latest [root@localhost /]# docker pull pingcap/tikv:latest [root@localhost /]# docker pull pingcap/pd:latest [root@localhost /]# mkdir tidb
部署一個多節點叢集
啟動PD(1個節點)
docker run -d --name pd1 \ -p 2379:2379 \ -p 2380:2380 \ -v /etc/localtime:/etc/localtime:ro \ -v /tidb:/tidb \ pingcap/pd:latest \ --name="pd1" \ --data-dir="/tidb/pd1" \ --client-urls="\ --advertise-client-urls="http://192.168.30.131:2379" \ --peer-urls="\ --advertise-peer-urls="http://192.168.30.131:2380" \ --initial-cluster="pd1=http://192.168.30.131:2380"
啟動TiKV(3個節點)
docker run -d --name tikv1 \ -p 20160:20160 \ --ulimit nofile=1000000:1000000 \ -v /etc/localtime:/etc/localtime:ro \ -v /tidb:/tidb \ pingcap/tikv:latest \ --addr="0.0.0.0:20160" \ --advertise-addr="192.168.30.131:20160" \ --data-dir="/tidb/tikv1" \ --pd="192.168.30.131:2379" docker run -d --name tikv2 \ -p 20161:20161 \ --ulimit nofile=1000000:1000000 \ -v /etc/localtime:/etc/localtime:ro \ -v /tidb:/tidb \ pingcap/tikv:latest \ --addr="0.0.0.0:20161" \ --advertise-addr="192.168.30.131:20161" \ --data-dir="/tidb/tikv2" \ --pd="192.168.30.131:2379" docker run -d --name tikv3 \ -p 20162:20162 \ --ulimit nofile=1000000:1000000 \ -v /etc/localtime:/etc/localtime:ro \ -v /tidb:/tidb \ pingcap/tikv:latest \ --addr="0.0.0.0:20162" \ --advertise-addr="192.168.30.131:20162" \ --data-dir="/tidb/tikv3" \ --pd="192.168.30.131:2379"
啟動TiDB(1個節點)
docker run -d --name tidb \ -p 4000:4000 \ -p 10080:10080 \ -v /etc/localtime:/etc/localtime:ro \ pingcap/tidb:latest \ --store=tikv \ --path="192.168.30.131:2379"
檢視Docker服務狀態
[root@localhost tidb]# docker ps CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES ce37e8785c99 pingcap/tikv:latest "/tikv-server --addr…" 14 minutes ago Up 14 minutes 20160/tcp, 0.0.0.0:20162->20162/tcp tikv3 419020160d11 pingcap/tikv:latest "/tikv-server --addr…" 15 minutes ago Up 15 minutes 20160/tcp, 0.0.0.0:20161->20161/tcp tikv2 bfba95e0d4de pingcap/tidb:latest "/tidb-server --stor…" About an hour ago Up About an hour 0.0.0.0:4000->4000/tcp, 0.0.0.0:10080->10080/tcp tidb c7c3a9cd2e55 pingcap/tikv:latest "/tikv-server --addr…" About an hour ago Up About an hour 0.0.0.0:20160->20160/tcp tikv1 e2846afa5f0c pingcap/pd:latest "/pd-server --name=p…" About an hour ago Up About an hour 0.0.0.0:2379-2380->2379-2380/tcp pd1
使用 MySQL 標準客戶端連線 TiDB 測試
[root@localhost tidb]# mysql -h 127.0.0.1 -P 4000 -u root -D test Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 6 Server version: 5.7.10-TiDB-v2.1.0-rc.1-67-gb2bfd8f MySQL Community Server (Apache License 2.0) Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. MySQL [test]> show databases; +--------------------+ | Database | +--------------------+ | INFORMATION_SCHEMA | | PERFORMANCE_SCHEMA | | mysql | | test | +--------------------+ 4 rows in set (0.00 sec)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26506993/viewspace-2213771/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Docker 的部署方式Docker
- CentOS7.4 部署 DockerCentOSDocker
- 基於 Docker-CentOS7.5 安裝 Laravel, 完美無坑!DockerCentOSLaravel
- Linux部署之Docker方式部署專案LinuxDocker
- CentOS 7 Docker安裝部署Go WebCentOSDockerGoWeb
- CentOS7 docker安裝部署教程CentOSDocker
- CentOS 7.5 重置 root 密碼CentOS密碼
- CentOs7.5安裝FFmpegCentOS
- centos7.5配置yum源CentOS
- Centos7安裝安裝部署dockerCentOSDocker
- CentOS7部署Docker(聯網)CentOSDocker
- 在centos8使用Docker部署Django專案CentOSDockerDjango
- Centos 從安裝到部署之 Docker篇(二)CentOSDocker
- CentOS7.5常用命令整理CentOS
- sonic 可以本地部署嗎,不透過 docker 的方式Docker
- 單機CentOS 安裝 TiDBCentOSTiDB
- 在CentOS 7.5上安裝和配置ProFTPDCentOSFTP
- Centos7安裝jenkins+docker部署tomcatCentOSJenkinsDockerTomcat
- CentOS中實現基於Docker部署BI資料分析CentOSDocker
- Docker實踐(6)—CentOS7上部署KubernetesDockerCentOS
- CentOS 7.5靜默安裝Oracle 11gCentOSOracle
- centos7.5利用yum快取搭建本地源CentOS快取
- webapi透過docker部署到Linux的兩種方式WebAPIDockerLinux
- CentOs雲伺服器安裝docker+前端部署(僅http)CentOS伺服器Docker前端HTTP
- .Net 6.0 WebApi 使用Docker部署到Linux系統CentOS 7WebAPIDockerLinuxCentOS
- MySQL+MGR 單主模式和多主模式的叢集環境 - 部署手冊 (Centos7.5)MySql模式CentOS
- CentOS學習筆記 – 12. Nginx搭建Centos7.5遠端repoCentOS筆記Nginx
- TiDB資料庫PD混合部署TiDB資料庫
- TiDB小型叢集部署實踐TiDB
- 使用 Ansible 安裝部署 TiDBTiDB
- CentOS7編譯和安裝GCC7.5CentOS編譯GC
- Oracle 11.2.0.1.0在Centos7.5安裝的坑OracleCentOS
- CentOS 7.5 modify the sshd port with SElinux and Firewalld Service runningCentOSLinux
- 在CentOS7.5上搭建Hadoop3.xCentOSHadoop
- centos7.5 設定Mysql開機自啟動CentOSMySql
- CentOS7.5+PHP5.6.36+Nginx1.14.0配置筆記CentOSPHPNginx筆記
- Centos 使用 dockerCentOSDocker
- 【Docker】使用docker部署 mysqlDockerMySql