背景:首先使用vitess官网的中文文档进行安装,过程中报了没有etcd的错,觉得很奇怪,后来笔者发现当前日期下,vitess官网的中文文档安装流程和英文文档安装流程竟然不一样,之后使用英文版本的安装流程安装成功,记录过程如下。
系统:CentOS7
版本:Vitess-14.0.0
说明:CentOS的yum已改为阿里源
部署过程主要以英文版官方流程为主
# Yum based
sudo yum -y localinstall https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm
sudo yum -y install mysql-community-server etcd curl
说明:在安装mysql过程中如果出现了如下语句:
mysql-community-client-5.7.38-1.el7.x86_64.rpm的公钥尚未安装
可先执行下面语句导入KEY:
rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022
再次执行安装,成功
# Debian and Ubuntu
sudo service mysql stop
sudo service etcd stop
sudo systemctl disable mysql
sudo systemctl disable etcd
# CentOS
sudo setenforce 0
下载Vitess对应版本的压缩包,可以wget下载也可以手动在网址下载,以 Vitess 6 为例:
version=6.0.20-20200818
file=vitess-${version}-90741b8.tar.gz
wget https://github.com/vitessio/vitess/releases/download/v${version}/${file}
tar -xzf ${file}
cd ${file/.tar.gz/}
sudo mkdir -p /usr/local/vitess
sudo cp -r * /usr/local/vitess/
手动下载地址为
https://github.com/planetscale/vitess-releases/releases
之后添加/usr/local/vitess/bin到PATH环境变量
export PATH=/usr/local/vitess/bin:${PATH}
添加后可通过echo语句查看是否添加成功
echo $PATH
执行官网案例中的101_initial_cluster.sh,这里的官网的文档所写路径是有问题的,应该多进入两层文件夹,语句应当为下:
cp -r /usr/local/vitess/share/vitess/examples/local ~/my-vitess-example
cd ~/my-vitess-example
./101_initial_cluster.sh
此时应该会看到类似于以下内容的输出:
add /vitess/global
add /vitess/zone1
add zone1 CellInfo
etcd start done...
Starting vtctld...
Starting MySQL for tablet zone1-0000000100...
Starting vttablet for zone1-0000000100...
#后省略
截至此,完成vitess本地部署
参考文档:
Vitess文档|本地安装.
The Vitess Docs.
CentOS7.9安装Mysql5.7, 解决公钥未安装错误,设置root密码为空.