Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding in freshdesk faqs #1430

Open
wants to merge 10 commits into
base: prod
Choose a base branch
from
25 changes: 13 additions & 12 deletions content/en/docs/faq/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,40 +8,41 @@ aliases: ['/docs/user-guides/faq/']

## Where can I ask questions about Vitess?

Our most popular channel and the one we recommend for asking questions you may have is our Slack located [here](https://vitess.io/slack).
We recommend asking questions in our [Slack workspace](https://vitess.io/slack).

We have a number of other options that can be used as well listed [here](https://vitess.io/community/).
We have a number of [other options](https://vitess.io/community/) that can be used as well.

Please do note that we request that you do not ask individual project members for support. Instead please use these channels where the whole community can help you and benefit from the solutions provided. Thanks!
We request that you not ask individual project members for support. Instead, please use these public communication channels where the community can help and also benefit from the solutions provided. Thanks!

## What are the key slack channels to join?

There are many channels available and we encourage you to join as many or as few as interest you. Some of the most popular channels are listed below:

* #general
* #beginners
* #developers
* #kubernetes
* #monitoring
* #operator
* #orchestrator-integration
* #feat-vtorc
* #releases
* #vreplication
* #website

## How can I contribute a Pull Request to Vitess?

We always enjoy having new contributors to Vitess. Just be sure to read the information [here](https://vitess.io/docs/contributing/) to start.
We welcome new contributors to Vitess. Just be sure to read the [ contributing guide](../contributing/) before you start.

If you are already familiar with Vitess and you'd like information on how to file a Pull Request or submit an Issue request check out the following links:
If you are already familiar with Vitess and you would like to know how to submit a Pull Request or file an Issue check out the following links:

* [Pull Requests](https://vitess.io/docs/contributing/github-workflow/#sending-pull-requests)
* [Issue](https://vitess.io/docs/contributing/github-workflow/#submitting-issues)
* [GitHub Workflow](../contributing/github-workflow/)
* [Submitting Issues](../contributing/github-workflow/#submitting-issues)

## What are good videos to watch to get started learning about Vitess?

We have a number of [recorded presentations and videos](https://vitess.io/docs/resources/presentations/) that can be watched to start learning about Vitess.
We have a number of [recorded presentations and videos](../learning-resources/) that can be watched to start learning about Vitess.

* For a curated list please check out a PlanetScale blog post [here](https://www.planetscale.com/blog/videos-intro-to-vitess-its-powerful-capabilities-and-how-to-get-started).
PlanetScale has also published a [Learn Vitess playlist](https://www.youtube.com/playlist?list=PLQiYtJSQdSEAJqEa5rh7Xa-RVCZWGzADN) on YouTube.

## Where can I read additional FAQs?
## Additional FAQs

PlanetScale hosts a knowledge base for Vitess. This additional resource is available [here](https://planetscale.freshdesk.com/support/solutions).
6 changes: 6 additions & 0 deletions content/en/docs/faq/advanced-configuration/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Advanced Configuration
docs_nav_disable_expand: false
weight: 10
---

29 changes: 29 additions & 0 deletions content/en/docs/faq/advanced-configuration/authentication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Authentication
weight: 1
---

## How do I set up MySQL authentication in Vitess?

Vitess uses its own mechanism for managing users and their permissions through VTGate. As a result, the CREATE USER.... and GRANT... statements will not work if sent through VTGate. Instead VTGate takes care of authentication for requests, so you will need to add any users that should have access to the Keyspaces via command-line options to VTGate.

The simplest way to configure users is via a static authentication method. You can define the users in a JSON formatted file or string. Then you can load this file into VTGate with the additional command line parameters.

You will be able to configure the UserData string and add multiple passwords. For password format, Vitess supports the mysql_native_password hash format and you should always specify your passwords using this in a non-test or external environment.

To see an example of how to configure the static authentication file and more information on the various options please read this [guide](https://vitess.io/docs/user-guides/configuration-advanced/user-management/#authentication).

There are other authentication mechanisms that can be utilized including LDAP-based authentication and TLS client certificate-based authentication.

## How do I configure user-level permissions in Vitess?

If you need to enforce fine-grained access control in Vitess, you cannot use the normal MySQL GRANT system to give certain application-level MySQL users more or fewer permissions than others. This is because Vitess uses connection pooling with fixed MySQL users at the VTTablet level, and implements its own authentication at the VTGate level.

Not all of the MySQL GRANT system has been implemented in Vitess. Authorization can be done via table-level ACLs. Individual users at the VTGate level can be assigned 3 levels of permissions.
- Read (corresponding to SELECT)
- Write (corresponding to DML, e.g. INSERT, UPDATE, DELETE)
- Admin (corresponding to DDL, e.g. ALTER TABLE)

The tables to which the permissions apply can be enumerated or specified using a regular expression.

Vitess authorization via ACLs is applied at the VTTablet level, as opposed to on VTGate, where authentication is enforced. There are a number of [VTTablet command line parameters]((https://vitess.io/docs/user-guides/configuration-advanced/authorization/#vttablet-parameters-for-table-acls) that control the behavior of ACLs.
20 changes: 20 additions & 0 deletions content/en/docs/faq/advanced-configuration/metrics.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Metrics
weight: 8
---

## What Grafana dashboards are available?

There are a set of [Grafana dashboards and Prometheus alerts](https://github.com/vitessio/vitess/tree/main/vitess-mixin) available on the Vitess tree in GitHub. For more context on these dashboards please refer to the [original pull request](https://github.com/vitessio/vitess/pull/5609).

## How can I implement user-level query logging?

If you would like to differentiate metrics for a 'bad_user@their_machine' from a 'good_user@their_machine', rather than having both users appear to be the same user from the same server to MySQL you will need to use table ACLs.

Vitess exports per-user stats on table ACLs. There are example usages of table ACLs demonstrated in the end-to-end tests.
- How to [configure table ACLs](https://github.com/vitessio/vitess/blob/master/go/vt/vttablet/endtoend/main_test.go#L174)
- [Tests](https://github.com/vitessio/vitess/blob/master/go/vt/vttablet/endtoend/acl_test.go) that demonstrate how table ACLs work

To locate the variables that enable the export of per-user stats you will need to look in `/debug/vars` for variables that start with `User`, like `UserTableQueryCount`. The export itself is a multi-dimensional export categorized by Table, User and Query Type. You can also find similar names exported as prometheus metrics.

Analyzing these variables can enable you to quickly narrow down the root cause of an incident, as these stats are fine-grained. Once you've identified the table and query type, you can then drill into `/queryz` or `/debug/query_stats` to determine if the issue is a particular query.
20 changes: 20 additions & 0 deletions content/en/docs/faq/advanced-configuration/mysql-server-vars.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: MySQL server variables
weight: 10
---

## How can I change MySQL server variables in Vitess?

In general, if you want to apply global variables at the MySQL level, you have to do it through VTTablet. There are a few ways to do that in the operator, but we recommend that you use vtctldclient ExecuteFetchAsDba.

For example if you want to temporarily switch `sync_binlog` off on the MySQL that is being managed by a tablet with alias `zone1-0000000100` you would perform the following:

```sh
$ vtctldclient -server localhost:15999 ExecuteFetchAsDba zone1-0000000100 "set global sync_binlog=0"
```

This would show the following result after checking the variable:

```sh
$ vtctldclient -server localhost:15999 ExecuteFetchAsDba zone1-0000000100 "show variables like 'sync_binlog'"+---------------+-------+| Variable_name | Value |+---------------+-------+| sync_binlog | 0 |+---------------+-------+
```
20 changes: 20 additions & 0 deletions content/en/docs/faq/advanced-configuration/vindex.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
title: Vindexes
weight: 6
---

## What is a Vindex?
If you are unfamiliar with Vindexes, we recommend that you first read the [documentation](https://vitess.io/docs/reference/features/vindexes/).

## Does the Primary Vindex for a table need to match its Primary Key?

It is not necessary that a Primary Vindex be the same as the Primary Key. In fact, there are many use cases where you would not want this. For example, if there are tables with one-to-many relationships, the Primary Vindex of the main table is likely to be the same as the Primary Key.

However, if you want the rows of the secondary table to reside in the same shard as the parent row, the Primary Vindex for that table must be the foreign key that points to the main table. A typical example is a user and order table.

In this case, the order table has the `user_id` as a foreign key to the `id` of the user table. The `order_id` may be the primary key for `order`, but you may still want to choose `user_id` as Primary Vindex, which will make a user's orders live in the same shard as the user.

## How do I create a new LookupVindex?

Please refer to the [user guide on CreateLookupVindex](https://vitess.io/docs/user-guides/configuration-advanced/createlookupvindex/) to learn how to create a new Lookup Vindex, how to add it to a column, and how to verify that it was successfully added.

12 changes: 12 additions & 0 deletions content/en/docs/faq/advanced-configuration/vreplication.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
title: VReplication
weight: 7
---


## What is the typical replication lag in VReplication?

VReplication is very fast, typically replication lag is below a second as long as your network is good.

However, if there is a network partition, things can be delayed depending on your configuration. For anything transactional, we recommend always reading from the source table. This principle follows the same rule as recommending reading from primary instead of a replica.

34 changes: 34 additions & 0 deletions content/en/docs/faq/advanced-configuration/vschema.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Vschema
weight: 5
---

## How do you select your sharding key for Vitess?

It is important to choose a strong sharding key aka primary Vindex when creating your VSchema, so the qualities you should look at are the following:
- Frequency in WHERE clause of queries
- Uniqueness (of the mapping function)
- This means that a vindex will map a column value to only one keyspace ID (or none at all)
- Co-locating rows for joins and for single-shard transactions
- This means using the same primary vindex for multiple tables, as all rows tied to the same primary index will automatically be located in the same shard due to the uniqueness property of the vindex map
- High cardinality
- This means producing a sufficiently large number of keyspace IDs, which will give you finer control for rebalancing load through re-sharding

You can read more about how to select your primary vindex in this [blog post](https://vitess.io/blog/2019-02-07-choosing-a-vindex/).

## How can you update or change your vschema?

Vitess provides a CLI command [ApplyVSchema](https://vitess.io/docs/reference/programs/vtctldclient/vtctldclient_applyvschema/) to make updates to the vschema within Vitess.

## Without a Vschema how can table and schema routing work?

There are a couple of special cases for when you don’t have a VSchema in place.

For example, if you add a table called foo to an unsharded keyspace called ks1 the following routing will enable you to access the table:
1. `use ks1; select * from foo;`
2. From the unqualified schema using `select * from ks1.foo;`
3. As long as you have only one keyspace, you can use `select * from foo;` in anonymous mode.

However, if you have more than one keyspace you will not be able to access the table from the unqualified schema using `select * from foo` until you add the table to the VSchema.

For a sharded keyspace you will not be able to access the table until you have a VSchema for it. However, you will be able to see it in `show tables`.
59 changes: 59 additions & 0 deletions content/en/docs/faq/advanced-configuration/vtgate.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
title: VTGate
weight: 4
---

## How does VTGate know which shard to route a query to?

VTGate knows both the Vschema and the schema of your tables in the backing MySQL databases.

This enables VTGate to look at the WHERE clause of the query and then route the queries to the correct shards. VTGate is also aware of the sharding metadata, cluster state, and availability of tables, so it will only scatter the query across the shards it needs to use.

## How do you use gRPC with VTGate?

To do this you will need to use the Vitess MySQL Go client. We have a [Golang compatible gRPC driver](https://pkg.go.dev/vitess.io/vitess/go/vt/vitessdriver) and a [Java driver](https://github.com/vitessio/vitess/tree/master/java).

Once you have the appropriate driver you will need to add the `--service_map grpc-vtgateservice` VTGate flag and set the port `--grpc_port`.

This runs on a standard gRPC interface, so if you want to directly use it you can follow the example below:

```sh
#!/usr/bin/env node
import Debug from "debug";
import * as grpc from "grpc";
import {CallerID} from './proto/vitess/vtrpc_pb';
import {BoundQuery} from './proto/vitess/query_pb';
import {Session,ExecuteRequest,ExecuteResponse} from './proto/vitess/vtgate_pb';
import {VitessClient} from './proto/vitess/vtgateservice_grpc_pb';
const log = Debug("VtgateClient");
const client = new VitessClient("139.178.90.99:15306",grpc.credentials.createInsecure());
const SingleQuery = async () => {
return new Promise((resolve,reject) => {
const caller = new CallerID();
caller.setPrincipal("nodejs");
const session = new Session();
session.setTargetString("main");
const query = new BoundQuery();
query.setSql("SELECT * from main.sbtest1 where id=10");
const request = new ExecuteRequest()
request.setSession(session);
request.setQuery(query);
request.setCallerId(caller);
client.execute(request, (err: grpc.ServiceError | null, response: ExecuteResponse ) => {
if( err != null ){
console.log(`[SingleQuery] Error: ${err.message}`)
reject(err); return;
}
console.log(`[SingleQuery] Response: ${JSON.stringify(response.toObject())}`)
resolve(response);
});
});
}
async function main() {
client.
console.log(`[main] Starting`);
await SingleQuery();
}
main().then((_) => _);
```

61 changes: 61 additions & 0 deletions content/en/docs/faq/advanced-configuration/vttablet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
title: VTTablet
weight: 3
---

## Can VTTablets start without sql_mode set to STRICT_TRANS_TABLES?

Yes. This check can be disabled by setting `--enforce_strict_trans_tables=false` on the VTTablet.

## What does it mean if a VTTablet is unhappy?

An unhappy VTTablet is one whose replication is lagging beyond the limit to which the `--degraded_threshold` is set. An unhappy VTTablet could still be serving queries.

VTGate will always prefer happy VTTablets over unhappy VTTablets, however if all your VTTablets are unhappy then it will serve all of them.

## Are there recommended thresholds for health statuses?

We don’t have recommended thresholds as Vitess doesn’t make any functional decisions based on the statuses, beyond representing the current status in the UI. You do need to be sure to set your alerting to something lower than the threshold you choose.

Another option is if you have the replication heartbeat enabled, you can monitor that statistic.

Or if you’re exporting the mysqld stats using something like [mysqld-exporter](https://github.com/prometheus/mysqld_exporter) you can monitor the replication lag via those statistics directly.

If you are using this option you will need to set the alert at something like: "Fire when lag is > X seconds for Y minutes". Otherwise you'll get false alerts, since the `Seconds_Behind_Source` reporting from MySQL often jumps around when either the replication is stopped/started or when traffic is low.

After either of those occur the `Seconds_Behind_Source` reporting can take some time to settle.

## How can I change the DBA login to VTTablet?

If you are concerned about access security and want to change the admin user account for a given VTTablet you will need to perform the following steps:
1. Create the new user in the database.
2. Give that user the required permissions. The list of what Vitess requires can be found [here](https://github.com/vitessio/vitess/blob/master/config/init_db.sql).
3. Then when you start up Vitess you need to pass in the username and passwords to Vitess. That is done by setting `--db_user` and `--db-credentials-file`. The credentials file will have the format:

```sh
{
"<user name>": [
"<password>"
]
}
```

After you have followed the above steps the credentials file will tell VTTablet the account to use to connect to the database.

You can read additional details on the credentials file format [here](https://github.com/vitessio/vitess/blob/master/examples/local/mysql_auth_server_static_creds.json).

## If mysqld replication thread isn't running what restarts it?

VTOrc will automatically restart replication if it is not running.

## What is semi-sync replication?

Semi-sync replication enables you to prevent your primary from acknowledging a transaction to the client until a replica confirms that it has received all the changes. This adds an extra guarantee that at least one other machine has a copy of the changes.

This addresses the problem of a combination of lagging replication and network issues resulting in data loss. With semi-sync replication, even if you have network issues you shouldn’t lose your data.

Please do note that when using semi-sync replication you will have to wait for your data to flow from the primary to the replica and then get a confirmation back to the primary. Thus each transaction may take longer. The length of time depends on the round trip time from the primary to the replica.

## Why would I use semi-sync replication?

Semi-sync replication ensures data durability between the primary and at least one replica. Hardware failures are unavoidable but don't need to result in data loss if you run with semi-sync replication.
6 changes: 6 additions & 0 deletions content/en/docs/faq/getting-started/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Getting Started
docs_nav_disable_expand: false
weight: 1
---

Loading