rpm/deb 或yum/apt 一直以來都是Linux 上最簡單的軟件安裝方式。
由於TiDB 官方更推崇ansible/docker/k8s的安裝方式,對於傳統安裝方式,官方僅僅給出了二進制安裝文件,沒有給出rpm 安裝方式。
本着折騰的精神,我基於源碼給TiDB 編譯打包了一份rpm包,這是目前最簡單快速的安裝體驗TiDB 的方法。
環境:CentOS 7
TiDB 版本:3.0.3
1、安裝TiDB
yum-config-manager --add-repo http://purplegrape.github.io/public.repo yum install pd tikv tidb -y
2、啓動服務
systemctl enable pd-server tikv-server tidb-server --now
3、安裝mysql客戶端
yum install mariadb -y
4、使用TiDB
mysql -u root -P 4000 Welcome to the MariaDB monitor. Commands end with ; or \g. Your MySQL connection id is 2 Server version: 5.7.25-TiDB- 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 [(none)]>
在硬件條件相同的情況下,與MySQL 相比,TiDB 單機性能很低,在實際生產環境中,通常是以集羣的方式使用。
TiDB 的優點在於保持MySQL兼容性的同時,解決了以往“砸錢堆硬件”都難以實現的簡單性、維護性和擴展性。