diff --git a/content/en/blog/2020-04-29-announcing-vitess-6.md b/content/en/blog/2020-04-29-announcing-vitess-6.md new file mode 100644 index 000000000..0dc1836c4 --- /dev/null +++ b/content/en/blog/2020-04-29-announcing-vitess-6.md @@ -0,0 +1,35 @@ +--- +author: 'Morgan Tocker' +date: 2020-04-29T08:00:21-07:00 +slug: '2020-04-29-announcing-vitess-6' +tags: ['Guides'] +title: 'Announcing Vitess 6' +--- + +I am excited to announce the general availability of Vitess 6, the second release to follow our [new accelerated release schedule](https://github.com/vitessio/enhancements/blob/master/veps/vep-1.md). + +While only 12 weeks have elapsed since the previous release, it feels like a few key investments have started to pay dividends all at once. To provide some personal highlights: + +### Improved SQL Support +Vitess now understands much more of MySQL’s syntax. We have taken the approach of studying the queries issued by common applications and frameworks, and baking them right into the end-to-end test suite. + +Common issues such as `SHOW` commands not returning correct results or MySQL’s `SQL_CALC_FOUND_ROWS` feature have now been fixed. In Vitess 7, we plan to add support for setting session variables, which will address one of the largest outstanding compatibility issues. + +### Kubernetes Topology Service +The Helm charts now default to using Kubernetes as the [Topology Service](https://vitess.io/docs/concepts/topology-service/). This helps remove a dependency on etcd-operator, which has since been [discontinued](https://github.com/coreos/etcd-operator/pull/2169). + +This change also unlocked the adoption of Helm 3 and support for a wider range of Kubernetes versions, making installing Vitess much easier. + +### General Availability of VReplication-based Workflows +While VReplication made its appearance in Vitess 4, it has now been promoted from experimental to general availability and the documentation now points to [MoveTables](https://vitess.io/docs/user-guides/move-tables/) and [Resharding](https://vitess.io/docs/user-guides/resharding/). + +These workflows require significantly fewer steps than their predecessors (Vertical Split Clone and Horizontal Sharding), of which we intend to deprecate at some point in the future. + +-- + +In addition to this, the end-to-end testsuite is now [fully migrated to Golang](https://www.planetscale.com/blog/planetscale-migrates-open-source-vitess-test-suite-from-python-to-go), and we’ve improved the health of the code base by removing a lot of legacy code specific to Statement-Based Replication and “V2” query routing. + +There is a slightly higher number of incompatible changes than in prior releases, so we encourage you to spend a moment reading the [release notes](https://github.com/vitessio/vitess/releases/tag/v6.0.20-20200429). + +Please download Vitess 6, and take it for a spin! + diff --git a/content/en/docs/get-started/local-vitess6.md b/content/en/docs/get-started/local-vitess6.md deleted file mode 100644 index d003c2525..000000000 --- a/content/en/docs/get-started/local-vitess6.md +++ /dev/null @@ -1,233 +0,0 @@ ---- -title: Vitess 6 Local Install (Preview) -description: Instructions for using Vitess 6.0 on your machine for testing purposes -weight: 5 ---- - -{{< info >}} -This guide shows instructions for a pre-release of Vitess. -{{< /info >}} - -This guide covers installing Vitess locally for testing purposes, from pre-compiled binaries. We will launch multiple copies of `mysqld`, so it is recommended to have greater than 4GB RAM, as well as 20GB of available disk space. - -## Install MySQL and etcd - -Vitess supports MySQL 5.6+ and MariaDB 10.0+. We recommend MySQL 5.7 if your installation method provides a choice: - -```sh -# Ubuntu based -sudo apt install -y mysql-server etcd curl - -# Debian -sudo apt install -y default-mysql-server default-mysql-client etcd curl - -# 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 -``` - -On apt-based distributions the services `mysqld` and `etcd` will need to be shutdown, since `etcd` will conflict with the `etcd` started in the examples, and `mysqlctl` will start its own copies of `mysqld`: - -```sh -# Debian and Ubuntu -sudo service mysql stop -sudo service etcd stop -sudo systemctl disable mysql -sudo systemctl disable etcd -``` - -## Disable AppArmor or SELinux - -AppArmor/SELinux will not allow Vitess to launch MySQL in any data directory by default. You will need to disable it: - -__AppArmor__: -```sh -# Debian and Ubuntu -sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ -sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld - -# The following command should return an empty result: -sudo aa-status | grep mysqld -``` - -__SELinux__: -```sh -# CentOS -sudo setenforce 0 -``` - -## Install Vitess - -Download the [latest binary release](https://github.com/vitessio/vitess/releases) for Vitess on Linux. For example with Vitess 5: - -```sh -tar -xzf vitess-5.20+20200204-17a806ae5.tar.gz -cd vitess-5.20+20200204-17a806ae5 -sudo mkdir -p /usr/local/vitess -sudo mv * /usr/local/vitess/ -``` - -Make sure to add `/usr/local/vitess/bin` to the `PATH` environment variable. You can do this by adding the following to your `$HOME/.bashrc` file: - -```sh -export PATH=/usr/local/vitess/bin:${PATH} -``` - -You are now ready to start your first cluster! Open a new terminal window to ensure your `.bashrc` file changes take effect. - -## Start a Single Keyspace Cluster - -Start by copying the local examples included with Vitess to your preferred location. For our first example we will deploy a [single unsharded keyspace](../../concepts/keyspace). The file `101_initial_cluster.sh` is for example `1` phase `01`. Lets execute it now: - -```sh -cp -r /usr/local/vitess/examples/local ~/my-vitess-example -cd ~/my-vitess-example -./101_initial_cluster.sh -``` - -You should see output similar to the following: - -```text -~/my-vitess-example> ./101_initial_cluster.sh -$ ./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... -HTTP/1.1 200 OK -Date: Wed, 25 Mar 2020 17:32:45 GMT -Content-Type: text/html; charset=utf-8 - -Starting MySQL for tablet zone1-0000000101... -Starting vttablet for zone1-0000000101... -HTTP/1.1 200 OK -Date: Wed, 25 Mar 2020 17:32:53 GMT -Content-Type: text/html; charset=utf-8 - -Starting MySQL for tablet zone1-0000000102... -Starting vttablet for zone1-0000000102... -HTTP/1.1 200 OK -Date: Wed, 25 Mar 2020 17:33:01 GMT -Content-Type: text/html; charset=utf-8 - -W0325 11:33:01.932674 16036 main.go:64] W0325 17:33:01.930970 reparent.go:185] master-elect tablet zone1-0000000100 is not the shard master, proceeding anyway as -force was used -W0325 11:33:01.933188 16036 main.go:64] W0325 17:33:01.931580 reparent.go:191] master-elect tablet zone1-0000000100 is not a master in the shard, proceeding anyway as -force was used -.. -``` - -You can also verify that the processes have started with `pgrep`: - -```bash -~/my-vitess-example> pgrep -fl vtdataroot -14119 etcd -14176 vtctld -14251 mysqld_safe -14720 mysqld -14787 vttablet -14885 mysqld_safe -15352 mysqld -15396 vttablet -15492 mysqld_safe -15959 mysqld -16006 vttablet -16112 vtgate -``` - -_The exact list of processes will vary. For example, you may not see `mysqld_safe` listed._ - -If you encounter any errors, such as ports already in use, you can kill the processes and start over: - -```sh -pkill -9 -e -f '(vtdataroot|VTDATAROOT)' # kill Vitess processes -rm -rf vtdataroot -``` - -## Setup Aliases - -For ease-of-use, Vitess provides aliases for `mysql` and `vtctlclient`: - -```bash -source alias.source -``` - -Setting up aliases changes `mysql` to always connect to Vitess for your current session. To revert this, type `unalias mysql && unalias vtctlclient` or close your session. - -## Connect to your cluster - -You should now be able to connect to the VTGate server that was started in `101_initial_cluster.sh`: - -```bash -~/my-vitess-example> mysql -Welcome to the MySQL monitor. Commands end with ; or \g. -Your MySQL connection id is 2 -Server version: 5.7.9-Vitess (Ubuntu) - -Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. - -Oracle is a registered trademark of Oracle Corporation and/or its -affiliates. Other names may be trademarks of their respective -owners. - -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. - -mysql> show tables; -+-----------------------+ -| Tables_in_vt_commerce | -+-----------------------+ -| corder | -| customer | -| product | -+-----------------------+ -3 rows in set (0.00 sec) -``` - -You can also browse to the vtctld console using the following URL: - -```text -http://localhost:15000 -``` - -## Summary - -In this example, we deployed a single unsharded keyspace named `commerce`. Unsharded keyspaces have a single shard named `0`. The following schema reflects a common ecommerce scenario that was created by the script: - -```sql -create table product ( - sku varbinary(128), - description varbinary(128), - price bigint, - primary key(sku) -); -create table customer ( - customer_id bigint not null auto_increment, - email varbinary(128), - primary key(customer_id) -); -create table corder ( - order_id bigint not null auto_increment, - customer_id bigint, - sku varbinary(128), - price bigint, - primary key(order_id) -); -``` - -The schema has been simplified to include only those fields that are significant to the example: - -* The `product` table contains the product information for all of the products. -* The `customer` table has a `customer_id` that has an `auto_increment`. A typical customer table would have a lot more columns, and sometimes additional detail tables. -* The `corder` table (named so because `order` is an SQL reserved word) has an `order_id` auto-increment column. It also has foreign keys into `customer(customer_id)` and `product(sku)`. - -## Next Steps - -You can now proceed with [MoveTables](../../user-guides/move-tables). - -Or alternatively, if you would like to teardown your example: - -```bash -./401_teardown.sh -rm -rf vtdataroot -``` diff --git a/content/en/docs/get-started/local.md b/content/en/docs/get-started/local.md index be3e1477e..76da67e27 100644 --- a/content/en/docs/get-started/local.md +++ b/content/en/docs/get-started/local.md @@ -12,7 +12,7 @@ This guide covers installing Vitess locally for testing purposes, from pre-compi Vitess supports MySQL 5.6+ and MariaDB 10.0+. We recommend MySQL 5.7 if your installation method provides a choice: -``` +```sh # Ubuntu based sudo apt install -y mysql-server etcd curl @@ -26,7 +26,7 @@ sudo yum -y install mysql-community-server etcd curl On apt-based distributions the services `mysqld` and `etcd` will need to be shutdown, since `etcd` will conflict with the `etcd` started in the examples, and `mysqlctl` will start its own copies of `mysqld`: -``` +```sh # Debian and Ubuntu sudo service mysql stop sudo service etcd stop @@ -39,7 +39,7 @@ sudo systemctl disable etcd AppArmor/SELinux will not allow Vitess to launch MySQL in any data directory by default. You will need to disable it: __AppArmor__: -``` +```sh # Debian and Ubuntu sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/ sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld @@ -49,25 +49,25 @@ sudo aa-status | grep mysqld ``` __SELinux__: -``` +```sh # CentOS sudo setenforce 0 ``` ## Install Vitess -Download the [latest binary release](https://github.com/vitessio/vitess/releases) for Vitess on Linux. For example with Vitess 5: +Download the [latest binary release](https://github.com/vitessio/vitess/releases) for Vitess on Linux. For example with Vitess 6: -``` -tar -xzf vitess-5.20+20200204-17a806ae5.tar.gz -cd vitess-5.20+20200204-17a806ae5 +```sh +tar -xzf vitess-6.0.20-20200429-f7fa695.tar.gz +cd vitess-6.0.20-20200429-f7fa695 sudo mkdir -p /usr/local/vitess sudo mv * /usr/local/vitess/ ``` Make sure to add `/usr/local/vitess/bin` to the `PATH` environment variable. You can do this by adding the following to your `$HOME/.bashrc` file: -``` +```sh export PATH=/usr/local/vitess/bin:${PATH} ``` @@ -77,7 +77,7 @@ You are now ready to start your first cluster! Open a new terminal window to ens Start by copying the local examples included with Vitess to your preferred location. For our first example we will deploy a [single unsharded keyspace](../../concepts/keyspace). The file `101_initial_cluster.sh` is for example `1` phase `01`. Lets execute it now: -``` +```sh cp -r /usr/local/vitess/examples/local ~/my-vitess-example cd ~/my-vitess-example ./101_initial_cluster.sh @@ -85,7 +85,7 @@ cd ~/my-vitess-example You should see output similar to the following: -``` +```text ~/my-vitess-example> ./101_initial_cluster.sh $ ./101_initial_cluster.sh add /vitess/global @@ -118,7 +118,7 @@ W0325 11:33:01.933188 16036 main.go:64] W0325 17:33:01.931580 reparent.go:191] You can also verify that the processes have started with `pgrep`: -``` +```bash ~/my-vitess-example> pgrep -fl vtdataroot 14119 etcd 14176 vtctld @@ -138,53 +138,26 @@ _The exact list of processes will vary. For example, you may not see `mysqld_saf If you encounter any errors, such as ports already in use, you can kill the processes and start over: -``` +```sh pkill -9 -e -f '(vtdataroot|VTDATAROOT)' # kill Vitess processes rm -rf vtdataroot ``` -## Connect to Your Cluster - -You should now be able to connect to the VTGate server that was started in `101_initial_cluster.sh`. To connect to it with the `mysql` command line client: - -``` -~/my-vitess-example> mysql -h 127.0.0.1 -P 15306 -Welcome to the MySQL monitor. Commands end with ; or \g. -Your MySQL connection id is 1 -Server version: 5.7.9-Vitess (Ubuntu) - -Copyright (c) 2000, 2019, Oracle and/or its affiliates. All rights reserved. - -Oracle is a registered trademark of Oracle Corporation and/or its -affiliates. Other names may be trademarks of their respective -owners. +## Setup Aliases -Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. +For ease-of-use, Vitess provides aliases for `mysql` and `vtctlclient`: -mysql> show tables; -+-----------------------+ -| Tables_in_vt_commerce | -+-----------------------+ -| corder | -| customer | -| product | -+-----------------------+ -3 rows in set (0.01 sec) +```bash +source ./env.sh ``` -It is recommended to configure the MySQL command line to default to these settings, as the user guides omit `-h 127.0.0.1 -P 15306` for brevity. Paste the following: +Setting up aliases changes `mysql` to always connect to Vitess for your current session. To revert this, type `unalias mysql && unalias vtctlclient` or close your session. -``` -cat << EOF > ~/.my.cnf -[client] -host=127.0.0.1 -port=15306 -EOF -``` +## Connect to your cluster -Repeating the previous step, you should now be able to use the `mysql` client without any settings: +You should now be able to connect to the VTGate server that was started in `101_initial_cluster.sh`: -``` +```bash ~/my-vitess-example> mysql Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 2 @@ -211,7 +184,7 @@ mysql> show tables; You can also browse to the vtctld console using the following URL: -``` +```text http://localhost:15000 ``` @@ -219,7 +192,7 @@ http://localhost:15000 In this example, we deployed a single unsharded keyspace named `commerce`. Unsharded keyspaces have a single shard named `0`. The following schema reflects a common ecommerce scenario that was created by the script: -``` +```sql create table product ( sku varbinary(128), description varbinary(128), @@ -248,11 +221,11 @@ The schema has been simplified to include only those fields that are significant ## Next Steps -You can now proceed with [Vertical Split](../../user-guides/vertical-split). +You can now proceed with [MoveTables](../../user-guides/move-tables). Or alternatively, if you would like to teardown your example: -``` +```bash ./401_teardown.sh rm -rf vtdataroot ``` diff --git a/content/en/docs/user-guides/move-tables.md b/content/en/docs/user-guides/move-tables.md index 4de692c41..8d79a6499 100644 --- a/content/en/docs/user-guides/move-tables.md +++ b/content/en/docs/user-guides/move-tables.md @@ -146,6 +146,7 @@ The final step is to remove the data from the original keyspace. As well as free vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 rdonly vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 replica vtctlclient SetShardTabletControl -blacklisted_tables=customer,corder -remove commerce/0 master +vtctlclient ApplySchema -sql-file drop_commerce_tables.sql commerce vtctlclient ApplyRoutingRules -rules='{}' ``` @@ -160,4 +161,4 @@ This confirms that the data has been correctly cleaned up. ## Next Steps -Congratulations! You've sucessfully moved tables between keyspaces. The next step to try out is to shard one of your keyspaces in [Resharding](../resharding). \ No newline at end of file +Congratulations! You've sucessfully moved tables between keyspaces. The next step to try out is to shard one of your keyspaces in [Resharding](../resharding).